1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-10-30 06:41:46 +09:00

feat: 사용자 정의 스플래시 텍스트를 설정할 수 있음 (1673beta/cherrypick#153)

This commit is contained in:
NoriDev 2024-10-03 10:58:14 +09:00
parent 7702ff29c1
commit aa5685e3c7
15 changed files with 80 additions and 2 deletions

View File

@ -48,6 +48,7 @@ Misskey의 전체 변경 사항을 확인하려면, [CHANGELOG.md#2024xx](CHANGE
- Feat: 캡션 미설정 안내 표시 (1673beta/cherrypick#142) - Feat: 캡션 미설정 안내 표시 (1673beta/cherrypick#142)
- 노트를 게시하기 전에 첨부한 파일에 캡션이 없으면 경고를 표시합니다. - 노트를 게시하기 전에 첨부한 파일에 캡션이 없으면 경고를 표시합니다.
- 이 변경으로 이미지 뷰어의 파일 이름 영역에는 더 이상 캡션이 아닌 실제 파일 이름이 표시됩니다. - 이 변경으로 이미지 뷰어의 파일 이름 영역에는 더 이상 캡션이 아닌 실제 파일 이름이 표시됩니다.
- Feat: 사용자 정의 스플래시 텍스트를 설정할 수 있음 (1673beta/cherrypick#153)
### Client ### Client
- Enhance: CherryPick 업데이트 페이지를 제어판 목록에 추가함 - Enhance: CherryPick 업데이트 페이지를 제어판 목록에 추가함

View File

@ -1,5 +1,7 @@
--- ---
_lang_: "English" _lang_: "English"
customSplashText: "Custom splash text"
customSplashTextDescription: "This text will be displayed on the loading page."
showNoAltWarning: "Show caption unset warning" showNoAltWarning: "Show caption unset warning"
showNoAltWarningDescription: "Display a warning when no alternate text is set in the image" showNoAltWarningDescription: "Display a warning when no alternate text is set in the image"
filesGridLayoutInUserPage: "Change the media tab to grid layout" filesGridLayoutInUserPage: "Change the media tab to grid layout"

8
locales/index.d.ts vendored
View File

@ -13,6 +13,14 @@ export interface Locale extends ILocale {
* *
*/ */
"_lang_": string; "_lang_": string;
/**
*
*/
"customSplashText": string;
/**
*
*/
"customSplashTextDescription": string;
/** /**
* *
*/ */

View File

@ -1,5 +1,7 @@
_lang_: "日本語" _lang_: "日本語"
customSplashText: "カスタムスプラッシュテキスト"
customSplashTextDescription: "ロード画面に表示されるテキストを設定します。改行で区切って複数設定できます。"
showNoAltWarning: "キャプション未設定案内を表示" showNoAltWarning: "キャプション未設定案内を表示"
showNoAltWarningDescription: "画像に代替テキストが設定されていない場合に警告を表示する" showNoAltWarningDescription: "画像に代替テキストが設定されていない場合に警告を表示する"
filesGridLayoutInUserPage: "メディアタブをグリッドレイアウトに変更" filesGridLayoutInUserPage: "メディアタブをグリッドレイアウトに変更"

View File

@ -1,5 +1,7 @@
--- ---
_lang_: "한국어" _lang_: "한국어"
customSplashText: "사용자 정의 스플래시 텍스트"
customSplashTextDescription: "스플래시 화면에 표시되는 텍스트를 설정해요. 줄바꿈으로 구분해 설정할 수 있어요."
showNoAltWarning: "캡션 미설정 안내 표시" showNoAltWarning: "캡션 미설정 안내 표시"
showNoAltWarningDescription: "이미지에 캡션이 설정되어 있지 않으면 경고를 표시해요" showNoAltWarningDescription: "이미지에 캡션이 설정되어 있지 않으면 경고를 표시해요"
filesGridLayoutInUserPage: "미디어 탭을 그리드 레이아웃으로 변경" filesGridLayoutInUserPage: "미디어 탭을 그리드 레이아웃으로 변경"

View File

@ -0,0 +1,11 @@
export class AddCustomSplash1723982389378 {
name = 'AddCustomSplash1723982389378'
async up(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" ADD "customSplashText" character varying(1024) array NOT NULL DEFAULT '{}'`);
}
async down(queryRunner) {
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "customSplashText"`);
}
}

View File

@ -785,4 +785,11 @@ export class MiMeta {
nullable: true, nullable: true,
}) })
public skipCherryPickVersion: string | null; public skipCherryPickVersion: string | null;
@Column('varchar', {
length: 1024,
array: true,
default: '{}',
})
public customSplashText: string[];
} }

View File

@ -591,6 +591,13 @@ export const meta = {
optional: false, nullable: false, optional: false, nullable: false,
}, },
}, },
customSplashText: {
type: 'array',
optional: false, nullable: false,
items: {
type: 'string',
},
},
}, },
}, },
} as const; } as const;
@ -757,6 +764,7 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
skipVersion: instance.skipVersion, skipVersion: instance.skipVersion,
skipCherryPickVersion: instance.skipCherryPickVersion, skipCherryPickVersion: instance.skipCherryPickVersion,
trustedLinkUrlPatterns: instance.trustedLinkUrlPatterns, trustedLinkUrlPatterns: instance.trustedLinkUrlPatterns,
customSplashText: instance.customSplashText,
}; };
}); });
} }

View File

@ -209,6 +209,11 @@ export const paramDef = {
type: 'string', type: 'string',
}, },
}, },
customSplashText: {
type: 'array', nullable: true, items: {
type: 'string',
},
},
}, },
required: [], required: [],
} as const; } as const;
@ -791,6 +796,10 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
set.trustedLinkUrlPatterns = ps.trustedLinkUrlPatterns.filter(Boolean); set.trustedLinkUrlPatterns = ps.trustedLinkUrlPatterns.filter(Boolean);
} }
if (Array.isArray(ps.customSplashText)) {
set.customSplashText = ps.customSplashText.filter(Boolean);
}
const before = await this.metaService.fetch(true); const before = await this.metaService.fetch(true);
await this.metaService.update(set); await this.metaService.update(set);

View File

@ -197,6 +197,7 @@ export class ClientServerService {
instanceUrl: this.config.url, instanceUrl: this.config.url,
metaJson: htmlSafeJsonStringify(await this.metaEntityService.packDetailed(meta)), metaJson: htmlSafeJsonStringify(await this.metaEntityService.packDetailed(meta)),
now: Date.now(), now: Date.now(),
customSplashText: meta.customSplashText[Math.floor(Math.random() * meta.customSplashText.length)],
}; };
} }

View File

@ -10,7 +10,7 @@ html {
} }
#splash { #splash {
position: fixed; position: relative;
z-index: 10000; z-index: 10000;
top: 0; top: 0;
left: 0; left: 0;
@ -35,6 +35,17 @@ html {
border-radius: 22px; border-radius: 22px;
} }
#splashText {
position: absolute;
inset: 0;
margin: auto;
display: inline-block;
inline-size: 70%;
block-size: 0;
text-align: center;
padding-block-start: 200px;
}
#splashSpinner { #splashSpinner {
position: absolute; position: absolute;
top: 0; top: 0;
@ -45,7 +56,7 @@ html {
display: inline-block; display: inline-block;
width: 28px; width: 28px;
height: 28px; height: 28px;
transform: translateY(70px); transform: translateY(80px);
color: var(--accent); color: var(--accent);
} }

View File

@ -60,6 +60,9 @@ html(class='embed')
| JavaScript를 활성화해주세요 | JavaScript를 활성화해주세요
div#splash div#splash
img#splashIcon(src= icon || '/static-assets/splash.png') img#splashIcon(src= icon || '/static-assets/splash.png')
span#splashText
block customSplashText
= customSplashText
div#splashSpinner div#splashSpinner
<svg class="spinner" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"> <svg class="spinner" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
<circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="6px" style="fill: none; stroke: currentColor; stroke-width: 6px;"></circle> <circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="6px" style="fill: none; stroke: currentColor; stroke-width: 6px;"></circle>

View File

@ -85,6 +85,9 @@ html
| JavaScript를 활성화해주세요 | JavaScript를 활성화해주세요
div#splash div#splash
img#splashIcon(src= icon || '/static-assets/splash.png') img#splashIcon(src= icon || '/static-assets/splash.png')
span#splashText
block customSplashText
= customSplashText
div#splashSpinner div#splashSpinner
<svg class="spinner" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg"> <svg class="spinner" viewBox="0 0 50 50" xmlns="http://www.w3.org/2000/svg">
<circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="6px" style="fill: none; stroke: currentColor; stroke-width: 6px;"></circle> <circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="6px" style="fill: none; stroke: currentColor; stroke-width: 6px;"></circle>

View File

@ -5552,6 +5552,7 @@ export type operations = {
skipVersion: boolean; skipVersion: boolean;
skipCherryPickVersion?: string | null; skipCherryPickVersion?: string | null;
trustedLinkUrlPatterns: string[]; trustedLinkUrlPatterns: string[];
customSplashText: string[];
}; };
}; };
}; };
@ -10249,6 +10250,7 @@ export type operations = {
skipVersion?: boolean; skipVersion?: boolean;
skipCherryPickVersion?: string | null; skipCherryPickVersion?: string | null;
trustedLinkUrlPatterns?: string[] | null; trustedLinkUrlPatterns?: string[] | null;
customSplashText?: string[] | null;
}; };
}; };
}; };

View File

@ -89,6 +89,11 @@ SPDX-License-Identifier: AGPL-3.0-only
<MkTextarea v-model="manifestJsonOverride"> <MkTextarea v-model="manifestJsonOverride">
<template #label>{{ i18n.ts._serverSettings.manifestJsonOverride }}</template> <template #label>{{ i18n.ts._serverSettings.manifestJsonOverride }}</template>
</MkTextarea> </MkTextarea>
<MkTextarea v-model="customSplashText">
<template #label>{{ i18n.ts.customSplashText }}</template>
<template #caption>{{ i18n.ts.customSplashTextDescription }}</template>
</MkTextarea>
</div> </div>
</FormSuspense> </FormSuspense>
</MkSpacer> </MkSpacer>
@ -133,6 +138,7 @@ const notFoundImageUrl = ref<string | null>(null);
const repositoryUrl = ref<string | null>(null); const repositoryUrl = ref<string | null>(null);
const feedbackUrl = ref<string | null>(null); const feedbackUrl = ref<string | null>(null);
const manifestJsonOverride = ref<string>('{}'); const manifestJsonOverride = ref<string>('{}');
const customSplashText = ref<string>('');
async function init() { async function init() {
const meta = await misskeyApi('admin/meta'); const meta = await misskeyApi('admin/meta');
@ -150,6 +156,7 @@ async function init() {
repositoryUrl.value = meta.repositoryUrl; repositoryUrl.value = meta.repositoryUrl;
feedbackUrl.value = meta.feedbackUrl; feedbackUrl.value = meta.feedbackUrl;
manifestJsonOverride.value = meta.manifestJsonOverride === '' ? '{}' : JSON.stringify(JSON.parse(meta.manifestJsonOverride), null, '\t'); manifestJsonOverride.value = meta.manifestJsonOverride === '' ? '{}' : JSON.stringify(JSON.parse(meta.manifestJsonOverride), null, '\t');
customSplashText.value = meta.customSplashText.join('\n');
} }
function save() { function save() {
@ -168,6 +175,7 @@ function save() {
repositoryUrl: repositoryUrl.value === '' ? null : repositoryUrl.value, repositoryUrl: repositoryUrl.value === '' ? null : repositoryUrl.value,
feedbackUrl: feedbackUrl.value === '' ? null : feedbackUrl.value, feedbackUrl: feedbackUrl.value === '' ? null : feedbackUrl.value,
manifestJsonOverride: manifestJsonOverride.value === '' ? '{}' : JSON.stringify(JSON5.parse(manifestJsonOverride.value)), manifestJsonOverride: manifestJsonOverride.value === '' ? '{}' : JSON.stringify(JSON5.parse(manifestJsonOverride.value)),
customSplashText: customSplashText.value.split('\n'),
}).then(() => { }).then(() => {
fetchInstance(true); fetchInstance(true);
}); });