Merge branch 'develop'
This commit is contained in:
commit
b796aacf7f
21 changed files with 358 additions and 29 deletions
10
CHANGELOG.md
10
CHANGELOG.md
|
@ -9,6 +9,16 @@
|
||||||
You should also include the user name that made the change.
|
You should also include the user name that made the change.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
|
## 12.116.0 (2022/07/16)
|
||||||
|
|
||||||
|
### Improvements
|
||||||
|
- Client: registry editor @syuilo
|
||||||
|
- Client: UIのブラッシュアップ @syuilo
|
||||||
|
|
||||||
|
### Bugfixes
|
||||||
|
- Error During Migration Run to 12.111.x
|
||||||
|
- Server: TypeError: Cannot convert undefined or null to object @syuilo
|
||||||
|
|
||||||
## 12.115.0 (2022/07/16)
|
## 12.115.0 (2022/07/16)
|
||||||
|
|
||||||
### Improvements
|
### Improvements
|
||||||
|
|
|
@ -1703,6 +1703,8 @@ _deck:
|
||||||
stackLeft: "Auf linke Spalte stapeln"
|
stackLeft: "Auf linke Spalte stapeln"
|
||||||
popRight: "Nach rechts vom Stapel nehmen"
|
popRight: "Nach rechts vom Stapel nehmen"
|
||||||
profile: "Profil"
|
profile: "Profil"
|
||||||
|
newProfile: "Neues Profil"
|
||||||
|
deleteProfile: "Profil löschen"
|
||||||
introduction: "Erstelle eine auf dich zugeschneiderte Benutzeroberfläche durch das Aneinanderreihen von Spalten!"
|
introduction: "Erstelle eine auf dich zugeschneiderte Benutzeroberfläche durch das Aneinanderreihen von Spalten!"
|
||||||
introduction2: "Klicke auf das + rechts um wann immer du möchtest neue Spalten hinzuzufügen."
|
introduction2: "Klicke auf das + rechts um wann immer du möchtest neue Spalten hinzuzufügen."
|
||||||
widgetsIntroduction: "Drücke bitte \"Widgets bearbeiten\" im Spaltenmenü und füge ein Widget hinzu."
|
widgetsIntroduction: "Drücke bitte \"Widgets bearbeiten\" im Spaltenmenü und füge ein Widget hinzu."
|
||||||
|
|
|
@ -1703,6 +1703,8 @@ _deck:
|
||||||
stackLeft: "Stack with the left column"
|
stackLeft: "Stack with the left column"
|
||||||
popRight: "Pop column to the right"
|
popRight: "Pop column to the right"
|
||||||
profile: "Profile"
|
profile: "Profile"
|
||||||
|
newProfile: "New profile"
|
||||||
|
deleteProfile: "Delete profile"
|
||||||
introduction: "Create the perfect interface for you by arranging columns freely!"
|
introduction: "Create the perfect interface for you by arranging columns freely!"
|
||||||
introduction2: "Click on the + on the right of the screen to add new colums whenever you want."
|
introduction2: "Click on the + on the right of the screen to add new colums whenever you want."
|
||||||
widgetsIntroduction: "Please select \"Edit widgets\" in the column menu and add a widget."
|
widgetsIntroduction: "Please select \"Edit widgets\" in the column menu and add a widget."
|
||||||
|
|
|
@ -842,6 +842,9 @@ reverse: "Переворот"
|
||||||
colored: "Выделена цветом"
|
colored: "Выделена цветом"
|
||||||
label: "Метка"
|
label: "Метка"
|
||||||
localOnly: "Локально"
|
localOnly: "Локально"
|
||||||
|
beta: "Бета"
|
||||||
|
enableAutoSensitive: "Автоматическое определение NSFW"
|
||||||
|
enableAutoSensitiveDescription: "Если доступно, используйте машинное обучение для автоматической установки флага NSFW на носителе. Даже если эта функция отключена, она может быть установлена автоматически в зависимости от инстанта."
|
||||||
account: "Учётные записи"
|
account: "Учётные записи"
|
||||||
_sensitiveMediaDetection:
|
_sensitiveMediaDetection:
|
||||||
description: "Машинное обучение может быть использовано для автоматического обнаружения чувствительных медиа для модерации. Нагрузка на сервер увеличивается незначительно."
|
description: "Машинное обучение может быть использовано для автоматического обнаружения чувствительных медиа для модерации. Нагрузка на сервер увеличивается незначительно."
|
||||||
|
|
|
@ -1698,6 +1698,8 @@ _deck:
|
||||||
stackLeft: "Priložiť do ľavého stĺpca"
|
stackLeft: "Priložiť do ľavého stĺpca"
|
||||||
popRight: "Vybrať napravo"
|
popRight: "Vybrať napravo"
|
||||||
profile: "Profil"
|
profile: "Profil"
|
||||||
|
newProfile: "Nový profil"
|
||||||
|
deleteProfile: "Odstrániť profil"
|
||||||
introduction: "Kombinujte stĺpce a vytvorte si svoje vlastné rozhranie!"
|
introduction: "Kombinujte stĺpce a vytvorte si svoje vlastné rozhranie!"
|
||||||
introduction2: "Stlačením tlačidla + v pravej časti obrazovky môžete kedykoľvek pridať stĺpce."
|
introduction2: "Stlačením tlačidla + v pravej časti obrazovky môžete kedykoľvek pridať stĺpce."
|
||||||
widgetsIntroduction: "V ponuke stĺpca vyberte možnosť \"Upraviť widget\" a pridajte widget"
|
widgetsIntroduction: "V ponuke stĺpca vyberte možnosť \"Upraviť widget\" a pridajte widget"
|
||||||
|
|
|
@ -1703,6 +1703,8 @@ _deck:
|
||||||
stackLeft: "Xếp chồng với cột bên trái"
|
stackLeft: "Xếp chồng với cột bên trái"
|
||||||
popRight: "Xếp chồng với cột bên trái"
|
popRight: "Xếp chồng với cột bên trái"
|
||||||
profile: "Hồ sơ"
|
profile: "Hồ sơ"
|
||||||
|
newProfile: "Hồ sơ mới"
|
||||||
|
deleteProfile: "Xóa hồ sơ"
|
||||||
introduction: "Kết hợp các cột để tạo giao diện của riêng bạn!"
|
introduction: "Kết hợp các cột để tạo giao diện của riêng bạn!"
|
||||||
introduction2: "Bạn có thể thêm cột bất kỳ lúc nào bằng cách nhấn + ở bên phải màn hình."
|
introduction2: "Bạn có thể thêm cột bất kỳ lúc nào bằng cách nhấn + ở bên phải màn hình."
|
||||||
widgetsIntroduction: "Chọn \"Sửa widget\" trong menu cột và thêm một widget."
|
widgetsIntroduction: "Chọn \"Sửa widget\" trong menu cột và thêm một widget."
|
||||||
|
|
|
@ -1702,6 +1702,8 @@ _deck:
|
||||||
stackLeft: "向左折疊"
|
stackLeft: "向左折疊"
|
||||||
popRight: "向右彈出"
|
popRight: "向右彈出"
|
||||||
profile: "個人檔案"
|
profile: "個人檔案"
|
||||||
|
newProfile: "新建個人檔案"
|
||||||
|
deleteProfile: "刪除個人檔案"
|
||||||
introduction: "組合欄位來製作屬於自己的介面吧!"
|
introduction: "組合欄位來製作屬於自己的介面吧!"
|
||||||
introduction2: "您可以隨時透過按畫面右方的 + 來添加欄位。"
|
introduction2: "您可以隨時透過按畫面右方的 + 來添加欄位。"
|
||||||
widgetsIntroduction: "請從欄位的選單中,選擇「編輯小工具」來添加小工具"
|
widgetsIntroduction: "請從欄位的選單中,選擇「編輯小工具」來添加小工具"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"version": "12.115.0",
|
"version": "12.116.0",
|
||||||
"codename": "indigo",
|
"codename": "indigo",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -28,7 +28,7 @@ export class foreignKeyReports1651224615271 {
|
||||||
|
|
||||||
queryRunner.query(`CREATE INDEX "IDX_315c779174fe8247ab324f036e" ON "drive_file" ("isLink")`),
|
queryRunner.query(`CREATE INDEX "IDX_315c779174fe8247ab324f036e" ON "drive_file" ("isLink")`),
|
||||||
queryRunner.query(`CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId")`),
|
queryRunner.query(`CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId")`),
|
||||||
queryRunner.query(`CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")`),
|
//queryRunner.query(`CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")`),
|
||||||
|
|
||||||
queryRunner.query(`DELETE FROM "abuse_user_report" WHERE "targetUserId" NOT IN (SELECT "id" FROM "user")`).then(() => {
|
queryRunner.query(`DELETE FROM "abuse_user_report" WHERE "targetUserId" NOT IN (SELECT "id" FROM "user")`).then(() => {
|
||||||
queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
|
||||||
|
|
|
@ -16,6 +16,7 @@ export default class extends Channel {
|
||||||
constructor(id: string, connection: Channel['connection']) {
|
constructor(id: string, connection: Channel['connection']) {
|
||||||
super(id, connection);
|
super(id, connection);
|
||||||
this.onNote = this.onNote.bind(this);
|
this.onNote = this.onNote.bind(this);
|
||||||
|
this.emitTypers = this.emitTypers.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async init(params: any) {
|
public async init(params: any) {
|
||||||
|
|
|
@ -77,9 +77,9 @@ const inputEl = ref<HTMLElement>();
|
||||||
const prefixEl = ref<HTMLElement>();
|
const prefixEl = ref<HTMLElement>();
|
||||||
const suffixEl = ref<HTMLElement>();
|
const suffixEl = ref<HTMLElement>();
|
||||||
const height =
|
const height =
|
||||||
props.small ? 38 :
|
props.small ? 36 :
|
||||||
props.large ? 42 :
|
props.large ? 40 :
|
||||||
40;
|
38;
|
||||||
|
|
||||||
const focus = () => inputEl.value.focus();
|
const focus = () => inputEl.value.focus();
|
||||||
const onInput = (ev: KeyboardEvent) => {
|
const onInput = (ev: KeyboardEvent) => {
|
||||||
|
|
|
@ -63,9 +63,9 @@ const prefixEl = ref(null);
|
||||||
const suffixEl = ref(null);
|
const suffixEl = ref(null);
|
||||||
const container = ref(null);
|
const container = ref(null);
|
||||||
const height =
|
const height =
|
||||||
props.small ? 38 :
|
props.small ? 36 :
|
||||||
props.large ? 42 :
|
props.large ? 40 :
|
||||||
40;
|
38;
|
||||||
|
|
||||||
const focus = () => inputEl.value.focus();
|
const focus = () => inputEl.value.focus();
|
||||||
const onInput = (ev) => {
|
const onInput = (ev) => {
|
||||||
|
|
|
@ -390,7 +390,7 @@ if (appearNote.replyId) {
|
||||||
|
|
||||||
> .article {
|
> .article {
|
||||||
padding: 32px;
|
padding: 32px;
|
||||||
font-size: 1.1em;
|
font-size: 1.2em;
|
||||||
|
|
||||||
> .header {
|
> .header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<template>
|
<template>
|
||||||
<button v-if="!link" class="bghgjjyj _button"
|
<button
|
||||||
|
v-if="!link" class="bghgjjyj _button"
|
||||||
:class="{ inline, primary, gradate, danger, rounded, full }"
|
:class="{ inline, primary, gradate, danger, rounded, full }"
|
||||||
:type="type"
|
:type="type"
|
||||||
@click="$emit('click', $event)"
|
@click="$emit('click', $event)"
|
||||||
|
@ -10,7 +11,8 @@
|
||||||
<slot></slot>
|
<slot></slot>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<MkA v-else class="bghgjjyj _button"
|
<MkA
|
||||||
|
v-else class="bghgjjyj _button"
|
||||||
:class="{ inline, primary, gradate, danger, rounded, full }"
|
:class="{ inline, primary, gradate, danger, rounded, full }"
|
||||||
:to="to"
|
:to="to"
|
||||||
@mousedown="onMousedown"
|
@mousedown="onMousedown"
|
||||||
|
@ -29,56 +31,56 @@ export default defineComponent({
|
||||||
props: {
|
props: {
|
||||||
type: {
|
type: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false
|
required: false,
|
||||||
},
|
},
|
||||||
primary: {
|
primary: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
gradate: {
|
gradate: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
rounded: {
|
rounded: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
inline: {
|
inline: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
link: {
|
link: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
to: {
|
to: {
|
||||||
type: String,
|
type: String,
|
||||||
required: false
|
required: false,
|
||||||
},
|
},
|
||||||
autofocus: {
|
autofocus: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
wait: {
|
wait: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
danger: {
|
danger: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
full: {
|
full: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
required: false,
|
required: false,
|
||||||
default: false
|
default: false,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
emits: ['click'],
|
emits: ['click'],
|
||||||
|
@ -127,8 +129,8 @@ export default defineComponent({
|
||||||
window.setTimeout(() => {
|
window.setTimeout(() => {
|
||||||
if (this.$refs.ripples) this.$refs.ripples.removeChild(ripple);
|
if (this.$refs.ripples) this.$refs.ripples.removeChild(ripple);
|
||||||
}, 2000);
|
}, 2000);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -142,8 +144,7 @@ export default defineComponent({
|
||||||
padding: 8px 14px;
|
padding: 8px 14px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
font-size: 0.9em;
|
font-size: 1em;
|
||||||
line-height: 22px;
|
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
background: var(--buttonBg);
|
background: var(--buttonBg);
|
||||||
|
|
96
packages/client/src/pages/registry.keys.vue
Normal file
96
packages/client/src/pages/registry.keys.vue
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
<template>
|
||||||
|
<MkStickyContainer>
|
||||||
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
|
<MkSpacer :content-max="600">
|
||||||
|
<FormSplit>
|
||||||
|
<MkKeyValue class="_formBlock">
|
||||||
|
<template #key>{{ $ts._registry.domain }}</template>
|
||||||
|
<template #value>{{ $ts.system }}</template>
|
||||||
|
</MkKeyValue>
|
||||||
|
<MkKeyValue class="_formBlock">
|
||||||
|
<template #key>{{ $ts._registry.scope }}</template>
|
||||||
|
<template #value>{{ scope.join('/') }}</template>
|
||||||
|
</MkKeyValue>
|
||||||
|
</FormSplit>
|
||||||
|
|
||||||
|
<MkButton primary @click="createKey">{{ i18n.ts._registry.createKey }}</MkButton>
|
||||||
|
|
||||||
|
<FormSection v-if="keys">
|
||||||
|
<template #label>{{ i18n.ts.keys }}</template>
|
||||||
|
<div class="_formLinks">
|
||||||
|
<FormLink v-for="key in keys" :to="`/registry/value/system/${scope.join('/')}/${key[0]}`" class="_monospace">{{ key[0] }}<template #suffix>{{ key[1].toUpperCase() }}</template></FormLink>
|
||||||
|
</div>
|
||||||
|
</FormSection>
|
||||||
|
</MkSpacer>
|
||||||
|
</MkStickyContainer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import JSON5 from 'json5';
|
||||||
|
import * as os from '@/os';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
import FormLink from '@/components/form/link.vue';
|
||||||
|
import FormSection from '@/components/form/section.vue';
|
||||||
|
import MkButton from '@/components/ui/button.vue';
|
||||||
|
import MkKeyValue from '@/components/key-value.vue';
|
||||||
|
import FormSplit from '@/components/form/split.vue';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
path: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const scope = $computed(() => props.path.split('/'));
|
||||||
|
|
||||||
|
let keys = $ref(null);
|
||||||
|
|
||||||
|
function fetchKeys() {
|
||||||
|
os.api('i/registry/keys-with-type', {
|
||||||
|
scope: scope,
|
||||||
|
}).then(res => {
|
||||||
|
keys = Object.entries(res).sort((a, b) => a[0].localeCompare(b[0]));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createKey() {
|
||||||
|
const { canceled, result } = await os.form(i18n.ts._registry.createKey, {
|
||||||
|
key: {
|
||||||
|
type: 'string',
|
||||||
|
label: i18n.ts._registry.key,
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: 'string',
|
||||||
|
multiline: true,
|
||||||
|
label: i18n.ts.value,
|
||||||
|
},
|
||||||
|
scope: {
|
||||||
|
type: 'string',
|
||||||
|
label: i18n.ts._registry.scope,
|
||||||
|
default: scope.join('/'),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (canceled) return;
|
||||||
|
os.apiWithDialog('i/registry/set', {
|
||||||
|
scope: result.scope.split('/'),
|
||||||
|
key: result.key,
|
||||||
|
value: JSON5.parse(result.value),
|
||||||
|
}).then(() => {
|
||||||
|
fetchKeys();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => props.path, fetchKeys, { immediate: true });
|
||||||
|
|
||||||
|
const headerActions = $computed(() => []);
|
||||||
|
|
||||||
|
const headerTabs = $computed(() => []);
|
||||||
|
|
||||||
|
definePageMetadata({
|
||||||
|
title: i18n.ts.registry,
|
||||||
|
icon: 'fas fa-cogs',
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
123
packages/client/src/pages/registry.value.vue
Normal file
123
packages/client/src/pages/registry.value.vue
Normal file
|
@ -0,0 +1,123 @@
|
||||||
|
<template>
|
||||||
|
<MkStickyContainer>
|
||||||
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
|
<MkSpacer :content-max="600">
|
||||||
|
<FormInfo warn>{{ $ts.editTheseSettingsMayBreakAccount }}</FormInfo>
|
||||||
|
|
||||||
|
<template v-if="value">
|
||||||
|
<FormSplit>
|
||||||
|
<MkKeyValue class="_formBlock">
|
||||||
|
<template #key>{{ $ts._registry.domain }}</template>
|
||||||
|
<template #value>{{ $ts.system }}</template>
|
||||||
|
</MkKeyValue>
|
||||||
|
<MkKeyValue class="_formBlock">
|
||||||
|
<template #key>{{ $ts._registry.scope }}</template>
|
||||||
|
<template #value>{{ scope.join('/') }}</template>
|
||||||
|
</MkKeyValue>
|
||||||
|
<MkKeyValue class="_formBlock">
|
||||||
|
<template #key>{{ $ts._registry.key }}</template>
|
||||||
|
<template #value>{{ key }}</template>
|
||||||
|
</MkKeyValue>
|
||||||
|
</FormSplit>
|
||||||
|
|
||||||
|
<FormTextarea v-model="valueForEditor" tall class="_formBlock _monospace">
|
||||||
|
<template #label>{{ $ts.value }} (JSON)</template>
|
||||||
|
</FormTextarea>
|
||||||
|
|
||||||
|
<MkButton class="_formBlock" primary @click="save"><i class="fas fa-save"></i> {{ $ts.save }}</MkButton>
|
||||||
|
|
||||||
|
<MkKeyValue class="_formBlock">
|
||||||
|
<template #key>{{ $ts.updatedAt }}</template>
|
||||||
|
<template #value><MkTime :time="value.updatedAt" mode="detail"/></template>
|
||||||
|
</MkKeyValue>
|
||||||
|
|
||||||
|
<MkButton danger @click="del"><i class="fas fa-trash"></i> {{ $ts.delete }}</MkButton>
|
||||||
|
</template>
|
||||||
|
</MkSpacer>
|
||||||
|
</MkStickyContainer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import JSON5 from 'json5';
|
||||||
|
import * as os from '@/os';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
import FormLink from '@/components/form/link.vue';
|
||||||
|
import FormSection from '@/components/form/section.vue';
|
||||||
|
import MkButton from '@/components/ui/button.vue';
|
||||||
|
import MkKeyValue from '@/components/key-value.vue';
|
||||||
|
import FormTextarea from '@/components/form/textarea.vue';
|
||||||
|
import FormSplit from '@/components/form/split.vue';
|
||||||
|
import FormInfo from '@/components/ui/info.vue';
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
path: string;
|
||||||
|
}>();
|
||||||
|
|
||||||
|
const scope = $computed(() => props.path.split('/').slice(0, -1));
|
||||||
|
const key = $computed(() => props.path.split('/').at(-1));
|
||||||
|
|
||||||
|
let value = $ref(null);
|
||||||
|
let valueForEditor = $ref(null);
|
||||||
|
|
||||||
|
function fetchValue() {
|
||||||
|
os.api('i/registry/get-detail', {
|
||||||
|
scope,
|
||||||
|
key,
|
||||||
|
}).then(res => {
|
||||||
|
value = res;
|
||||||
|
valueForEditor = JSON5.stringify(res.value, null, '\t');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function save() {
|
||||||
|
try {
|
||||||
|
JSON5.parse(valueForEditor);
|
||||||
|
} catch (e) {
|
||||||
|
os.alert({
|
||||||
|
type: 'error',
|
||||||
|
text: i18n.ts.invalidValue,
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.saveConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled) return;
|
||||||
|
os.apiWithDialog('i/registry/set', {
|
||||||
|
scope,
|
||||||
|
key,
|
||||||
|
value: JSON5.parse(valueForEditor),
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function del() {
|
||||||
|
os.confirm({
|
||||||
|
type: 'warning',
|
||||||
|
text: i18n.ts.deleteConfirm,
|
||||||
|
}).then(({ canceled }) => {
|
||||||
|
if (canceled) return;
|
||||||
|
os.apiWithDialog('i/registry/remove', {
|
||||||
|
scope,
|
||||||
|
key,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(() => props.path, fetchValue, { immediate: true });
|
||||||
|
|
||||||
|
const headerActions = $computed(() => []);
|
||||||
|
|
||||||
|
const headerTabs = $computed(() => []);
|
||||||
|
|
||||||
|
definePageMetadata({
|
||||||
|
title: i18n.ts.registry,
|
||||||
|
icon: 'fas fa-cogs',
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
74
packages/client/src/pages/registry.vue
Normal file
74
packages/client/src/pages/registry.vue
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
<template>
|
||||||
|
<MkStickyContainer>
|
||||||
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
||||||
|
<MkSpacer :content-max="600">
|
||||||
|
<MkButton primary @click="createKey">{{ i18n.ts._registry.createKey }}</MkButton>
|
||||||
|
|
||||||
|
<FormSection v-if="scopes">
|
||||||
|
<template #label>{{ i18n.ts.system }}</template>
|
||||||
|
<div class="_formLinks">
|
||||||
|
<FormLink v-for="scope in scopes" :to="`/registry/keys/system/${scope.join('/')}`" class="_monospace">{{ scope.join('/') }}</FormLink>
|
||||||
|
</div>
|
||||||
|
</FormSection>
|
||||||
|
</MkSpacer>
|
||||||
|
</MkStickyContainer>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { ref, watch } from 'vue';
|
||||||
|
import JSON5 from 'json5';
|
||||||
|
import * as os from '@/os';
|
||||||
|
import { i18n } from '@/i18n';
|
||||||
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
||||||
|
import FormLink from '@/components/form/link.vue';
|
||||||
|
import FormSection from '@/components/form/section.vue';
|
||||||
|
import MkButton from '@/components/ui/button.vue';
|
||||||
|
|
||||||
|
let scopes = $ref(null);
|
||||||
|
|
||||||
|
function fetchScopes() {
|
||||||
|
os.api('i/registry/scopes').then(res => {
|
||||||
|
scopes = res.slice().sort((a, b) => a.join('/').localeCompare(b.join('/')));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createKey() {
|
||||||
|
const { canceled, result } = await os.form(i18n.ts._registry.createKey, {
|
||||||
|
key: {
|
||||||
|
type: 'string',
|
||||||
|
label: i18n.ts._registry.key,
|
||||||
|
},
|
||||||
|
value: {
|
||||||
|
type: 'string',
|
||||||
|
multiline: true,
|
||||||
|
label: i18n.ts.value,
|
||||||
|
},
|
||||||
|
scope: {
|
||||||
|
type: 'string',
|
||||||
|
label: i18n.ts._registry.scope,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
if (canceled) return;
|
||||||
|
os.apiWithDialog('i/registry/set', {
|
||||||
|
scope: result.scope.split('/'),
|
||||||
|
key: result.key,
|
||||||
|
value: JSON5.parse(result.value),
|
||||||
|
}).then(() => {
|
||||||
|
fetchScopes();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fetchScopes();
|
||||||
|
|
||||||
|
const headerActions = $computed(() => []);
|
||||||
|
|
||||||
|
const headerTabs = $computed(() => []);
|
||||||
|
|
||||||
|
definePageMetadata({
|
||||||
|
title: i18n.ts.registry,
|
||||||
|
icon: 'fas fa-cogs',
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
</style>
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
<FormLink to="/settings/account-info" class="_formBlock">{{ i18n.ts.accountInfo }}</FormLink>
|
<FormLink to="/settings/account-info" class="_formBlock">{{ i18n.ts.accountInfo }}</FormLink>
|
||||||
|
|
||||||
|
<FormLink to="/registry" class="_formBlock"><template #icon><i class="fas fa-cogs"></i></template>{{ i18n.ts.registry }}</FormLink>
|
||||||
|
|
||||||
<FormLink to="/settings/delete-account" class="_formBlock"><template #icon><i class="fas fa-exclamation-triangle"></i></template>{{ i18n.ts.closeAccount }}</FormLink>
|
<FormLink to="/settings/delete-account" class="_formBlock"><template #icon><i class="fas fa-exclamation-triangle"></i></template>{{ i18n.ts.closeAccount }}</FormLink>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -39,10 +39,10 @@
|
||||||
|
|
||||||
<div class="_formRoot">
|
<div class="_formRoot">
|
||||||
<FormSplit v-for="(record, i) in fields" :min-width="250" class="_formBlock">
|
<FormSplit v-for="(record, i) in fields" :min-width="250" class="_formBlock">
|
||||||
<FormInput v-model="record.name">
|
<FormInput v-model="record.name" small>
|
||||||
<template #label>{{ i18n.ts._profile.metadataLabel }} #{{ i + 1 }}</template>
|
<template #label>{{ i18n.ts._profile.metadataLabel }} #{{ i + 1 }}</template>
|
||||||
</FormInput>
|
</FormInput>
|
||||||
<FormInput v-model="record.value">
|
<FormInput v-model="record.value" small>
|
||||||
<template #label>{{ i18n.ts._profile.metadataContent }} #{{ i + 1 }}</template>
|
<template #label>{{ i18n.ts._profile.metadataContent }} #{{ i + 1 }}</template>
|
||||||
</FormInput>
|
</FormInput>
|
||||||
</FormSplit>
|
</FormSplit>
|
||||||
|
|
|
@ -153,6 +153,15 @@ export const routes = [{
|
||||||
}, {
|
}, {
|
||||||
path: '/channels',
|
path: '/channels',
|
||||||
component: page(() => import('./pages/channels.vue')),
|
component: page(() => import('./pages/channels.vue')),
|
||||||
|
}, {
|
||||||
|
path: '/registry/keys/system/:path(*)?',
|
||||||
|
component: page(() => import('./pages/registry.keys.vue')),
|
||||||
|
}, {
|
||||||
|
path: '/registry/value/system/:path(*)?',
|
||||||
|
component: page(() => import('./pages/registry.value.vue')),
|
||||||
|
}, {
|
||||||
|
path: '/registry',
|
||||||
|
component: page(() => import('./pages/registry.vue')),
|
||||||
}, {
|
}, {
|
||||||
path: '/admin/file/:fileId',
|
path: '/admin/file/:fileId',
|
||||||
component: iAmModerator ? page(() => import('./pages/admin-file.vue')) : page(() => import('./pages/not-found.vue')),
|
component: iAmModerator ? page(() => import('./pages/admin-file.vue')) : page(() => import('./pages/not-found.vue')),
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
<button v-tooltip.noDelay.right="i18n.ts.note" class="item _button post" data-cy-open-post-form @click="os.post">
|
<button v-tooltip.noDelay.right="i18n.ts.note" class="item _button post" data-cy-open-post-form @click="os.post">
|
||||||
<i class="icon fas fa-pencil-alt fa-fw"></i><span class="text">{{ i18n.ts.note }}</span>
|
<i class="icon fas fa-pencil-alt fa-fw"></i><span class="text">{{ i18n.ts.note }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button v-click-anime v-tooltip.noDelay.right="i18n.ts.account" class="item _button account" @click="openAccountMenu">
|
<button v-click-anime v-tooltip.noDelay.right="`${i18n.ts.account}: @${$i.username}`" class="item _button account" @click="openAccountMenu">
|
||||||
<MkAvatar :user="$i" class="avatar"/><MkAcct class="text" :user="$i"/>
|
<MkAvatar :user="$i" class="avatar"/><MkAcct class="text" :user="$i"/>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue