Merge remote-tracking branch 'nullobsi/secure-fetch' into develop
This commit is contained in:
commit
59f80c60b9
@ -76,7 +76,7 @@ export default class Resolver {
|
||||
throw new Error('Instance is not allowed');
|
||||
}
|
||||
|
||||
if (!this.user) {
|
||||
if (config.signToActivityPubGet && !this.user) {
|
||||
this.user = await getInstanceActor();
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,6 @@ export const meta = {
|
||||
requireCredential: false,
|
||||
requireCredentialPrivateMode: true,
|
||||
|
||||
description: 'Get a list of children of a notes. Children includes replies as well as quote renotes that quote the respective post. A post will not be duplicated if it is a reply and a quote of a note in this thread. For depths larger than 1 the threading has to be computed by the client.',
|
||||
|
||||
res: {
|
||||
type: 'array',
|
||||
optional: false, nullable: false,
|
||||
@ -29,20 +27,7 @@ export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
noteId: { type: 'string', format: 'misskey:id' },
|
||||
limit: {
|
||||
description: 'The maximum number of replies/quotes to show per parent note, i.e. the maximum number of children each note may have.',
|
||||
type: 'integer',
|
||||
minimum: 1,
|
||||
maximum: 100,
|
||||
default: 10,
|
||||
},
|
||||
depth: {
|
||||
description: 'The number of layers of replies to fetch at once. Defaults to 1 for backward compatibility.',
|
||||
type: 'integer',
|
||||
minimum: 1,
|
||||
maximum: 100,
|
||||
default: 1,
|
||||
},
|
||||
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||
sinceId: { type: 'string', format: 'misskey:id' },
|
||||
untilId: { type: 'string', format: 'misskey:id' },
|
||||
},
|
||||
|
@ -327,32 +327,24 @@ router.get('/notes/:note', async (ctx, next) => {
|
||||
});
|
||||
|
||||
if (note) {
|
||||
try {
|
||||
// FIXME: packing with detail may throw an error if the reply or renote is not visible (#8774)
|
||||
const _note = await Notes.pack(note);
|
||||
const profile = await UserProfiles.findOneByOrFail({ userId: note.userId });
|
||||
const meta = await fetchMeta();
|
||||
await ctx.render('note', {
|
||||
note: _note,
|
||||
profile,
|
||||
avatarUrl: await Users.getAvatarUrl(await Users.findOneByOrFail({ id: note.userId })),
|
||||
// TODO: Let locale changeable by instance setting
|
||||
summary: getNoteSummary(_note),
|
||||
instanceName: meta.name || 'Calckey',
|
||||
icon: meta.iconUrl,
|
||||
themeColor: meta.themeColor,
|
||||
});
|
||||
const _note = await Notes.pack(note);
|
||||
const profile = await UserProfiles.findOneByOrFail({ userId: note.userId });
|
||||
const meta = await fetchMeta();
|
||||
await ctx.render('note', {
|
||||
note: _note,
|
||||
profile,
|
||||
avatarUrl: await Users.getAvatarUrl(await Users.findOneByOrFail({ id: note.userId })),
|
||||
// TODO: Let locale changeable by instance setting
|
||||
summary: getNoteSummary(_note),
|
||||
instanceName: meta.name || 'Calckey',
|
||||
icon: meta.iconUrl,
|
||||
privateMode: meta.privateMode,
|
||||
themeColor: meta.themeColor,
|
||||
});
|
||||
|
||||
ctx.set('Cache-Control', 'public, max-age=15');
|
||||
ctx.set('Cache-Control', 'public, max-age=15');
|
||||
|
||||
return;
|
||||
} catch (err) {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') {
|
||||
// note not visible to user
|
||||
} else {
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
await next();
|
||||
@ -543,7 +535,6 @@ router.get('(.*)', async ctx => {
|
||||
splashIcon: splashIconUrl,
|
||||
themeColor: meta.themeColor,
|
||||
privateMode: meta.privateMode,
|
||||
randomMOTD: motd[Math.floor(Math.random() * motd.length)],
|
||||
});
|
||||
ctx.set('Cache-Control', 'public, max-age=3');
|
||||
});
|
||||
|
@ -58,7 +58,7 @@ html
|
||||
|
||||
block og
|
||||
meta(property='og:title' content= title || 'Calckey')
|
||||
meta(property='og:description' content= desc || '✨🌎✨ A interplanetary communication platform ✨🚀✨')
|
||||
meta(property='og:description' content= desc || '✨🌎 A interplanetary communication platform 🚀✨')
|
||||
meta(property='og:image' content= img)
|
||||
|
||||
style
|
||||
|
@ -1,7 +1,7 @@
|
||||
extends ./base
|
||||
|
||||
block vars
|
||||
- const title = privateMode ? '非公開インスタンス' : channel.name;
|
||||
- const title = privateMode ? instanceName : channel.name;
|
||||
- const url = `${config.url}/channels/${channel.id}`;
|
||||
|
||||
block title
|
||||
|
@ -2,7 +2,7 @@ extends ./base
|
||||
|
||||
block vars
|
||||
- const user = clip.user;
|
||||
- const title = privateMode ? '非公開インスタンス' : clip.name;
|
||||
- const title = privateMode ? instanceName : clip.name;
|
||||
- const url = `${config.url}/clips/${clip.id}`;
|
||||
|
||||
block title
|
||||
|
@ -2,7 +2,7 @@ extends ./base
|
||||
|
||||
block vars
|
||||
- const user = post.user;
|
||||
- const title = privateMode ? '非公開インスタンス' : post.title;
|
||||
- const title = privateMode ? instanceName : post.title;
|
||||
- const url = `${config.url}/gallery/${post.id}`;
|
||||
|
||||
block title
|
||||
|
@ -2,7 +2,7 @@ extends ./base
|
||||
|
||||
block vars
|
||||
- const user = note.user;
|
||||
- const title = privateMode ? '非公開インスタンス' : (user.name ? `${user.name} (@${user.username})` : `@${user.username}`);
|
||||
- const title = privateMode ? instanceName : (user.name ? `${user.name} (@${user.username})` : `@${user.username}`);
|
||||
- const url = `${config.url}/notes/${note.id}`;
|
||||
- const isRenote = note.renote && note.text == null && note.fileIds.length == 0 && note.poll == null;
|
||||
|
||||
|
@ -2,7 +2,7 @@ extends ./base
|
||||
|
||||
block vars
|
||||
- const user = page.user;
|
||||
- const title = privateMode ? '非公開インスタンス' : page.title;
|
||||
- const title = privateMode ? instanceName : page.title;
|
||||
- const url = `${config.url}/@${user.username}/${page.name}`;
|
||||
|
||||
block title
|
||||
|
@ -1,7 +1,7 @@
|
||||
extends ./base
|
||||
|
||||
block vars
|
||||
- const title = privateMode ? '非公開インスタンス' : (user.name ? `${user.name} (@${user.username})` : `@${user.username}`);
|
||||
- const title = privateMode ? instanceName : (user.name ? `${user.name} (@${user.username})` : `@${user.username}`);
|
||||
- const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`;
|
||||
|
||||
block title
|
||||
|
@ -133,6 +133,7 @@ import FormRange from '@/components/form/range.vue';
|
||||
import FormInput from '@/components/form/input.vue';
|
||||
import FormTextarea from '@/components/form/textarea.vue';
|
||||
import FormButton from '@/components/MkButton.vue';
|
||||
import FormTextarea from '@/components/form/textarea.vue';
|
||||
import * as os from '@/os';
|
||||
import { fetchInstance } from '@/instance';
|
||||
import { i18n } from '@/i18n';
|
||||
|
Loading…
Reference in New Issue
Block a user