mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 04:03:49 +01:00
feat: ✨ Page drafts
This commit is contained in:
parent
445def68e3
commit
331b8664f8
@ -85,6 +85,7 @@
|
||||
- Link hover effect
|
||||
- Replace all `$ts` with i18n
|
||||
- AVIF support
|
||||
- Page drafts
|
||||
- Obliteration of Ai-chan
|
||||
- [Make showing ads optional](https://github.com/misskey-dev/misskey/pull/8996)
|
||||
- [Tapping avatar in mobile opens account modal](https://github.com/misskey-dev/misskey/pull/9056)
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "calckey",
|
||||
"version": "12.119.0-calc.15-beta.8",
|
||||
"version": "12.119.0-calc.15-beta.9",
|
||||
"codename": "aqua",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -40,6 +40,9 @@ export class Page {
|
||||
@Column('boolean')
|
||||
public alignCenter: boolean;
|
||||
|
||||
@Column('boolean')
|
||||
public isPublic: boolean;
|
||||
|
||||
@Column('boolean', {
|
||||
default: false,
|
||||
})
|
||||
|
@ -65,6 +65,7 @@ export const PageRepository = db.getRepository(Page).extend({
|
||||
content: page.content,
|
||||
variables: page.variables,
|
||||
title: page.title,
|
||||
isPublic: page.isPublic,
|
||||
name: page.name,
|
||||
summary: page.summary,
|
||||
hideTitleWhenPinned: page.hideTitleWhenPinned,
|
||||
|
@ -47,5 +47,9 @@ export const packedPageSchema = {
|
||||
ref: 'UserLite',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
isPublic: {
|
||||
type: 'boolean',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
@ -53,6 +53,7 @@ export const paramDef = {
|
||||
eyeCatchingImageId: { type: 'string', format: 'misskey:id', nullable: true },
|
||||
font: { type: 'string', enum: ['serif', 'sans-serif'], default: 'sans-serif' },
|
||||
alignCenter: { type: 'boolean', default: false },
|
||||
isPublic: { type: 'boolean', default: true },
|
||||
hideTitleWhenPinned: { type: 'boolean', default: false },
|
||||
},
|
||||
required: ['title', 'name', 'content', 'variables', 'script'],
|
||||
@ -97,6 +98,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
alignCenter: ps.alignCenter,
|
||||
hideTitleWhenPinned: ps.hideTitleWhenPinned,
|
||||
font: ps.font,
|
||||
isPublic: ps.isPublic,
|
||||
})).then(x => Pages.findOneByOrFail(x.identifiers[0]));
|
||||
|
||||
return await Pages.pack(page);
|
||||
|
@ -67,5 +67,9 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
throw new ApiError(meta.errors.noSuchPage);
|
||||
}
|
||||
|
||||
if (!page.isPublic && (user == null || (page.userId !== user.id))) {
|
||||
throw new ApiError(meta.errors.noSuchPage);
|
||||
}
|
||||
|
||||
return await Pages.pack(page, user);
|
||||
});
|
||||
|
@ -60,6 +60,7 @@ export const paramDef = {
|
||||
font: { type: 'string', enum: ['serif', 'sans-serif'] },
|
||||
alignCenter: { type: 'boolean' },
|
||||
hideTitleWhenPinned: { type: 'boolean' },
|
||||
isPublic: { type: 'boolean' },
|
||||
},
|
||||
required: ['pageId', 'title', 'name', 'content', 'variables', 'script'],
|
||||
} as const;
|
||||
@ -104,6 +105,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
||||
content: ps.content,
|
||||
variables: ps.variables,
|
||||
script: ps.script,
|
||||
isPublic: ps.isPublic,
|
||||
alignCenter: ps.alignCenter === undefined ? page.alignCenter : ps.alignCenter,
|
||||
hideTitleWhenPinned: ps.hideTitleWhenPinned === undefined ? page.hideTitleWhenPinned : ps.hideTitleWhenPinned,
|
||||
font: ps.font === undefined ? page.font : ps.font,
|
||||
|
@ -34,7 +34,8 @@ export const paramDef = {
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId)
|
||||
.andWhere('page.userId = :userId', { userId: ps.userId })
|
||||
.andWhere('page.visibility = \'public\'');
|
||||
.andWhere('page.visibility = \'public\'')
|
||||
.andWhere('page.isPublic = true');
|
||||
|
||||
const pages = await query
|
||||
.take(ps.limit)
|
||||
|
@ -48,7 +48,7 @@ watch(() => props.clipId, async () => {
|
||||
});
|
||||
}, {
|
||||
immediate: true,
|
||||
});
|
||||
});
|
||||
|
||||
provide('currentClipPage', $$(clip));
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
<template #label>{{ i18n.ts._pages.url }}</template>
|
||||
</MkInput>
|
||||
|
||||
<MkSwitch v-model="isPublic" class="_formBlock">{{ i18n.ts._pages.isPublic }}</MkSwitch>
|
||||
<MkSwitch v-model="alignCenter" class="_formBlock">{{ i18n.ts._pages.alignCenter }}</MkSwitch>
|
||||
|
||||
<MkSelect v-model="font" class="_formBlock">
|
||||
@ -130,6 +131,7 @@ let eyeCatchingImageId = $ref(null);
|
||||
let font = $ref('sans-serif');
|
||||
let content = $ref([]);
|
||||
let alignCenter = $ref(false);
|
||||
let isPublic = $ref(true);
|
||||
let hideTitleWhenPinned = $ref(false);
|
||||
let variables = $ref([]);
|
||||
let hpml = $ref(null);
|
||||
@ -158,6 +160,7 @@ function getSaveOptions() {
|
||||
script: script,
|
||||
hideTitleWhenPinned: hideTitleWhenPinned,
|
||||
alignCenter: alignCenter,
|
||||
isPublic: isPublic,
|
||||
content: content,
|
||||
variables: variables,
|
||||
eyeCatchingImageId: eyeCatchingImageId,
|
||||
@ -393,6 +396,7 @@ async function init() {
|
||||
script = page.script;
|
||||
hideTitleWhenPinned = page.hideTitleWhenPinned;
|
||||
alignCenter = page.alignCenter;
|
||||
isPublic = page.isPublic;
|
||||
content = page.content;
|
||||
variables = page.variables;
|
||||
eyeCatchingImageId = page.eyeCatchingImageId;
|
||||
@ -401,7 +405,7 @@ async function init() {
|
||||
content = [{
|
||||
id,
|
||||
type: 'text',
|
||||
text: 'Hello World!',
|
||||
text: '',
|
||||
}];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user