Merge upstream
This commit is contained in:
commit
3358fb7a9b
97 changed files with 3254 additions and 3066 deletions
|
@ -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();
|
||||
|
|
|
@ -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}`;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue