mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-11-22 22:15:12 +00:00
Merge branch 'develop' of https://github.com/syuilo/misskey into develop
This commit is contained in:
commit
7e803ff9a9
7 changed files with 28 additions and 7 deletions
|
@ -143,7 +143,7 @@
|
||||||
"json5": "2.1.0",
|
"json5": "2.1.0",
|
||||||
"json5-loader": "1.0.1",
|
"json5-loader": "1.0.1",
|
||||||
"katex": "0.10.0",
|
"katex": "0.10.0",
|
||||||
"koa": "2.6.1",
|
"koa": "2.6.2",
|
||||||
"koa-bodyparser": "4.2.1",
|
"koa-bodyparser": "4.2.1",
|
||||||
"koa-compress": "3.0.0",
|
"koa-compress": "3.0.0",
|
||||||
"koa-favicon": "2.0.1",
|
"koa-favicon": "2.0.1",
|
||||||
|
@ -237,7 +237,7 @@
|
||||||
"webpack": "4.26.0",
|
"webpack": "4.26.0",
|
||||||
"webpack-cli": "3.1.2",
|
"webpack-cli": "3.1.2",
|
||||||
"websocket": "1.0.28",
|
"websocket": "1.0.28",
|
||||||
"ws": "6.1.0",
|
"ws": "6.1.2",
|
||||||
"xev": "2.0.1"
|
"xev": "2.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,13 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
||||||
// リプライ
|
// リプライ
|
||||||
const reply = note.inReplyTo ? await resolveNote(note.inReplyTo, resolver) : null;
|
const reply = note.inReplyTo ? await resolveNote(note.inReplyTo, resolver) : null;
|
||||||
|
|
||||||
|
// 引用
|
||||||
|
let quote: INote;
|
||||||
|
|
||||||
|
if (note._misskey_quote && typeof note._misskey_quote == 'string') {
|
||||||
|
quote = await resolveNote(note._misskey_quote).catch(() => null);
|
||||||
|
}
|
||||||
|
|
||||||
// テキストのパース
|
// テキストのパース
|
||||||
const text = note._misskey_content ? note._misskey_content : htmlToMFM(note.content);
|
const text = note._misskey_content ? note._misskey_content : htmlToMFM(note.content);
|
||||||
|
|
||||||
|
@ -112,7 +119,7 @@ export async function createNote(value: any, resolver?: Resolver, silent = false
|
||||||
createdAt: new Date(note.published),
|
createdAt: new Date(note.published),
|
||||||
files: files,
|
files: files,
|
||||||
reply,
|
reply,
|
||||||
renote: undefined,
|
renote: quote,
|
||||||
cw: note.summary,
|
cw: note.summary,
|
||||||
text: text,
|
text: text,
|
||||||
viaMobile: false,
|
viaMobile: false,
|
||||||
|
|
|
@ -42,6 +42,18 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
|
||||||
inReplyTo = null;
|
inReplyTo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let quote;
|
||||||
|
|
||||||
|
if (note.renoteId) {
|
||||||
|
const renote = await Note.findOne({
|
||||||
|
_id: note.renoteId,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (renote) {
|
||||||
|
quote = renote.uri ? renote.uri : `${config.url}/notes/${renote._id}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const user = await User.findOne({
|
const user = await User.findOne({
|
||||||
_id: note.userId
|
_id: note.userId
|
||||||
});
|
});
|
||||||
|
@ -112,6 +124,7 @@ export default async function renderNote(note: INote, dive = true): Promise<any>
|
||||||
summary: note.cw,
|
summary: note.cw,
|
||||||
content,
|
content,
|
||||||
_misskey_content: text,
|
_misskey_content: text,
|
||||||
|
_misskey_quote: quote,
|
||||||
published: note.createdAt.toISOString(),
|
published: note.createdAt.toISOString(),
|
||||||
to,
|
to,
|
||||||
cc,
|
cc,
|
||||||
|
|
|
@ -41,6 +41,7 @@ export interface IOrderedCollection extends IObject {
|
||||||
export interface INote extends IObject {
|
export interface INote extends IObject {
|
||||||
type: 'Note';
|
type: 'Note';
|
||||||
_misskey_content: string;
|
_misskey_content: string;
|
||||||
|
_misskey_quote: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IPerson extends IObject {
|
export interface IPerson extends IObject {
|
||||||
|
|
|
@ -76,7 +76,7 @@ router.get('/notes/:note', async (ctx, next) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.body = pack(await renderNote(note, false));
|
ctx.body = pack(await renderNote(note, false));
|
||||||
ctx.set('Cache-Control', 'public, max-age=180');
|
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
|
||||||
setResponseType(ctx);
|
setResponseType(ctx);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -9,8 +9,8 @@ export default function(ctx: Koa.Context, user: ILocalUser, redirect = false) {
|
||||||
path: '/',
|
path: '/',
|
||||||
domain: config.hostname,
|
domain: config.hostname,
|
||||||
// SEE: https://github.com/koajs/koa/issues/974
|
// SEE: https://github.com/koajs/koa/issues/974
|
||||||
//secure: config.url.startsWith('https'),
|
// When using a SSL proxy it should be configured to add the "X-Forwarded-Proto: https" header
|
||||||
secure: false,
|
secure: config.url.startsWith('https'),
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
expires: new Date(Date.now() + expires),
|
expires: new Date(Date.now() + expires),
|
||||||
maxAge: expires
|
maxAge: expires
|
||||||
|
|
|
@ -111,7 +111,7 @@ router.get('/notes/:note', async ctx => {
|
||||||
note: _note,
|
note: _note,
|
||||||
summary: getNoteSummary(_note)
|
summary: getNoteSummary(_note)
|
||||||
});
|
});
|
||||||
ctx.set('Cache-Control', 'public, max-age=180');
|
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
|
||||||
} else {
|
} else {
|
||||||
ctx.status = 404;
|
ctx.status = 404;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue