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