Merge upstream

This commit is contained in:
ASTRO:? 2024-12-22 12:36:04 +09:00
commit 3358fb7a9b
No known key found for this signature in database
GPG key ID: 8947F3AF5B0B4BFE
97 changed files with 3254 additions and 3066 deletions

View file

@ -99,7 +99,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> {
} else if (ps.reportContentPattern === null) {
properties.reportContentPattern = null;
}
if (ps.forward) properties.forward = ps.forward;
if (ps.forward !== undefined) properties.forward = ps.forward;
if (ps.expiresAt) {
let expirationDate: Date | null = new Date();
const previousMonth = expirationDate.getUTCMonth();

View file

@ -563,7 +563,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const html = await this.httpRequestService.getHtml(url);
const { window } = new JSDOM(html);
const doc = window.document;
const doc = window.document as Document;
const myLink = `${this.config.url}/@${user.username}`;

View file

@ -65,6 +65,7 @@ export const paramDef = {
font: { type: 'string', enum: ['serif', 'sans-serif'], default: 'sans-serif' },
alignCenter: { type: 'boolean', default: false },
hideTitleWhenPinned: { type: 'boolean', default: false },
visibility: { type: 'string', enum: ['public', 'private'] },
},
required: ['title', 'name', 'content', 'variables', 'script'],
} as const;
@ -114,7 +115,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
script: ps.script,
eyeCatchingImageId: eyeCatchingImage ? eyeCatchingImage.id : null,
userId: me.id,
visibility: 'public',
visibility: ps.visibility,
alignCenter: ps.alignCenter,
hideTitleWhenPinned: ps.hideTitleWhenPinned,
font: ps.font,

View file

@ -78,6 +78,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
throw new ApiError(meta.errors.noSuchPage);
}
if (page.visibility === 'private' && (me == null || (page.userId !== me.id))) {
throw new ApiError(meta.errors.noSuchPage);
}
return await this.pageEntityService.pack(page, me);
});
}

View file

@ -70,6 +70,7 @@ export const paramDef = {
font: { type: 'string', enum: ['serif', 'sans-serif'] },
alignCenter: { type: 'boolean' },
hideTitleWhenPinned: { type: 'boolean' },
visibility: { type: 'string', enum: ['public', 'private'] },
},
required: ['pageId', 'title', 'name', 'content', 'variables', 'script'],
} as const;
@ -129,6 +130,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
hideTitleWhenPinned: ps.hideTitleWhenPinned === undefined ? page.hideTitleWhenPinned : ps.hideTitleWhenPinned,
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
font: ps.font === undefined ? page.font : ps.font,
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
visibility: ps.visibility === undefined ? page.visibility : ps.visibility,
eyeCatchingImageId: ps.eyeCatchingImageId === null
? null
: ps.eyeCatchingImageId === undefined