diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2023-11-03 13:23:03 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-11-03 13:23:03 +0900 |
| commit | 79346272f8792d35955efd3aaaa1e42e0cd2a6e3 (patch) | |
| tree | 6f84fea79208862777db23aac434551494817595 /packages/frontend | |
| parent | CWを使用する場合、注釈を空にすることを許可しない (diff) | |
| download | misskey-79346272f8792d35955efd3aaaa1e42e0cd2a6e3.tar.gz misskey-79346272f8792d35955efd3aaaa1e42e0cd2a6e3.tar.bz2 misskey-79346272f8792d35955efd3aaaa1e42e0cd2a6e3.zip | |
feat: レジストリAPIをサードパーティから利用可能に (#12229)
* wip
* wip
* Update remove.ts
* refactor
Diffstat (limited to 'packages/frontend')
| -rw-r--r-- | packages/frontend/src/pages/about-misskey.vue | 2 | ||||
| -rw-r--r-- | packages/frontend/src/pages/about.vue | 4 | ||||
| -rw-r--r-- | packages/frontend/src/pages/registry.keys.vue | 10 | ||||
| -rw-r--r-- | packages/frontend/src/pages/registry.value.vue | 6 | ||||
| -rw-r--r-- | packages/frontend/src/pages/registry.vue | 20 | ||||
| -rw-r--r-- | packages/frontend/src/router.ts | 6 | ||||
| -rw-r--r-- | packages/frontend/src/style.scss | 6 |
7 files changed, 28 insertions, 26 deletions
diff --git a/packages/frontend/src/pages/about-misskey.vue b/packages/frontend/src/pages/about-misskey.vue index 7a2c698d11..b446a4d554 100644 --- a/packages/frontend/src/pages/about-misskey.vue +++ b/packages/frontend/src/pages/about-misskey.vue @@ -28,7 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only <MkButton primary rounded inline @click="iLoveMisskey">I <Mfm text="$[jelly ❤]"/> #Misskey</MkButton> </div> <FormSection> - <div class="_formLinks"> + <div class="_gaps_s"> <FormLink to="https://github.com/misskey-dev/misskey" external> <template #icon><i class="ti ti-code"></i></template> {{ i18n.ts._aboutMisskey.source }} diff --git a/packages/frontend/src/pages/about.vue b/packages/frontend/src/pages/about.vue index ee4043f9a5..4fa409ff4b 100644 --- a/packages/frontend/src/pages/about.vue +++ b/packages/frontend/src/pages/about.vue @@ -47,7 +47,7 @@ SPDX-License-Identifier: AGPL-3.0-only </MkKeyValue> </FormSplit> <FormLink v-if="instance.impressumUrl" :to="instance.impressumUrl" external>{{ i18n.ts.impressum }}</FormLink> - <div class="_formLinks"> + <div class="_gaps_s"> <MkFolder v-if="instance.serverRules.length > 0"> <template #label>{{ i18n.ts.serverRules }}</template> @@ -79,7 +79,7 @@ SPDX-License-Identifier: AGPL-3.0-only <FormSection> <template #label>Well-known resources</template> - <div class="_formLinks"> + <div class="_gaps_s"> <FormLink :to="`/.well-known/host-meta`" external>host-meta</FormLink> <FormLink :to="`/.well-known/host-meta.json`" external>host-meta.json</FormLink> <FormLink :to="`/.well-known/nodeinfo`" external>nodeinfo</FormLink> diff --git a/packages/frontend/src/pages/registry.keys.vue b/packages/frontend/src/pages/registry.keys.vue index a1a5fd0cf3..387cb2f1f7 100644 --- a/packages/frontend/src/pages/registry.keys.vue +++ b/packages/frontend/src/pages/registry.keys.vue @@ -11,7 +11,7 @@ SPDX-License-Identifier: AGPL-3.0-only <FormSplit> <MkKeyValue> <template #key>{{ i18n.ts._registry.domain }}</template> - <template #value>{{ i18n.ts.system }}</template> + <template #value>{{ props.domain === '@' ? i18n.ts.system : props.domain.toUpperCase() }}</template> </MkKeyValue> <MkKeyValue> <template #key>{{ i18n.ts._registry.scope }}</template> @@ -23,8 +23,8 @@ SPDX-License-Identifier: AGPL-3.0-only <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 class="_gaps_s"> + <FormLink v-for="key in keys" :to="`/registry/value/${props.domain}/${scope.join('/')}/${key[0]}`" class="_monospace">{{ key[0] }}<template #suffix>{{ key[1].toUpperCase() }}</template></FormLink> </div> </FormSection> </div> @@ -46,15 +46,17 @@ import FormSplit from '@/components/form/split.vue'; const props = defineProps<{ path: string; + domain: string; }>(); -const scope = $computed(() => props.path.split('/')); +const scope = $computed(() => props.path ? props.path.split('/') : []); let keys = $ref(null); function fetchKeys() { os.api('i/registry/keys-with-type', { scope: scope, + domain: props.domain === '@' ? null : props.domain, }).then(res => { keys = Object.entries(res).sort((a, b) => a[0].localeCompare(b[0])); }); diff --git a/packages/frontend/src/pages/registry.value.vue b/packages/frontend/src/pages/registry.value.vue index ebcb04e9f5..68d6c8c1a0 100644 --- a/packages/frontend/src/pages/registry.value.vue +++ b/packages/frontend/src/pages/registry.value.vue @@ -14,7 +14,7 @@ SPDX-License-Identifier: AGPL-3.0-only <FormSplit> <MkKeyValue> <template #key>{{ i18n.ts._registry.domain }}</template> - <template #value>{{ i18n.ts.system }}</template> + <template #value>{{ props.domain === '@' ? i18n.ts.system : props.domain.toUpperCase() }}</template> </MkKeyValue> <MkKeyValue> <template #key>{{ i18n.ts._registry.scope }}</template> @@ -58,6 +58,7 @@ import FormInfo from '@/components/MkInfo.vue'; const props = defineProps<{ path: string; + domain: string; }>(); const scope = $computed(() => props.path.split('/').slice(0, -1)); @@ -70,6 +71,7 @@ function fetchValue() { os.api('i/registry/get-detail', { scope, key, + domain: props.domain === '@' ? null : props.domain, }).then(res => { value = res; valueForEditor = JSON5.stringify(res.value, null, '\t'); @@ -95,6 +97,7 @@ async function save() { scope, key, value: JSON5.parse(valueForEditor), + domain: props.domain === '@' ? null : props.domain, }); }); } @@ -108,6 +111,7 @@ function del() { os.apiWithDialog('i/registry/remove', { scope, key, + domain: props.domain === '@' ? null : props.domain, }); }); } diff --git a/packages/frontend/src/pages/registry.vue b/packages/frontend/src/pages/registry.vue index 37a0b52511..d0a3df5deb 100644 --- a/packages/frontend/src/pages/registry.vue +++ b/packages/frontend/src/pages/registry.vue @@ -9,12 +9,14 @@ SPDX-License-Identifier: AGPL-3.0-only <MkSpacer :contentMax="600" :marginMin="16"> <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> + <div v-if="scopesWithDomain" class="_gaps_m"> + <FormSection v-for="domain in scopesWithDomain" :key="domain.domain"> + <template #label>{{ domain.domain ? domain.domain.toUpperCase() : i18n.ts.system }}</template> + <div class="_gaps_s"> + <FormLink v-for="scope in domain.scopes" :to="`/registry/keys/${domain.domain ?? '@'}/${scope.join('/')}`" class="_monospace">{{ scope.length === 0 ? '(root)' : scope.join('/') }}</FormLink> + </div> + </FormSection> + </div> </MkSpacer> </MkStickyContainer> </template> @@ -28,11 +30,11 @@ import FormLink from '@/components/form/link.vue'; import FormSection from '@/components/form/section.vue'; import MkButton from '@/components/MkButton.vue'; -let scopes = $ref(null); +let scopesWithDomain = $ref(null); function fetchScopes() { - os.api('i/registry/scopes').then(res => { - scopes = res.slice().sort((a, b) => a.join('/').localeCompare(b.join('/'))); + os.api('i/registry/scopes-with-domain').then(res => { + scopesWithDomain = res; }); } diff --git a/packages/frontend/src/router.ts b/packages/frontend/src/router.ts index ef0f5343bb..b81811d2e7 100644 --- a/packages/frontend/src/router.ts +++ b/packages/frontend/src/router.ts @@ -4,7 +4,7 @@ */ import { AsyncComponentLoader, defineAsyncComponent, inject } from 'vue'; -import { Router } from '@/nirax'; +import { Router } from '@/nirax.js'; import { $i, iAmModerator } from '@/account.js'; import MkLoading from '@/pages/_loading_.vue'; import MkError from '@/pages/_error_.vue'; @@ -318,10 +318,10 @@ export const routes = [{ name: 'avatarDecorations', component: page(() => import('./pages/avatar-decorations.vue')), }, { - path: '/registry/keys/system/:path(*)?', + path: '/registry/keys/:domain/:path(*)?', component: page(() => import('./pages/registry.keys.vue')), }, { - path: '/registry/value/system/:path(*)?', + path: '/registry/value/:domain/:path(*)?', component: page(() => import('./pages/registry.value.vue')), }, { path: '/registry', diff --git a/packages/frontend/src/style.scss b/packages/frontend/src/style.scss index 28fb5ba2a5..7bb443cece 100644 --- a/packages/frontend/src/style.scss +++ b/packages/frontend/src/style.scss @@ -344,12 +344,6 @@ hr { grid-gap: 12px; } -._formLinks { - > *:not(:last-child) { - margin-bottom: 8px; - } -} - ._beta { margin-left: 0.7em; font-size: 65%; |