Merge remote-tracking branch 'nullobsi/secure-fetch' into develop
This commit is contained in:
commit
59f80c60b9
11 changed files with 26 additions and 49 deletions
|
@ -76,7 +76,7 @@ export default class Resolver {
|
||||||
throw new Error('Instance is not allowed');
|
throw new Error('Instance is not allowed');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.user) {
|
if (config.signToActivityPubGet && !this.user) {
|
||||||
this.user = await getInstanceActor();
|
this.user = await getInstanceActor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,6 @@ export const meta = {
|
||||||
requireCredential: false,
|
requireCredential: false,
|
||||||
requireCredentialPrivateMode: true,
|
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: {
|
res: {
|
||||||
type: 'array',
|
type: 'array',
|
||||||
optional: false, nullable: false,
|
optional: false, nullable: false,
|
||||||
|
@ -29,20 +27,7 @@ export const paramDef = {
|
||||||
type: 'object',
|
type: 'object',
|
||||||
properties: {
|
properties: {
|
||||||
noteId: { type: 'string', format: 'misskey:id' },
|
noteId: { type: 'string', format: 'misskey:id' },
|
||||||
limit: {
|
limit: { type: 'integer', minimum: 1, maximum: 100, default: 10 },
|
||||||
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,
|
|
||||||
},
|
|
||||||
sinceId: { type: 'string', format: 'misskey:id' },
|
sinceId: { type: 'string', format: 'misskey:id' },
|
||||||
untilId: { type: 'string', format: 'misskey:id' },
|
untilId: { type: 'string', format: 'misskey:id' },
|
||||||
},
|
},
|
||||||
|
|
|
@ -327,8 +327,6 @@ router.get('/notes/:note', async (ctx, next) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (note) {
|
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 _note = await Notes.pack(note);
|
||||||
const profile = await UserProfiles.findOneByOrFail({ userId: note.userId });
|
const profile = await UserProfiles.findOneByOrFail({ userId: note.userId });
|
||||||
const meta = await fetchMeta();
|
const meta = await fetchMeta();
|
||||||
|
@ -340,19 +338,13 @@ router.get('/notes/:note', async (ctx, next) => {
|
||||||
summary: getNoteSummary(_note),
|
summary: getNoteSummary(_note),
|
||||||
instanceName: meta.name || 'Calckey',
|
instanceName: meta.name || 'Calckey',
|
||||||
icon: meta.iconUrl,
|
icon: meta.iconUrl,
|
||||||
|
privateMode: meta.privateMode,
|
||||||
themeColor: meta.themeColor,
|
themeColor: meta.themeColor,
|
||||||
});
|
});
|
||||||
|
|
||||||
ctx.set('Cache-Control', 'public, max-age=15');
|
ctx.set('Cache-Control', 'public, max-age=15');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} catch (err) {
|
|
||||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') {
|
|
||||||
// note not visible to user
|
|
||||||
} else {
|
|
||||||
throw err;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
await next();
|
await next();
|
||||||
|
@ -543,7 +535,6 @@ router.get('(.*)', async ctx => {
|
||||||
splashIcon: splashIconUrl,
|
splashIcon: splashIconUrl,
|
||||||
themeColor: meta.themeColor,
|
themeColor: meta.themeColor,
|
||||||
privateMode: meta.privateMode,
|
privateMode: meta.privateMode,
|
||||||
randomMOTD: motd[Math.floor(Math.random() * motd.length)],
|
|
||||||
});
|
});
|
||||||
ctx.set('Cache-Control', 'public, max-age=3');
|
ctx.set('Cache-Control', 'public, max-age=3');
|
||||||
});
|
});
|
||||||
|
|
|
@ -58,7 +58,7 @@ html
|
||||||
|
|
||||||
block og
|
block og
|
||||||
meta(property='og:title' content= title || 'Calckey')
|
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)
|
meta(property='og:image' content= img)
|
||||||
|
|
||||||
style
|
style
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extends ./base
|
extends ./base
|
||||||
|
|
||||||
block vars
|
block vars
|
||||||
- const title = privateMode ? '非公開インスタンス' : channel.name;
|
- const title = privateMode ? instanceName : channel.name;
|
||||||
- const url = `${config.url}/channels/${channel.id}`;
|
- const url = `${config.url}/channels/${channel.id}`;
|
||||||
|
|
||||||
block title
|
block title
|
||||||
|
|
|
@ -2,7 +2,7 @@ extends ./base
|
||||||
|
|
||||||
block vars
|
block vars
|
||||||
- const user = clip.user;
|
- const user = clip.user;
|
||||||
- const title = privateMode ? '非公開インスタンス' : clip.name;
|
- const title = privateMode ? instanceName : clip.name;
|
||||||
- const url = `${config.url}/clips/${clip.id}`;
|
- const url = `${config.url}/clips/${clip.id}`;
|
||||||
|
|
||||||
block title
|
block title
|
||||||
|
|
|
@ -2,7 +2,7 @@ extends ./base
|
||||||
|
|
||||||
block vars
|
block vars
|
||||||
- const user = post.user;
|
- const user = post.user;
|
||||||
- const title = privateMode ? '非公開インスタンス' : post.title;
|
- const title = privateMode ? instanceName : post.title;
|
||||||
- const url = `${config.url}/gallery/${post.id}`;
|
- const url = `${config.url}/gallery/${post.id}`;
|
||||||
|
|
||||||
block title
|
block title
|
||||||
|
|
|
@ -2,7 +2,7 @@ extends ./base
|
||||||
|
|
||||||
block vars
|
block vars
|
||||||
- const user = note.user;
|
- 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 url = `${config.url}/notes/${note.id}`;
|
||||||
- const isRenote = note.renote && note.text == null && note.fileIds.length == 0 && note.poll == null;
|
- const isRenote = note.renote && note.text == null && note.fileIds.length == 0 && note.poll == null;
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ extends ./base
|
||||||
|
|
||||||
block vars
|
block vars
|
||||||
- const user = page.user;
|
- const user = page.user;
|
||||||
- const title = privateMode ? '非公開インスタンス' : page.title;
|
- const title = privateMode ? instanceName : page.title;
|
||||||
- const url = `${config.url}/@${user.username}/${page.name}`;
|
- const url = `${config.url}/@${user.username}/${page.name}`;
|
||||||
|
|
||||||
block title
|
block title
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
extends ./base
|
extends ./base
|
||||||
|
|
||||||
block vars
|
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)}`;
|
- const url = `${config.url}/@${(user.host ? `${user.username}@${user.host}` : user.username)}`;
|
||||||
|
|
||||||
block title
|
block title
|
||||||
|
|
|
@ -133,6 +133,7 @@ import FormRange from '@/components/form/range.vue';
|
||||||
import FormInput from '@/components/form/input.vue';
|
import FormInput from '@/components/form/input.vue';
|
||||||
import FormTextarea from '@/components/form/textarea.vue';
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
import FormButton from '@/components/MkButton.vue';
|
import FormButton from '@/components/MkButton.vue';
|
||||||
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
import * as os from '@/os';
|
import * as os from '@/os';
|
||||||
import { fetchInstance } from '@/instance';
|
import { fetchInstance } from '@/instance';
|
||||||
import { i18n } from '@/i18n';
|
import { i18n } from '@/i18n';
|
||||||
|
|
Loading…
Reference in a new issue