Merge branch 'notification-read-api' into swn
This commit is contained in:
commit
b4954fe7c2
635 changed files with 4867 additions and 4789 deletions
|
|
@ -35,8 +35,8 @@ app.use(views(_dirname + '/views', {
|
|||
extension: 'pug',
|
||||
options: {
|
||||
version: config.version,
|
||||
config
|
||||
}
|
||||
config,
|
||||
},
|
||||
}));
|
||||
|
||||
// Serve favicon
|
||||
|
|
@ -78,7 +78,7 @@ router.get('/assets/(.*)', async ctx => {
|
|||
// Apple touch icon
|
||||
router.get('/apple-touch-icon.png', async ctx => {
|
||||
await send(ctx as any, '/apple-touch-icon.png', {
|
||||
root: staticAssets
|
||||
root: staticAssets,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -101,12 +101,12 @@ router.get('/twemoji/(.*)', async ctx => {
|
|||
// ServiceWorker
|
||||
router.get('/sw.js', async ctx => {
|
||||
await send(ctx as any, `/sw.js`, {
|
||||
root: swAssets
|
||||
root: swAssets,
|
||||
});
|
||||
});
|
||||
router.get(`/sw-lib.${config.version}.js`, async ctx => {
|
||||
await send(ctx as any, `/sw-lib.js`, {
|
||||
root: swAssets
|
||||
root: swAssets,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -115,7 +115,7 @@ router.get('/manifest.json', require('./manifest'));
|
|||
|
||||
router.get('/robots.txt', async ctx => {
|
||||
await send(ctx as any, '/robots.txt', {
|
||||
root: staticAssets
|
||||
root: staticAssets,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -124,7 +124,7 @@ router.get('/robots.txt', async ctx => {
|
|||
// Docs
|
||||
router.get('/api-doc', async ctx => {
|
||||
await send(ctx as any, '/redoc.html', {
|
||||
root: staticAssets
|
||||
root: staticAssets,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -140,7 +140,7 @@ const getFeed = async (acct: string) => {
|
|||
const user = await Users.findOne({
|
||||
usernameLower: username.toLowerCase(),
|
||||
host,
|
||||
isSuspended: false
|
||||
isSuspended: false,
|
||||
});
|
||||
|
||||
return user && await packFeed(user);
|
||||
|
|
@ -189,7 +189,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => {
|
|||
const user = await Users.findOne({
|
||||
usernameLower: username.toLowerCase(),
|
||||
host,
|
||||
isSuspended: false
|
||||
isSuspended: false,
|
||||
});
|
||||
|
||||
if (user != null) {
|
||||
|
|
@ -205,7 +205,7 @@ router.get(['/@:user', '/@:user/:sub'], async (ctx, next) => {
|
|||
user, profile, me,
|
||||
sub: ctx.params.sub,
|
||||
instanceName: meta.name || 'Misskey',
|
||||
icon: meta.iconUrl
|
||||
icon: meta.iconUrl,
|
||||
});
|
||||
ctx.set('Cache-Control', 'public, max-age=30');
|
||||
} else {
|
||||
|
|
@ -219,7 +219,7 @@ router.get('/users/:user', async ctx => {
|
|||
const user = await Users.findOne({
|
||||
id: ctx.params.user,
|
||||
host: null,
|
||||
isSuspended: false
|
||||
isSuspended: false,
|
||||
});
|
||||
|
||||
if (user == null) {
|
||||
|
|
@ -244,7 +244,7 @@ router.get('/notes/:note', async (ctx, next) => {
|
|||
// TODO: Let locale changeable by instance setting
|
||||
summary: getNoteSummary(_note),
|
||||
instanceName: meta.name || 'Misskey',
|
||||
icon: meta.iconUrl
|
||||
icon: meta.iconUrl,
|
||||
});
|
||||
|
||||
if (['public', 'home'].includes(note.visibility)) {
|
||||
|
|
@ -264,14 +264,14 @@ router.get('/@:user/pages/:page', async (ctx, next) => {
|
|||
const { username, host } = Acct.parse(ctx.params.user);
|
||||
const user = await Users.findOne({
|
||||
usernameLower: username.toLowerCase(),
|
||||
host
|
||||
host,
|
||||
});
|
||||
|
||||
if (user == null) return;
|
||||
|
||||
const page = await Pages.findOne({
|
||||
name: ctx.params.page,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (page) {
|
||||
|
|
@ -281,7 +281,7 @@ router.get('/@:user/pages/:page', async (ctx, next) => {
|
|||
await ctx.render('page', {
|
||||
page: _page,
|
||||
profile,
|
||||
instanceName: meta.name || 'Misskey'
|
||||
instanceName: meta.name || 'Misskey',
|
||||
});
|
||||
|
||||
if (['public'].includes(page.visibility)) {
|
||||
|
|
@ -310,7 +310,7 @@ router.get('/clips/:clip', async (ctx, next) => {
|
|||
await ctx.render('clip', {
|
||||
clip: _clip,
|
||||
profile,
|
||||
instanceName: meta.name || 'Misskey'
|
||||
instanceName: meta.name || 'Misskey',
|
||||
});
|
||||
|
||||
ctx.set('Cache-Control', 'public, max-age=180');
|
||||
|
|
@ -333,7 +333,7 @@ router.get('/gallery/:post', async (ctx, next) => {
|
|||
post: _post,
|
||||
profile,
|
||||
instanceName: meta.name || 'Misskey',
|
||||
icon: meta.iconUrl
|
||||
icon: meta.iconUrl,
|
||||
});
|
||||
|
||||
ctx.set('Cache-Control', 'public, max-age=180');
|
||||
|
|
@ -355,7 +355,7 @@ router.get('/channels/:channel', async (ctx, next) => {
|
|||
const meta = await fetchMeta();
|
||||
await ctx.render('channel', {
|
||||
channel: _channel,
|
||||
instanceName: meta.name || 'Misskey'
|
||||
instanceName: meta.name || 'Misskey',
|
||||
});
|
||||
|
||||
ctx.set('Cache-Control', 'public, max-age=180');
|
||||
|
|
@ -377,7 +377,7 @@ router.get('/_info_card_', async ctx => {
|
|||
host: config.host,
|
||||
meta: meta,
|
||||
originalUsersCount: await Users.count({ host: null }),
|
||||
originalNotesCount: await Notes.count({ userHost: null })
|
||||
originalNotesCount: await Notes.count({ userHost: null }),
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -417,7 +417,7 @@ router.get('(.*)', async ctx => {
|
|||
title: meta.name || 'Misskey',
|
||||
instanceName: meta.name || 'Misskey',
|
||||
desc: meta.description,
|
||||
icon: meta.iconUrl
|
||||
icon: meta.iconUrl,
|
||||
});
|
||||
ctx.set('Cache-Control', 'public, max-age=300');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue