2023-07-27 08:31:52 +03:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-02-06 14:05:00 +02:00
|
|
|
<template>
|
2023-01-06 06:40:17 +02:00
|
|
|
<div class="_gaps_m">
|
2023-01-05 14:04:56 +02:00
|
|
|
<FormInfo warn>{{ i18n.ts._plugin.installWarn }}</FormInfo>
|
2021-02-06 14:05:00 +02:00
|
|
|
|
2023-12-15 10:18:31 +02:00
|
|
|
<MkTextarea v-model="code" tall code>
|
2022-05-04 04:10:52 +03:00
|
|
|
<template #label>{{ i18n.ts.code }}</template>
|
2023-01-07 08:09:46 +02:00
|
|
|
</MkTextarea>
|
2021-02-06 14:05:00 +02:00
|
|
|
|
2023-01-05 14:04:56 +02:00
|
|
|
<div>
|
2023-01-06 02:41:14 +02:00
|
|
|
<MkButton :disabled="code == null" primary inline @click="install"><i class="ti ti-check"></i> {{ i18n.ts.install }}</MkButton>
|
2022-01-04 10:52:44 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-02-06 14:05:00 +02:00
|
|
|
</template>
|
|
|
|
|
2022-05-04 04:10:52 +03:00
|
|
|
<script lang="ts" setup>
|
2023-12-07 07:42:09 +02:00
|
|
|
import { nextTick, ref, computed } from 'vue';
|
2023-01-07 08:09:46 +02:00
|
|
|
import MkTextarea from '@/components/MkTextarea.vue';
|
2023-01-06 02:41:14 +02:00
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2022-09-06 12:21:49 +03:00
|
|
|
import FormInfo from '@/components/MkInfo.vue';
|
2023-09-19 10:37:43 +03:00
|
|
|
import * as os from '@/os.js';
|
2023-10-21 12:41:12 +03:00
|
|
|
import { installPlugin } from '@/scripts/install-plugin.js';
|
2023-09-19 10:37:43 +03:00
|
|
|
import { unisonReload } from '@/scripts/unison-reload.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2021-02-06 14:05:00 +02:00
|
|
|
|
2023-10-21 12:41:12 +03:00
|
|
|
const code = ref<string | null>(null);
|
2023-08-18 13:36:05 +03:00
|
|
|
|
2022-05-04 04:10:52 +03:00
|
|
|
async function install() {
|
2023-10-21 12:41:12 +03:00
|
|
|
if (!code.value) return;
|
2023-01-03 08:51:49 +02:00
|
|
|
|
2022-05-04 04:10:52 +03:00
|
|
|
try {
|
2023-10-21 12:41:12 +03:00
|
|
|
await installPlugin(code.value);
|
|
|
|
os.success();
|
2022-05-04 04:10:52 +03:00
|
|
|
|
2023-10-21 12:41:12 +03:00
|
|
|
nextTick(() => {
|
|
|
|
unisonReload();
|
2022-05-04 04:10:52 +03:00
|
|
|
});
|
2023-10-21 12:41:12 +03:00
|
|
|
} catch (err) {
|
2022-05-04 04:10:52 +03:00
|
|
|
os.alert({
|
|
|
|
type: 'error',
|
2023-10-21 12:41:12 +03:00
|
|
|
title: 'Install failed',
|
|
|
|
text: err.toString() ?? null,
|
2022-05-04 04:10:52 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 11:38:49 +03:00
|
|
|
|
2023-12-07 07:42:09 +02:00
|
|
|
const headerTabs = computed(() => []);
|
2022-06-20 11:38:49 +03:00
|
|
|
|
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts._plugin.install,
|
2022-12-19 12:01:30 +02:00
|
|
|
icon: 'ti ti-download',
|
2021-02-06 14:05:00 +02:00
|
|
|
});
|
|
|
|
</script>
|