@@ -8,76 +8,8 @@ SPDX-License-Identifier: AGPL-3.0-only
8
8
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
9
9
<MkSpacer :contentMax="500">
10
10
<MkLoading v-if="uiPhase === 'fetching'"/>
11
- <div v-else-if="uiPhase === 'confirm' && data" class="_gaps_m" :class="$style.extInstallerRoot">
12
- <div :class="$style.extInstallerIconWrapper">
13
- <i v-if="data.type === 'plugin'" class="ti ti-plug"></i>
14
- <i v-else-if="data.type === 'theme'" class="ti ti-palette"></i>
15
- <i v-else class="ti ti-download"></i>
16
- </div>
17
- <h2 :class="$style.extInstallerTitle">{{ i18n.ts._externalResourceInstaller[`_${data.type}`].title }}</h2>
18
- <div :class="$style.extInstallerNormDesc">{{ i18n.ts._externalResourceInstaller.checkVendorBeforeInstall }}</div>
19
- <MkInfo v-if="data.type === 'plugin'" :warn="true">{{ i18n.ts._plugin.installWarn }}</MkInfo>
20
- <FormSection>
21
- <template #label>{{ i18n.ts._externalResourceInstaller[`_${data.type}`].metaTitle }}</template>
22
- <div class="_gaps_s">
23
- <FormSplit>
24
- <MkKeyValue>
25
- <template #key>{{ i18n.ts.name }}</template>
26
- <template #value>{{ data.meta?.name }}</template>
27
- </MkKeyValue>
28
- <MkKeyValue>
29
- <template #key>{{ i18n.ts.author }}</template>
30
- <template #value>{{ data.meta?.author }}</template>
31
- </MkKeyValue>
32
- </FormSplit>
33
- <MkKeyValue v-if="data.type === 'plugin'">
34
- <template #key>{{ i18n.ts.description }}</template>
35
- <template #value>{{ data.meta?.description }}</template>
36
- </MkKeyValue>
37
- <MkKeyValue v-if="data.type === 'plugin'">
38
- <template #key>{{ i18n.ts.version }}</template>
39
- <template #value>{{ data.meta?.version }}</template>
40
- </MkKeyValue>
41
- <MkKeyValue v-if="data.type === 'plugin'">
42
- <template #key>{{ i18n.ts.permission }}</template>
43
- <template #value>
44
- <ul :class="$style.extInstallerKVList">
45
- <li v-for="permission in data.meta?.permissions" :key="permission">{{ i18n.ts._permissions[permission] }}</li>
46
- </ul>
47
- </template>
48
- </MkKeyValue>
49
- <MkKeyValue v-if="data.type === 'theme' && data.meta?.base">
50
- <template #key>{{ i18n.ts._externalResourceInstaller._meta.base }}</template>
51
- <template #value>{{ i18n.ts[data.meta.base] }}</template>
52
- </MkKeyValue>
53
- <MkFolder>
54
- <template #icon><i class="ti ti-code"></i></template>
55
- <template #label>{{ i18n.ts._plugin.viewSource }}</template>
56
-
57
- <MkCode :code="data.raw ?? ''"/>
58
- </MkFolder>
59
- </div>
60
- </FormSection>
61
- <FormSection>
62
- <template #label>{{ i18n.ts._externalResourceInstaller._vendorInfo.title }}</template>
63
- <div class="_gaps_s">
64
- <MkKeyValue>
65
- <template #key>{{ i18n.ts._externalResourceInstaller._vendorInfo.endpoint }}</template>
66
- <template #value><MkUrl :url="url ?? ''" :showUrlPreview="false"></MkUrl></template>
67
- </MkKeyValue>
68
- <MkKeyValue>
69
- <template #key>{{ i18n.ts._externalResourceInstaller._vendorInfo.hashVerify }}</template>
70
- <template #value>
71
- <!--この画面が出ている時点でハッシュの検証には成功している-->
72
- <i class="ti ti-check" style="color: var(--accent)"></i>
73
- </template>
74
- </MkKeyValue>
75
- </div>
76
- </FormSection>
77
- <div class="_buttonsCenter">
78
- <MkButton primary @click="install()"><i class="ti ti-check"></i> {{ i18n.ts.install }}</MkButton>
79
- </div>
80
- </div>
11
+ <!-- この画面が表示されている時点でハッシュの検証には成功している -->
12
+ <MkExtensionInstaller v-else-if="uiPhase === 'confirm' && data" :extension="data" :url="url" hashVerified @confirm="install()"/>
81
13
<div v-else-if="uiPhase === 'error'" class="_gaps_m" :class="[$style.extInstallerRoot, $style.error]">
82
14
<div :class="$style.extInstallerIconWrapper">
83
15
<i class="ti ti-circle-x"></i>
@@ -96,14 +28,8 @@ SPDX-License-Identifier: AGPL-3.0-only
96
28
<script lang="ts" setup>
97
29
import { ref, computed, onActivated, onDeactivated, nextTick } from 'vue';
98
30
import MkLoading from '@/components/global/MkLoading.vue';
31
+ import MkExtensionInstaller, { type Extension } from '@/components/MkExtensionInstaller.vue';
99
32
import MkButton from '@/components/MkButton.vue';
100
- import FormSection from '@/components/form/section.vue';
101
- import FormSplit from '@/components/form/split.vue';
102
- import MkCode from '@/components/MkCode.vue';
103
- import MkUrl from '@/components/global/MkUrl.vue';
104
- import MkInfo from '@/components/MkInfo.vue';
105
- import MkFolder from '@/components/MkFolder.vue';
106
- import MkKeyValue from '@/components/MkKeyValue.vue';
107
33
import * as os from '@/os.js';
108
34
import { misskeyApi } from '@/scripts/misskey-api.js';
109
35
import { AiScriptPluginMeta, parsePluginMeta, installPlugin } from '@/scripts/install-plugin.js';
@@ -124,24 +50,7 @@ const errorKV = ref<{
124
50
const url = ref<string | null>(null);
125
51
const hash = ref<string | null>(null);
126
52
127
- const data = ref<{
128
- type: 'plugin' | 'theme';
129
- raw: string;
130
- meta?: {
131
- // Plugin & Theme Common
132
- name: string;
133
- author: string;
134
-
135
- // Plugin
136
- description?: string;
137
- version?: string;
138
- permissions?: string[];
139
- config?: Record<string, any>;
140
-
141
- // Theme
142
- base?: 'light' | 'dark';
143
- };
144
- } | null>(null);
53
+ const data = ref<Extension | null>(null);
145
54
146
55
function goBack(): void {
147
56
history.back();
@@ -227,7 +136,7 @@ async function fetch() {
227
136
data.value = {
228
137
type: 'theme',
229
138
meta: {
230
- description,
139
+ // description, // 使用されていない
231
140
...meta,
232
141
},
233
142
raw: res.data,
@@ -353,9 +262,4 @@ definePageMetadata(() => ({
353
262
.extInstallerNormDesc {
354
263
text-align: center;
355
264
}
356
-
357
- .extInstallerKVList {
358
- margin-top: 0;
359
- margin-bottom: 0;
360
- }
361
265
</style>
0 commit comments