diff --git a/CHANGELOG.md b/CHANGELOG.md index 90325f136..bf7522493 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,16 @@ 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) ### Improvements diff --git a/locales/de-DE.yml b/locales/de-DE.yml index da8f7fe9c..1ae93f6c4 100644 --- a/locales/de-DE.yml +++ b/locales/de-DE.yml @@ -1703,6 +1703,8 @@ _deck: stackLeft: "Auf linke Spalte stapeln" popRight: "Nach rechts vom Stapel nehmen" profile: "Profil" + newProfile: "Neues Profil" + deleteProfile: "Profil löschen" 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." widgetsIntroduction: "Drücke bitte \"Widgets bearbeiten\" im Spaltenmenü und füge ein Widget hinzu." diff --git a/locales/en-US.yml b/locales/en-US.yml index b1e41a0b8..a2ded5a45 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -1703,6 +1703,8 @@ _deck: stackLeft: "Stack with the left column" popRight: "Pop column to the right" profile: "Profile" + newProfile: "New profile" + deleteProfile: "Delete profile" 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." widgetsIntroduction: "Please select \"Edit widgets\" in the column menu and add a widget." diff --git a/locales/ru-RU.yml b/locales/ru-RU.yml index 4386e1c87..b0be6b4ff 100644 --- a/locales/ru-RU.yml +++ b/locales/ru-RU.yml @@ -842,6 +842,9 @@ reverse: "Переворот" colored: "Выделена цветом" label: "Метка" localOnly: "Локально" +beta: "Бета" +enableAutoSensitive: "Автоматическое определение NSFW" +enableAutoSensitiveDescription: "Если доступно, используйте машинное обучение для автоматической установки флага NSFW на носителе. Даже если эта функция отключена, она может быть установлена автоматически в зависимости от инстанта." account: "Учётные записи" _sensitiveMediaDetection: description: "Машинное обучение может быть использовано для автоматического обнаружения чувствительных медиа для модерации. Нагрузка на сервер увеличивается незначительно." diff --git a/locales/sk-SK.yml b/locales/sk-SK.yml index c5a5d6d0b..2ac0a8566 100644 --- a/locales/sk-SK.yml +++ b/locales/sk-SK.yml @@ -1698,6 +1698,8 @@ _deck: stackLeft: "Priložiť do ľavého stĺpca" popRight: "Vybrať napravo" profile: "Profil" + newProfile: "Nový profil" + deleteProfile: "Odstrániť profil" 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." widgetsIntroduction: "V ponuke stĺpca vyberte možnosť \"Upraviť widget\" a pridajte widget" diff --git a/locales/vi-VN.yml b/locales/vi-VN.yml index 238491550..90aa1da30 100644 --- a/locales/vi-VN.yml +++ b/locales/vi-VN.yml @@ -1703,6 +1703,8 @@ _deck: 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" 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!" 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." diff --git a/locales/zh-TW.yml b/locales/zh-TW.yml index 0359b03b2..4ee440c07 100644 --- a/locales/zh-TW.yml +++ b/locales/zh-TW.yml @@ -1702,6 +1702,8 @@ _deck: stackLeft: "向左折疊" popRight: "向右彈出" profile: "個人檔案" + newProfile: "新建個人檔案" + deleteProfile: "刪除個人檔案" introduction: "組合欄位來製作屬於自己的介面吧!" introduction2: "您可以隨時透過按畫面右方的 + 來添加欄位。" widgetsIntroduction: "請從欄位的選單中,選擇「編輯小工具」來添加小工具" diff --git a/package.json b/package.json index 3f9a50bb6..9ebd46a40 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "misskey", - "version": "12.115.0", + "version": "12.116.0", "codename": "indigo", "repository": { "type": "git", diff --git a/packages/backend/migration/1651224615271-foreign-key.js b/packages/backend/migration/1651224615271-foreign-key.js index 44ba7fb6c..1f1510f84 100644 --- a/packages/backend/migration/1651224615271-foreign-key.js +++ b/packages/backend/migration/1651224615271-foreign-key.js @@ -28,7 +28,7 @@ export class foreignKeyReports1651224615271 { queryRunner.query(`CREATE INDEX "IDX_315c779174fe8247ab324f036e" ON "drive_file" ("isLink")`), 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(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); diff --git a/packages/backend/src/server/api/stream/channels/channel.ts b/packages/backend/src/server/api/stream/channels/channel.ts index 5148cfd05..3cdd89a8b 100644 --- a/packages/backend/src/server/api/stream/channels/channel.ts +++ b/packages/backend/src/server/api/stream/channels/channel.ts @@ -16,6 +16,7 @@ export default class extends Channel { constructor(id: string, connection: Channel['connection']) { super(id, connection); this.onNote = this.onNote.bind(this); + this.emitTypers = this.emitTypers.bind(this); } public async init(params: any) { diff --git a/packages/client/src/components/form/input.vue b/packages/client/src/components/form/input.vue index 1cc391217..2a03d6a5d 100644 --- a/packages/client/src/components/form/input.vue +++ b/packages/client/src/components/form/input.vue @@ -77,9 +77,9 @@ const inputEl = ref<HTMLElement>(); const prefixEl = ref<HTMLElement>(); const suffixEl = ref<HTMLElement>(); const height = - props.small ? 38 : - props.large ? 42 : - 40; + props.small ? 36 : + props.large ? 40 : + 38; const focus = () => inputEl.value.focus(); const onInput = (ev: KeyboardEvent) => { diff --git a/packages/client/src/components/form/select.vue b/packages/client/src/components/form/select.vue index fe8c08cd6..78282dfdc 100644 --- a/packages/client/src/components/form/select.vue +++ b/packages/client/src/components/form/select.vue @@ -63,9 +63,9 @@ const prefixEl = ref(null); const suffixEl = ref(null); const container = ref(null); const height = - props.small ? 38 : - props.large ? 42 : - 40; + props.small ? 36 : + props.large ? 40 : + 38; const focus = () => inputEl.value.focus(); const onInput = (ev) => { diff --git a/packages/client/src/components/note-detailed.vue b/packages/client/src/components/note-detailed.vue index c05ab7fec..85bffca4a 100644 --- a/packages/client/src/components/note-detailed.vue +++ b/packages/client/src/components/note-detailed.vue @@ -390,7 +390,7 @@ if (appearNote.replyId) { > .article { padding: 32px; - font-size: 1.1em; + font-size: 1.2em; > .header { display: flex; diff --git a/packages/client/src/components/ui/button.vue b/packages/client/src/components/ui/button.vue index e6b20d988..5f5d6d42e 100644 --- a/packages/client/src/components/ui/button.vue +++ b/packages/client/src/components/ui/button.vue @@ -1,5 +1,6 @@ <template> -<button v-if="!link" class="bghgjjyj _button" +<button + v-if="!link" class="bghgjjyj _button" :class="{ inline, primary, gradate, danger, rounded, full }" :type="type" @click="$emit('click', $event)" @@ -10,7 +11,8 @@ <slot></slot> </div> </button> -<MkA v-else class="bghgjjyj _button" +<MkA + v-else class="bghgjjyj _button" :class="{ inline, primary, gradate, danger, rounded, full }" :to="to" @mousedown="onMousedown" @@ -29,56 +31,56 @@ export default defineComponent({ props: { type: { type: String, - required: false + required: false, }, primary: { type: Boolean, required: false, - default: false + default: false, }, gradate: { type: Boolean, required: false, - default: false + default: false, }, rounded: { type: Boolean, required: false, - default: false + default: false, }, inline: { type: Boolean, required: false, - default: false + default: false, }, link: { type: Boolean, required: false, - default: false + default: false, }, to: { type: String, - required: false + required: false, }, autofocus: { type: Boolean, required: false, - default: false + default: false, }, wait: { type: Boolean, required: false, - default: false + default: false, }, danger: { type: Boolean, required: false, - default: false + default: false, }, full: { type: Boolean, required: false, - default: false + default: false, }, }, emits: ['click'], @@ -127,8 +129,8 @@ export default defineComponent({ window.setTimeout(() => { if (this.$refs.ripples) this.$refs.ripples.removeChild(ripple); }, 2000); - } - } + }, + }, }); </script> @@ -142,8 +144,7 @@ export default defineComponent({ padding: 8px 14px; text-align: center; font-weight: normal; - font-size: 0.9em; - line-height: 22px; + font-size: 1em; box-shadow: none; text-decoration: none; background: var(--buttonBg); diff --git a/packages/client/src/pages/registry.keys.vue b/packages/client/src/pages/registry.keys.vue new file mode 100644 index 000000000..9d2f24f18 --- /dev/null +++ b/packages/client/src/pages/registry.keys.vue @@ -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> diff --git a/packages/client/src/pages/registry.value.vue b/packages/client/src/pages/registry.value.vue new file mode 100644 index 000000000..5291b2e4c --- /dev/null +++ b/packages/client/src/pages/registry.value.vue @@ -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> diff --git a/packages/client/src/pages/registry.vue b/packages/client/src/pages/registry.vue new file mode 100644 index 000000000..a428755a8 --- /dev/null +++ b/packages/client/src/pages/registry.vue @@ -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> diff --git a/packages/client/src/pages/settings/other.vue b/packages/client/src/pages/settings/other.vue index 52ef4d401..51dab04cf 100644 --- a/packages/client/src/pages/settings/other.vue +++ b/packages/client/src/pages/settings/other.vue @@ -10,6 +10,8 @@ <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> </div> </template> diff --git a/packages/client/src/pages/settings/profile.vue b/packages/client/src/pages/settings/profile.vue index 121709f12..f30b0ccbd 100644 --- a/packages/client/src/pages/settings/profile.vue +++ b/packages/client/src/pages/settings/profile.vue @@ -39,10 +39,10 @@ <div class="_formRoot"> <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> </FormInput> - <FormInput v-model="record.value"> + <FormInput v-model="record.value" small> <template #label>{{ i18n.ts._profile.metadataContent }} #{{ i + 1 }}</template> </FormInput> </FormSplit> diff --git a/packages/client/src/router.ts b/packages/client/src/router.ts index 2ff41e972..b61b77eee 100644 --- a/packages/client/src/router.ts +++ b/packages/client/src/router.ts @@ -153,6 +153,15 @@ export const routes = [{ }, { path: '/channels', 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', component: iAmModerator ? page(() => import('./pages/admin-file.vue')) : page(() => import('./pages/not-found.vue')), diff --git a/packages/client/src/ui/_common_/navbar.vue b/packages/client/src/ui/_common_/navbar.vue index 3eb8c5a37..e18f89113 100644 --- a/packages/client/src/ui/_common_/navbar.vue +++ b/packages/client/src/ui/_common_/navbar.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"> <i class="icon fas fa-pencil-alt fa-fw"></i><span class="text">{{ i18n.ts.note }}</span> </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"/> </button> </div>