Merge branch 'develop' into pizzax-indexeddb
This commit is contained in:
@@ -72,7 +72,7 @@ export async function addAccount(id: Account['id'], token: Account['token']) {
|
||||
}
|
||||
}
|
||||
|
||||
function fetchAccount(token): Promise<Account> {
|
||||
function fetchAccount(token: string): Promise<Account> {
|
||||
return new Promise((done, fail) => {
|
||||
// Fetch user
|
||||
fetch(`${apiUrl}/i`, {
|
||||
|
@@ -80,7 +80,7 @@ export default defineComponent({
|
||||
margin-right: 0.75em;
|
||||
flex-shrink: 0;
|
||||
text-align: center;
|
||||
opacity: 0.8;
|
||||
color: var(--fgTransparentWeak);
|
||||
|
||||
&:empty {
|
||||
display: none;
|
||||
|
@@ -5,14 +5,13 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { inject } from 'vue';
|
||||
import * as os from '@/os';
|
||||
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
||||
import { router } from '@/router';
|
||||
import { url } from '@/config';
|
||||
import { popout as popout_ } from '@/scripts/popout';
|
||||
import { i18n } from '@/i18n';
|
||||
import { defaultStore } from '@/store';
|
||||
import { MisskeyNavigator } from '@/scripts/navigate';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
to: string;
|
||||
@@ -23,9 +22,7 @@ const props = withDefaults(defineProps<{
|
||||
behavior: null,
|
||||
});
|
||||
|
||||
type Navigate = (path: string, record?: boolean) => void;
|
||||
const navHook = inject<null | Navigate>('navHook', null);
|
||||
const sideViewHook = inject<null | Navigate>('sideViewHook', null);
|
||||
const mkNav = new MisskeyNavigator();
|
||||
|
||||
const active = $computed(() => {
|
||||
if (props.activeClass == null) return false;
|
||||
@@ -48,11 +45,11 @@ function onContextmenu(ev) {
|
||||
action: () => {
|
||||
os.pageWindow(props.to);
|
||||
}
|
||||
}, sideViewHook ? {
|
||||
}, mkNav.sideViewHook ? {
|
||||
icon: 'fas fa-columns',
|
||||
text: i18n.ts.openInSideView,
|
||||
action: () => {
|
||||
sideViewHook(props.to);
|
||||
if (mkNav.sideViewHook) mkNav.sideViewHook(props.to);
|
||||
}
|
||||
} : undefined, {
|
||||
icon: 'fas fa-expand-alt',
|
||||
@@ -101,18 +98,6 @@ function nav() {
|
||||
}
|
||||
}
|
||||
|
||||
if (navHook) {
|
||||
navHook(props.to);
|
||||
} else {
|
||||
if (defaultStore.state.defaultSideView && sideViewHook && props.to !== '/') {
|
||||
return sideViewHook(props.to);
|
||||
}
|
||||
|
||||
if (router.currentRoute.value.path === props.to) {
|
||||
window.scroll({ top: 0, behavior: 'smooth' });
|
||||
} else {
|
||||
router.push(props.to);
|
||||
}
|
||||
}
|
||||
mkNav.push(props.to);
|
||||
}
|
||||
</script>
|
||||
|
@@ -15,9 +15,9 @@
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import PhotoSwipeLightbox from 'photoswipe/dist/photoswipe-lightbox.esm.js';
|
||||
import PhotoSwipe from 'photoswipe/dist/photoswipe.esm.js';
|
||||
import 'photoswipe/dist/photoswipe.css';
|
||||
import PhotoSwipeLightbox from 'photoswipe/lightbox';
|
||||
import PhotoSwipe from 'photoswipe';
|
||||
import 'photoswipe/style.css';
|
||||
import XBanner from './media-banner.vue';
|
||||
import XImage from './media-image.vue';
|
||||
import XVideo from './media-video.vue';
|
||||
|
@@ -24,10 +24,10 @@
|
||||
</div>
|
||||
<!-- TODO
|
||||
<div class="inputs" style="display: flex; padding-top: 1.2em;">
|
||||
<MkInput v-model="searchUsername" style="margin: 0; flex: 1;" type="text" spellcheck="false" @update:modelValue="$refs.reports.reload()">
|
||||
<MkInput v-model="searchUsername" style="margin: 0; flex: 1;" type="text" spellcheck="false">
|
||||
<span>{{ $ts.username }}</span>
|
||||
</MkInput>
|
||||
<MkInput v-model="searchHost" style="margin: 0; flex: 1;" type="text" spellcheck="false" @update:modelValue="$refs.reports.reload()" :disabled="pagination.params().origin === 'local'">
|
||||
<MkInput v-model="searchHost" style="margin: 0; flex: 1;" type="text" spellcheck="false" :disabled="pagination.params().origin === 'local'">
|
||||
<span>{{ $ts.host }}</span>
|
||||
</MkInput>
|
||||
</div>
|
||||
@@ -41,8 +41,8 @@
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent } from 'vue';
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
import MkInput from '@/components/form/input.vue';
|
||||
import MkSelect from '@/components/form/select.vue';
|
||||
@@ -50,45 +50,35 @@ import MkPagination from '@/components/ui/pagination.vue';
|
||||
import XAbuseReport from '@/components/abuse-report.vue';
|
||||
import * as os from '@/os';
|
||||
import * as symbols from '@/symbols';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
MkInput,
|
||||
MkSelect,
|
||||
MkPagination,
|
||||
XAbuseReport,
|
||||
},
|
||||
let reports = $ref<InstanceType<typeof MkPagination>>();
|
||||
|
||||
emits: ['info'],
|
||||
let state = $ref('unresolved');
|
||||
let reporterOrigin = $ref('combined');
|
||||
let targetUserOrigin = $ref('combined');
|
||||
let searchUsername = $ref('');
|
||||
let searchHost = $ref('');
|
||||
|
||||
data() {
|
||||
return {
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: this.$ts.abuseReports,
|
||||
icon: 'fas fa-exclamation-circle',
|
||||
bg: 'var(--bg)',
|
||||
},
|
||||
searchUsername: '',
|
||||
searchHost: '',
|
||||
state: 'unresolved',
|
||||
reporterOrigin: 'combined',
|
||||
targetUserOrigin: 'combined',
|
||||
pagination: {
|
||||
endpoint: 'admin/abuse-user-reports' as const,
|
||||
limit: 10,
|
||||
params: computed(() => ({
|
||||
state: this.state,
|
||||
reporterOrigin: this.reporterOrigin,
|
||||
targetUserOrigin: this.targetUserOrigin,
|
||||
})),
|
||||
},
|
||||
}
|
||||
},
|
||||
const pagination = {
|
||||
endpoint: 'admin/abuse-user-reports' as const,
|
||||
limit: 10,
|
||||
params: computed(() => ({
|
||||
state,
|
||||
reporterOrigin,
|
||||
targetUserOrigin,
|
||||
})),
|
||||
};
|
||||
|
||||
methods: {
|
||||
resolved(reportId) {
|
||||
this.$refs.reports.removeItem(item => item.id === reportId);
|
||||
},
|
||||
function resolved(reportId) {
|
||||
reports.removeItem(item => item.id === reportId);
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: i18n.ts.abuseReports,
|
||||
icon: 'fas fa-exclamation-circle',
|
||||
bg: 'var(--bg)',
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
@@ -2,19 +2,22 @@
|
||||
<MkSpacer :content-max="900" :margin-min="20" :margin-max="32">
|
||||
<div ref="el" class="vvcocwet" :class="{ wide: !narrow }">
|
||||
<div class="header">
|
||||
<div class="title">{{ $ts.settings }}</div>
|
||||
<div class="title">
|
||||
<MkA v-if="narrow" to="/settings">{{ $ts.settings }}</MkA>
|
||||
<template v-else>{{ $ts.settings }}</template>
|
||||
</div>
|
||||
<div v-if="childInfo" class="subtitle">{{ childInfo.title }}</div>
|
||||
</div>
|
||||
<div class="body">
|
||||
<div v-if="!narrow || page == null" class="nav">
|
||||
<div v-if="!narrow || initialPage == null" class="nav">
|
||||
<div class="baaadecd">
|
||||
<MkInfo v-if="emailNotConfigured" warn class="info">{{ $ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ $ts.configure }}</MkA></MkInfo>
|
||||
<MkSuperMenu :def="menuDef" :grid="page == null"></MkSuperMenu>
|
||||
<MkSuperMenu :def="menuDef" :grid="initialPage == null"></MkSuperMenu>
|
||||
</div>
|
||||
</div>
|
||||
<div class="main">
|
||||
<div v-if="!(narrow && initialPage == null)" class="main">
|
||||
<div class="bkzroven">
|
||||
<component :is="component" :ref="el => pageChanged(el)" :key="page" v-bind="pageProps"/>
|
||||
<component :is="component" :ref="el => pageChanged(el)" :key="initialPage" v-bind="pageProps"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -23,7 +26,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, defineAsyncComponent, nextTick, onMounted, ref, watch } from 'vue';
|
||||
import { computed, defineAsyncComponent, nextTick, onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
import { i18n } from '@/i18n';
|
||||
import MkInfo from '@/components/ui/info.vue';
|
||||
import MkSuperMenu from '@/components/ui/super-menu.vue';
|
||||
@@ -33,6 +36,7 @@ import { unisonReload } from '@/scripts/unison-reload';
|
||||
import * as symbols from '@/symbols';
|
||||
import { instance } from '@/instance';
|
||||
import { $i } from '@/account';
|
||||
import { MisskeyNavigator } from '@/scripts/navigate';
|
||||
|
||||
const props = defineProps<{
|
||||
initialPage?: string
|
||||
@@ -45,53 +49,61 @@ const indexInfo = {
|
||||
hideHeader: true,
|
||||
};
|
||||
const INFO = ref(indexInfo);
|
||||
const page = ref(props.initialPage);
|
||||
const narrow = ref(false);
|
||||
const view = ref(null);
|
||||
const el = ref<HTMLElement | null>(null);
|
||||
const childInfo = ref(null);
|
||||
|
||||
const nav = new MisskeyNavigator();
|
||||
|
||||
const narrow = ref(false);
|
||||
const NARROW_THRESHOLD = 600;
|
||||
|
||||
const ro = new ResizeObserver((entries, observer) => {
|
||||
if (entries.length === 0) return;
|
||||
narrow.value = entries[0].borderBoxSize[0].inlineSize < NARROW_THRESHOLD;
|
||||
});
|
||||
|
||||
const menuDef = computed(() => [{
|
||||
title: i18n.ts.basicSettings,
|
||||
items: [{
|
||||
icon: 'fas fa-user',
|
||||
text: i18n.ts.profile,
|
||||
to: '/settings/profile',
|
||||
active: page.value === 'profile',
|
||||
active: props.initialPage === 'profile',
|
||||
}, {
|
||||
icon: 'fas fa-lock-open',
|
||||
text: i18n.ts.privacy,
|
||||
to: '/settings/privacy',
|
||||
active: page.value === 'privacy',
|
||||
active: props.initialPage === 'privacy',
|
||||
}, {
|
||||
icon: 'fas fa-laugh',
|
||||
text: i18n.ts.reaction,
|
||||
to: '/settings/reaction',
|
||||
active: page.value === 'reaction',
|
||||
active: props.initialPage === 'reaction',
|
||||
}, {
|
||||
icon: 'fas fa-cloud',
|
||||
text: i18n.ts.drive,
|
||||
to: '/settings/drive',
|
||||
active: page.value === 'drive',
|
||||
active: props.initialPage === 'drive',
|
||||
}, {
|
||||
icon: 'fas fa-bell',
|
||||
text: i18n.ts.notifications,
|
||||
to: '/settings/notifications',
|
||||
active: page.value === 'notifications',
|
||||
active: props.initialPage === 'notifications',
|
||||
}, {
|
||||
icon: 'fas fa-envelope',
|
||||
text: i18n.ts.email,
|
||||
to: '/settings/email',
|
||||
active: page.value === 'email',
|
||||
active: props.initialPage === 'email',
|
||||
}, {
|
||||
icon: 'fas fa-share-alt',
|
||||
text: i18n.ts.integration,
|
||||
to: '/settings/integration',
|
||||
active: page.value === 'integration',
|
||||
active: props.initialPage === 'integration',
|
||||
}, {
|
||||
icon: 'fas fa-lock',
|
||||
text: i18n.ts.security,
|
||||
to: '/settings/security',
|
||||
active: page.value === 'security',
|
||||
active: props.initialPage === 'security',
|
||||
}],
|
||||
}, {
|
||||
title: i18n.ts.clientSettings,
|
||||
@@ -99,27 +111,27 @@ const menuDef = computed(() => [{
|
||||
icon: 'fas fa-cogs',
|
||||
text: i18n.ts.general,
|
||||
to: '/settings/general',
|
||||
active: page.value === 'general',
|
||||
active: props.initialPage === 'general',
|
||||
}, {
|
||||
icon: 'fas fa-palette',
|
||||
text: i18n.ts.theme,
|
||||
to: '/settings/theme',
|
||||
active: page.value === 'theme',
|
||||
active: props.initialPage === 'theme',
|
||||
}, {
|
||||
icon: 'fas fa-list-ul',
|
||||
text: i18n.ts.menu,
|
||||
to: '/settings/menu',
|
||||
active: page.value === 'menu',
|
||||
active: props.initialPage === 'menu',
|
||||
}, {
|
||||
icon: 'fas fa-music',
|
||||
text: i18n.ts.sounds,
|
||||
to: '/settings/sounds',
|
||||
active: page.value === 'sounds',
|
||||
active: props.initialPage === 'sounds',
|
||||
}, {
|
||||
icon: 'fas fa-plug',
|
||||
text: i18n.ts.plugins,
|
||||
to: '/settings/plugin',
|
||||
active: page.value === 'plugin',
|
||||
active: props.initialPage === 'plugin',
|
||||
}],
|
||||
}, {
|
||||
title: i18n.ts.otherSettings,
|
||||
@@ -127,32 +139,37 @@ const menuDef = computed(() => [{
|
||||
icon: 'fas fa-boxes',
|
||||
text: i18n.ts.importAndExport,
|
||||
to: '/settings/import-export',
|
||||
active: page.value === 'import-export',
|
||||
active: props.initialPage === 'import-export',
|
||||
}, {
|
||||
icon: 'fas fa-volume-mute',
|
||||
text: i18n.ts.instanceMute,
|
||||
to: '/settings/instance-mute',
|
||||
active: page.value === 'instance-mute',
|
||||
active: props.initialPage === 'instance-mute',
|
||||
}, {
|
||||
icon: 'fas fa-ban',
|
||||
text: i18n.ts.muteAndBlock,
|
||||
to: '/settings/mute-block',
|
||||
active: page.value === 'mute-block',
|
||||
active: props.initialPage === 'mute-block',
|
||||
}, {
|
||||
icon: 'fas fa-comment-slash',
|
||||
text: i18n.ts.wordMute,
|
||||
to: '/settings/word-mute',
|
||||
active: page.value === 'word-mute',
|
||||
active: props.initialPage === 'word-mute',
|
||||
}, {
|
||||
icon: 'fas fa-key',
|
||||
text: 'API',
|
||||
to: '/settings/api',
|
||||
active: page.value === 'api',
|
||||
active: props.initialPage === 'api',
|
||||
}, {
|
||||
icon: 'fas fa-bolt',
|
||||
text: 'Webhook',
|
||||
to: '/settings/webhook',
|
||||
active: props.initialPage === 'webhook',
|
||||
}, {
|
||||
icon: 'fas fa-ellipsis-h',
|
||||
text: i18n.ts.other,
|
||||
to: '/settings/other',
|
||||
active: page.value === 'other',
|
||||
active: props.initialPage === 'other',
|
||||
}],
|
||||
}, {
|
||||
items: [{
|
||||
@@ -177,8 +194,8 @@ const menuDef = computed(() => [{
|
||||
|
||||
const pageProps = ref({});
|
||||
const component = computed(() => {
|
||||
if (page.value == null) return null;
|
||||
switch (page.value) {
|
||||
if (props.initialPage == null) return null;
|
||||
switch (props.initialPage) {
|
||||
case 'accounts': return defineAsyncComponent(() => import('./accounts.vue'));
|
||||
case 'profile': return defineAsyncComponent(() => import('./profile.vue'));
|
||||
case 'privacy': return defineAsyncComponent(() => import('./privacy.vue'));
|
||||
@@ -192,6 +209,9 @@ const component = computed(() => {
|
||||
case 'security': return defineAsyncComponent(() => import('./security.vue'));
|
||||
case '2fa': return defineAsyncComponent(() => import('./2fa.vue'));
|
||||
case 'api': return defineAsyncComponent(() => import('./api.vue'));
|
||||
case 'webhook': return defineAsyncComponent(() => import('./webhook.vue'));
|
||||
case 'webhook/new': return defineAsyncComponent(() => import('./webhook.new.vue'));
|
||||
case 'webhook/edit': return defineAsyncComponent(() => import('./webhook.edit.vue'));
|
||||
case 'apps': return defineAsyncComponent(() => import('./apps.vue'));
|
||||
case 'other': return defineAsyncComponent(() => import('./other.vue'));
|
||||
case 'general': return defineAsyncComponent(() => import('./general.vue'));
|
||||
@@ -222,27 +242,41 @@ watch(component, () => {
|
||||
|
||||
watch(() => props.initialPage, () => {
|
||||
if (props.initialPage == null && !narrow.value) {
|
||||
page.value = 'profile';
|
||||
nav.push('/settings/profile');
|
||||
} else {
|
||||
page.value = props.initialPage;
|
||||
if (props.initialPage == null) {
|
||||
INFO.value = indexInfo;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
narrow.value = el.value.offsetWidth < 800;
|
||||
if (!narrow.value) {
|
||||
page.value = 'profile';
|
||||
watch(narrow, () => {
|
||||
if (props.initialPage == null && !narrow.value) {
|
||||
nav.push('/settings/profile');
|
||||
}
|
||||
});
|
||||
|
||||
onMounted(() => {
|
||||
ro.observe(el.value);
|
||||
|
||||
narrow.value = el.value.offsetWidth < NARROW_THRESHOLD;
|
||||
if (props.initialPage == null && !narrow.value) {
|
||||
nav.push('/settings/profile');
|
||||
}
|
||||
});
|
||||
|
||||
onUnmounted(() => {
|
||||
ro.disconnect();
|
||||
});
|
||||
|
||||
const emailNotConfigured = computed(() => instance.enableEmail && ($i.email == null || !$i.emailVerified));
|
||||
|
||||
const pageChanged = (page) => {
|
||||
if (page == null) return;
|
||||
childInfo.value = page[symbols.PAGE_INFO];
|
||||
if (page == null) {
|
||||
childInfo.value = null;
|
||||
} else {
|
||||
childInfo.value = page[symbols.PAGE_INFO];
|
||||
}
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
@@ -259,6 +293,7 @@ defineExpose({
|
||||
font-weight: bold;
|
||||
|
||||
> .title {
|
||||
display: block;
|
||||
width: 34%;
|
||||
}
|
||||
|
||||
|
89
packages/client/src/pages/settings/webhook.edit.vue
Normal file
89
packages/client/src/pages/settings/webhook.edit.vue
Normal file
@@ -0,0 +1,89 @@
|
||||
<template>
|
||||
<div class="_formRoot">
|
||||
<FormInput v-model="name" class="_formBlock">
|
||||
<template #label>Name</template>
|
||||
</FormInput>
|
||||
|
||||
<FormInput v-model="url" type="url" class="_formBlock">
|
||||
<template #label>URL</template>
|
||||
</FormInput>
|
||||
|
||||
<FormInput v-model="secret" class="_formBlock">
|
||||
<template #prefix><i class="fas fa-lock"></i></template>
|
||||
<template #label>Secret</template>
|
||||
</FormInput>
|
||||
|
||||
<FormSection>
|
||||
<template #label>Events</template>
|
||||
|
||||
<FormSwitch v-model="event_follow" class="_formBlock">Follow</FormSwitch>
|
||||
<FormSwitch v-model="event_followed" class="_formBlock">Followed</FormSwitch>
|
||||
<FormSwitch v-model="event_note" class="_formBlock">Note</FormSwitch>
|
||||
<FormSwitch v-model="event_reply" class="_formBlock">Reply</FormSwitch>
|
||||
<FormSwitch v-model="event_renote" class="_formBlock">Renote</FormSwitch>
|
||||
<FormSwitch v-model="event_reaction" class="_formBlock">Reaction</FormSwitch>
|
||||
<FormSwitch v-model="event_mention" class="_formBlock">Mention</FormSwitch>
|
||||
</FormSection>
|
||||
|
||||
<FormSwitch v-model="active" class="_formBlock">Active</FormSwitch>
|
||||
|
||||
<div class="_formBlock" style="display: flex; gap: var(--margin); flex-wrap: wrap;">
|
||||
<FormButton primary inline @click="save"><i class="fas fa-check"></i> {{ i18n.ts.save }}</FormButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import FormInput from '@/components/form/input.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import FormSwitch from '@/components/form/switch.vue';
|
||||
import FormButton from '@/components/ui/button.vue';
|
||||
import * as os from '@/os';
|
||||
import * as symbols from '@/symbols';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
const webhook = await os.api('i/webhooks/show', {
|
||||
webhookId: new URLSearchParams(window.location.search).get('id')
|
||||
});
|
||||
|
||||
let name = $ref(webhook.name);
|
||||
let url = $ref(webhook.url);
|
||||
let secret = $ref(webhook.secret);
|
||||
let active = $ref(webhook.active);
|
||||
|
||||
let event_follow = $ref(webhook.on.includes('follow'));
|
||||
let event_followed = $ref(webhook.on.includes('followed'));
|
||||
let event_note = $ref(webhook.on.includes('note'));
|
||||
let event_reply = $ref(webhook.on.includes('reply'));
|
||||
let event_renote = $ref(webhook.on.includes('renote'));
|
||||
let event_reaction = $ref(webhook.on.includes('reaction'));
|
||||
let event_mention = $ref(webhook.on.includes('mention'));
|
||||
|
||||
async function save(): Promise<void> {
|
||||
const events = [];
|
||||
if (event_follow) events.push('follow');
|
||||
if (event_followed) events.push('followed');
|
||||
if (event_note) events.push('note');
|
||||
if (event_reply) events.push('reply');
|
||||
if (event_renote) events.push('renote');
|
||||
if (event_reaction) events.push('reaction');
|
||||
if (event_mention) events.push('mention');
|
||||
|
||||
os.apiWithDialog('i/webhooks/update', {
|
||||
name,
|
||||
url,
|
||||
secret,
|
||||
on: events,
|
||||
active,
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: 'Edit webhook',
|
||||
icon: 'fas fa-bolt',
|
||||
bg: 'var(--bg)',
|
||||
},
|
||||
});
|
||||
</script>
|
81
packages/client/src/pages/settings/webhook.new.vue
Normal file
81
packages/client/src/pages/settings/webhook.new.vue
Normal file
@@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<div class="_formRoot">
|
||||
<FormInput v-model="name" class="_formBlock">
|
||||
<template #label>Name</template>
|
||||
</FormInput>
|
||||
|
||||
<FormInput v-model="url" type="url" class="_formBlock">
|
||||
<template #label>URL</template>
|
||||
</FormInput>
|
||||
|
||||
<FormInput v-model="secret" class="_formBlock">
|
||||
<template #prefix><i class="fas fa-lock"></i></template>
|
||||
<template #label>Secret</template>
|
||||
</FormInput>
|
||||
|
||||
<FormSection>
|
||||
<template #label>Events</template>
|
||||
|
||||
<FormSwitch v-model="event_follow" class="_formBlock">Follow</FormSwitch>
|
||||
<FormSwitch v-model="event_followed" class="_formBlock">Followed</FormSwitch>
|
||||
<FormSwitch v-model="event_note" class="_formBlock">Note</FormSwitch>
|
||||
<FormSwitch v-model="event_reply" class="_formBlock">Reply</FormSwitch>
|
||||
<FormSwitch v-model="event_renote" class="_formBlock">Renote</FormSwitch>
|
||||
<FormSwitch v-model="event_reaction" class="_formBlock">Reaction</FormSwitch>
|
||||
<FormSwitch v-model="event_mention" class="_formBlock">Mention</FormSwitch>
|
||||
</FormSection>
|
||||
|
||||
<div class="_formBlock" style="display: flex; gap: var(--margin); flex-wrap: wrap;">
|
||||
<FormButton primary inline @click="create"><i class="fas fa-check"></i> {{ i18n.ts.create }}</FormButton>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import FormInput from '@/components/form/input.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import FormSwitch from '@/components/form/switch.vue';
|
||||
import FormButton from '@/components/ui/button.vue';
|
||||
import * as os from '@/os';
|
||||
import * as symbols from '@/symbols';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
let name = $ref('');
|
||||
let url = $ref('');
|
||||
let secret = $ref('');
|
||||
|
||||
let event_follow = $ref(true);
|
||||
let event_followed = $ref(true);
|
||||
let event_note = $ref(true);
|
||||
let event_reply = $ref(true);
|
||||
let event_renote = $ref(true);
|
||||
let event_reaction = $ref(true);
|
||||
let event_mention = $ref(true);
|
||||
|
||||
async function create(): Promise<void> {
|
||||
const events = [];
|
||||
if (event_follow) events.push('follow');
|
||||
if (event_followed) events.push('followed');
|
||||
if (event_note) events.push('note');
|
||||
if (event_reply) events.push('reply');
|
||||
if (event_renote) events.push('renote');
|
||||
if (event_reaction) events.push('reaction');
|
||||
if (event_mention) events.push('mention');
|
||||
|
||||
os.apiWithDialog('i/webhooks/create', {
|
||||
name,
|
||||
url,
|
||||
secret,
|
||||
on: events,
|
||||
});
|
||||
}
|
||||
|
||||
defineExpose({
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: 'Create new webhook',
|
||||
icon: 'fas fa-bolt',
|
||||
bg: 'var(--bg)',
|
||||
},
|
||||
});
|
||||
</script>
|
52
packages/client/src/pages/settings/webhook.vue
Normal file
52
packages/client/src/pages/settings/webhook.vue
Normal file
@@ -0,0 +1,52 @@
|
||||
<template>
|
||||
<div class="_formRoot">
|
||||
<FormSection>
|
||||
<FormLink :to="`/settings/webhook/new`">
|
||||
Create webhook
|
||||
</FormLink>
|
||||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
<MkPagination :pagination="pagination">
|
||||
<template v-slot="{items}">
|
||||
<FormLink v-for="webhook in items" :key="webhook.id" :to="`/settings/webhook/edit?id=${webhook.id}`" class="_formBlock">
|
||||
<template #icon>
|
||||
<i v-if="webhook.active === false" class="fas fa-circle-pause"></i>
|
||||
<i v-else-if="webhook.latestStatus === null" class="far fa-circle"></i>
|
||||
<i v-else-if="[200, 201, 204].includes(webhook.latestStatus)" class="fas fa-check" :style="{ color: 'var(--success)' }"></i>
|
||||
<i v-else class="fas fa-triangle-exclamation" :style="{ color: 'var(--error)' }"></i>
|
||||
</template>
|
||||
{{ webhook.name || webhook.url }}
|
||||
<template #suffix>
|
||||
<MkTime v-if="webhook.latestSentAt" :time="webhook.latestSentAt"></MkTime>
|
||||
</template>
|
||||
</FormLink>
|
||||
</template>
|
||||
</MkPagination>
|
||||
</FormSection>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import MkPagination from '@/components/ui/pagination.vue';
|
||||
import FormSection from '@/components/form/section.vue';
|
||||
import FormLink from '@/components/form/link.vue';
|
||||
import { userPage } from '@/filters/user';
|
||||
import * as os from '@/os';
|
||||
import * as symbols from '@/symbols';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
const pagination = {
|
||||
endpoint: 'i/webhooks/list' as const,
|
||||
limit: 10,
|
||||
};
|
||||
|
||||
defineExpose({
|
||||
[symbols.PAGE_INFO]: {
|
||||
title: 'Webhook',
|
||||
icon: 'fas fa-bolt',
|
||||
bg: 'var(--bg)',
|
||||
},
|
||||
});
|
||||
</script>
|
@@ -141,6 +141,7 @@ import number from '@/filters/number';
|
||||
import { userPage, acct as getAcct } from '@/filters/user';
|
||||
import * as os from '@/os';
|
||||
import * as symbols from '@/symbols';
|
||||
import { MisskeyNavigator } from '@/scripts/navigate';
|
||||
|
||||
export default defineComponent({
|
||||
components: {
|
||||
@@ -190,33 +191,34 @@ export default defineComponent({
|
||||
active: this.page === 'index',
|
||||
title: this.$ts.overview,
|
||||
icon: 'fas fa-home',
|
||||
onClick: () => { this.$router.push('/@' + getAcct(this.user)); },
|
||||
onClick: () => { this.mkNav.push('/@' + getAcct(this.user)); },
|
||||
}, ...(this.$i && (this.$i.id === this.user.id)) || this.user.publicReactions ? [{
|
||||
active: this.page === 'reactions',
|
||||
title: this.$ts.reaction,
|
||||
icon: 'fas fa-laugh',
|
||||
onClick: () => { this.$router.push('/@' + getAcct(this.user) + '/reactions'); },
|
||||
onClick: () => { this.mkNav.push('/@' + getAcct(this.user) + '/reactions'); },
|
||||
}] : [], {
|
||||
active: this.page === 'clips',
|
||||
title: this.$ts.clips,
|
||||
icon: 'fas fa-paperclip',
|
||||
onClick: () => { this.$router.push('/@' + getAcct(this.user) + '/clips'); },
|
||||
onClick: () => { this.mkNav.push('/@' + getAcct(this.user) + '/clips'); },
|
||||
}, {
|
||||
active: this.page === 'pages',
|
||||
title: this.$ts.pages,
|
||||
icon: 'fas fa-file-alt',
|
||||
onClick: () => { this.$router.push('/@' + getAcct(this.user) + '/pages'); },
|
||||
onClick: () => { this.mkNav.push('/@' + getAcct(this.user) + '/pages'); },
|
||||
}, {
|
||||
active: this.page === 'gallery',
|
||||
title: this.$ts.gallery,
|
||||
icon: 'fas fa-icons',
|
||||
onClick: () => { this.$router.push('/@' + getAcct(this.user) + '/gallery'); },
|
||||
onClick: () => { this.mkNav.push('/@' + getAcct(this.user) + '/gallery'); },
|
||||
}],
|
||||
} : null),
|
||||
user: null,
|
||||
error: null,
|
||||
parallaxAnimationId: null,
|
||||
narrow: null,
|
||||
mkNav: new MisskeyNavigator(),
|
||||
};
|
||||
},
|
||||
|
||||
|
34
packages/client/src/scripts/navigate.ts
Normal file
34
packages/client/src/scripts/navigate.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { inject } from 'vue';
|
||||
import { router } from '@/router';
|
||||
import { defaultStore } from '@/store';
|
||||
|
||||
export type Navigate = (path: string, record?: boolean) => void;
|
||||
|
||||
export class MisskeyNavigator {
|
||||
public readonly navHook: Navigate | null = null;
|
||||
public readonly sideViewHook: Navigate | null = null;
|
||||
|
||||
// It should be constructed during vue creating in order for inject function to work
|
||||
constructor() {
|
||||
this.navHook = inject<Navigate | null>('navHook', null);
|
||||
this.sideViewHook = inject<Navigate | null>('sideViewHook', null);
|
||||
}
|
||||
|
||||
// Use this method instead of router.push()
|
||||
public push(path: string, record = true) {
|
||||
if (this.navHook) {
|
||||
this.navHook(path, record);
|
||||
} else {
|
||||
if (defaultStore.state.defaultSideView && this.sideViewHook && path !== '/') {
|
||||
return this.sideViewHook(path, record);
|
||||
}
|
||||
|
||||
if (router.currentRoute.value.path === path) {
|
||||
window.scroll({ top: 0, behavior: 'smooth' });
|
||||
} else {
|
||||
if (record) router.push(path);
|
||||
else router.replace(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -51,14 +51,14 @@ export function applyTheme(theme: Theme, persist = true) {
|
||||
|
||||
if (_theme.base) {
|
||||
const base = [lightTheme, darkTheme].find(x => x.id === _theme.base);
|
||||
_theme.props = Object.assign({}, base.props, _theme.props);
|
||||
if (base) _theme.props = Object.assign({}, base.props, _theme.props);
|
||||
}
|
||||
|
||||
const props = compile(_theme);
|
||||
|
||||
for (const tag of document.head.children) {
|
||||
if (tag.tagName === 'META' && tag.getAttribute('name') === 'theme-color') {
|
||||
tag.setAttribute('content', props['html']);
|
||||
tag.setAttribute('content', props['htmlThemeColor']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -128,8 +128,8 @@ if (deckStore.state.navWindow) {
|
||||
document.documentElement.style.overflowY = 'hidden';
|
||||
document.documentElement.style.scrollBehavior = 'auto';
|
||||
window.addEventListener('wheel', (ev) => {
|
||||
if (getScrollContainer(ev.target as HTMLElement) == null) {
|
||||
document.documentElement.scrollLeft += ev.deltaY > 0 ? 96 : -96;
|
||||
if (getScrollContainer(ev.target as HTMLElement) == null && ev.deltaX === 0) {
|
||||
document.documentElement.scrollLeft += ev.deltaY;
|
||||
}
|
||||
});
|
||||
loadDeck();
|
||||
|
@@ -372,9 +372,9 @@ function onDrop(e) {
|
||||
|
||||
> div {
|
||||
height: calc(100% - var(--deckColumnHeaderHeight));
|
||||
overflow: auto;
|
||||
overflow-x: hidden;
|
||||
overscroll-behavior: contain;
|
||||
overflow-y: auto;
|
||||
overflow-x: hidden; // Safari does not supports clip
|
||||
overflow-x: clip;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
Reference in New Issue
Block a user