<commit_before>import * as express from 'express';
import * as multer from 'multer';
const upload: any = multer({ dest: 'uploads/' });

import { MisskeyExpressRequest } from '../misskeyExpressRequest';
import { MisskeyExpressResponse } from '../misskeyExpressResponse';
import requestApi from '../utils/requestApi';

export default function router(app: express.Express): void {
	'use strict';

	app.get('/', (req: MisskeyExpressRequest, res: MisskeyExpressResponse) => {
		if (req.isLogin) {
			res.send(req.me.id);
		} else {
			res.send('sakuhima');
		}
	});

	app.post('/refresh-session', (req: MisskeyExpressRequest, res: MisskeyExpressResponse) => {
		if (req.isLogin) {
			const userId: string = req.session.userId;
			requestApi('GET', 'account/show', {}, userId).then((me: Object) => {
				req.session.user = me;
				req.session.save(() => {
					res.json(me);
				});
			});
		}
	});

	app.get('/web/analyze-url', require('./endpoints/analyze-url').default);
	app.put('/web/sites/desktop/update-avatar', require('./endpoints/sites/desktop/update-avatar').default);
	app.get('/web/sites/desktop/album/open', require('./endpoints/sites/desktop/album/open').default);
	app.get('/web/sites/desktop/album/files', require('./endpoints/sites/desktop/album/files').default);
	app.post('/web/sites/desktop/album/upload',
		upload.single('file'),
		require('./endpoints/sites/desktop/album/upload').default);
	app.post('/web/sites/desktop/home/posts/reply', require('./endpoints/sites/desktop/home/posts/reply').default);
	app.get('/web/sites/desktop/home/posts/timeline', require('./endpoints/sites/desktop/home/posts/timeline').default);
	app.get('/web/sites/desktop/home/posts/talk', require('./endpoints/sites/desktop/home/posts/talk').default);
	app.get('/web/sites/desktop/home/posts/replies', require('./endpoints/sites/desktop/home/posts/replies').default);

	app.get('*', (req: MisskeyExpressRequest, res: MisskeyExpressResponse) => {
		requestApi('GET', req.path, req.query, req.user).then((response: any) => {
			res.json(response);<commit_msg>Fkx bug<commit_after>import * as express from 'express';
import * as multer from 'multer';
const upload: any = multer({ dest: 'uploads/' });

import { MisskeyExpressRequest } from '../misskeyExpressRequest';
import { MisskeyExpressResponse } from '../misskeyExpressResponse';
import requestApi from '../utils/requestApi';

export default function router(app: express.Express): void {
	'use strict';

	app.get('/', (req: MisskeyExpressRequest, res: MisskeyExpressResponse) => {
		if (req.isLogin) {
			res.send(req.me.id);
		} else {
			res.send('sakuhima');
		}
	});

	app.post('/refresh-session', (req: MisskeyExpressRequest, res: MisskeyExpressResponse) => {
		if (req.isLogin) {
			const userId: string = req.session.userId;
			requestApi('GET', 'account/show', {}, userId).then((me: Object) => {
				req.session.user = me;
				req.session.save(() => {
					res.json(me);
				});
			});
		}
	});

	app.get('/web/analyze-url', require('./endpoints/analyze-url').default);
	app.put('/web/sites/desktop/update-avatar', require('./endpoints/sites/desktop/update-avatar').default);
	app.get('/web/sites/desktop/album/open', require('./endpoints/sites/desktop/album/open').default);
	app.get('/web/sites/desktop/album/files', require('./endpoints/sites/desktop/album/files').default);
	app.post('/web/sites/desktop/album/upload',
		upload.single('file'),
		require('./endpoints/sites/desktop/album/upload').default);
	app.post('/web/sites/desktop/home/posts/reply', require('./endpoints/sites/desktop/home/posts/reply').default);
	app.get('/web/sites/desktop/home/posts/timeline', require('./endpoints/sites/desktop/home/posts/timeline').default);
	app.get('/web/sites/desktop/home/posts/talk', require('./endpoints/sites/desktop/home/posts/talk').default);
	app.get('/web/sites/desktop/home/posts/replies', require('./endpoints/sites/desktop/home/posts/replies').default);

	app.get('*', (req: MisskeyExpressRequest, res: MisskeyExpressResponse) => {
		requestApi('GET', req.path.substring(1), req.query, req.user).then((response: any) => {
			res.json(response);
{'fraction_non_alphanumeric': 0.2014580801944107, 'fraction_numerical': 0.00024301336573511544, 'mean_word_length': 4.6929460580912865, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6914143', 'n_tokens_mistral': 1450, 'n_tokens_neox': 1319, 'n_words': 190}