Merge remote-tracking branch 'misskey/develop' into future-2024-03-23
This commit is contained in:
commit
bc531ac414
70 changed files with 1770 additions and 838 deletions
|
@ -61,7 +61,7 @@
|
|||
"rollup": "4.12.0",
|
||||
"sanitize-html": "2.12.1",
|
||||
"sass": "1.71.1",
|
||||
"shiki": "1.1.7",
|
||||
"shiki": "1.2.0",
|
||||
"strict-event-emitter-types": "2.0.0",
|
||||
"textarea-caret": "3.1.0",
|
||||
"three": "0.162.0",
|
||||
|
|
|
@ -145,8 +145,11 @@ export async function common(createVue: () => App<Element>) {
|
|||
// NOTE: この処理は必ずクライアント更新チェック処理より後に来ること(テーマ再構築のため)
|
||||
watch(defaultStore.reactiveState.darkMode, (darkMode) => {
|
||||
applyTheme(darkMode ? ColdDeviceStorage.get('darkTheme') : ColdDeviceStorage.get('lightTheme'));
|
||||
document.documentElement.dataset.colorMode = darkMode ? 'dark' : 'light';
|
||||
}, { immediate: miLocalStorage.getItem('theme') == null });
|
||||
|
||||
document.documentElement.dataset.colorMode = defaultStore.state.darkMode ? 'dark' : 'light';
|
||||
|
||||
const darkTheme = computed(ColdDeviceStorage.makeGetterSetter('darkTheme'));
|
||||
const lightTheme = computed(ColdDeviceStorage.makeGetterSetter('lightTheme'));
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch } from 'vue';
|
||||
import { bundledLanguagesInfo } from 'shiki';
|
||||
import type { BuiltinLanguage } from 'shiki';
|
||||
import { computed, ref, watch } from 'vue';
|
||||
import { bundledLanguagesInfo } from 'shiki/langs';
|
||||
import type { BundledLanguage } from 'shiki/langs';
|
||||
import { getHighlighter, getTheme } from '@/scripts/code-highlighter.js';
|
||||
import { defaultStore } from '@/store.js';
|
||||
|
||||
|
@ -23,7 +23,7 @@ const props = defineProps<{
|
|||
|
||||
const highlighter = await getHighlighter();
|
||||
const darkMode = defaultStore.reactiveState.darkMode;
|
||||
const codeLang = ref<BuiltinLanguage | 'aiscript'>('js');
|
||||
const codeLang = ref<BundledLanguage | 'aiscript'>('js');
|
||||
|
||||
const [lightThemeName, darkThemeName] = await Promise.all([
|
||||
getTheme('light', true),
|
||||
|
@ -42,7 +42,7 @@ const html = computed(() => highlighter.codeToHtml(props.code, {
|
|||
}));
|
||||
|
||||
async function fetchLanguage(to: string): Promise<void> {
|
||||
const language = to as BuiltinLanguage;
|
||||
const language = to as BundledLanguage;
|
||||
|
||||
// Check for the loaded languages, and load the language if it's not loaded yet.
|
||||
if (!highlighter.getLoadedLanguages().includes(language)) {
|
||||
|
|
|
@ -22,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
:autocomplete="autocomplete"
|
||||
:autocapitalize="autocapitalize"
|
||||
:spellcheck="spellcheck"
|
||||
:inputmode="inputmode"
|
||||
:step="step"
|
||||
:list="id"
|
||||
:min="min"
|
||||
|
@ -63,6 +64,7 @@ const props = defineProps<{
|
|||
mfmAutocomplete?: boolean | SuggestionType[],
|
||||
autocapitalize?: string;
|
||||
spellcheck?: boolean;
|
||||
inputmode?: 'none' | 'text' | 'search' | 'email' | 'url' | 'numeric' | 'tel' | 'decimal';
|
||||
step?: any;
|
||||
datalist?: string[];
|
||||
min?: number;
|
||||
|
|
|
@ -19,6 +19,7 @@ import { defineAsyncComponent, ref } from 'vue';
|
|||
import { url as local } from '@/config.js';
|
||||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||
import * as os from '@/os.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
url: string;
|
||||
|
@ -32,13 +33,15 @@ const target = self ? null : '_blank';
|
|||
|
||||
const el = ref<HTMLElement | { $el: HTMLElement }>();
|
||||
|
||||
useTooltip(el, (showing) => {
|
||||
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
||||
showing,
|
||||
url: props.url,
|
||||
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||
}, {}, 'closed');
|
||||
});
|
||||
if (isEnabledUrlPreview.value) {
|
||||
useTooltip(el, (showing) => {
|
||||
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
||||
showing,
|
||||
url: props.url,
|
||||
source: el.value instanceof HTMLElement ? el.value : el.value?.$el,
|
||||
}, {}, 'closed');
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
|
|
|
@ -86,7 +86,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkMediaList :mediaList="appearNote.files" @click.stop/>
|
||||
</div>
|
||||
<MkPoll v-if="appearNote.poll" :noteId="appearNote.id" :poll="appearNote.poll" :class="$style.poll" @click.stop/>
|
||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview" @click.stop/>
|
||||
<div v-if="isEnabledUrlPreview">
|
||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="false" :class="$style.urlPreview" @click.stop/>
|
||||
</div>
|
||||
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote"/></div>
|
||||
<button v-if="isLong && collapsed" :class="$style.collapsed" class="_button" @click.stop @click="collapsed = false">
|
||||
<span :class="$style.collapsedLabel">{{ i18n.ts.showMore }}</span>
|
||||
|
@ -184,6 +186,7 @@ import MkNoteSub from '@/components/MkNoteSub.vue';
|
|||
import MkNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||
import MkReactionsViewerDetails from '@/components/MkReactionsViewer.details.vue';
|
||||
import MkMediaList from '@/components/MkMediaList.vue';
|
||||
import MkCwButton from '@/components/MkCwButton.vue';
|
||||
import MkPoll from '@/components/MkPoll.vue';
|
||||
|
@ -198,7 +201,7 @@ import { userPage } from '@/filters/user.js';
|
|||
import number from '@/filters/number.js';
|
||||
import * as os from '@/os.js';
|
||||
import * as sound from '@/scripts/sound.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||
import { defaultStore, noteViewInterruptors } from '@/store.js';
|
||||
import { reactionPicker } from '@/scripts/reaction-picker.js';
|
||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
||||
|
@ -218,6 +221,7 @@ import { showMovedDialog } from '@/scripts/show-moved-dialog.js';
|
|||
import { shouldCollapsed } from '@/scripts/collapsed.js';
|
||||
import { useRouter } from '@/router/supplier.js';
|
||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
note: Misskey.entities.Note;
|
||||
|
@ -306,7 +310,7 @@ const renoteCollapsed = ref(
|
|||
defaultStore.state.collapseRenotes && isRenote && (
|
||||
($i && ($i.id === note.value.userId || $i.id === appearNote.value.userId)) || // `||` must be `||`! See https://github.com/misskey-dev/misskey/issues/13131
|
||||
(appearNote.value.myReaction != null)
|
||||
)
|
||||
),
|
||||
);
|
||||
const defaultLike = computed(() => defaultStore.state.like ? defaultStore.state.like : null);
|
||||
const animated = computed(() => parsed.value ? checkAnimationFromMfm(parsed.value) : null);
|
||||
|
@ -407,6 +411,28 @@ if (!props.mock) {
|
|||
renoted.value = res.length > 0;
|
||||
});
|
||||
}
|
||||
|
||||
if (appearNote.value.reactionAcceptance === 'likeOnly') {
|
||||
useTooltip(reactButton, async (showing) => {
|
||||
const reactions = await misskeyApiGet('notes/reactions', {
|
||||
noteId: appearNote.value.id,
|
||||
limit: 10,
|
||||
_cacheKey_: appearNote.value.reactionCount,
|
||||
});
|
||||
|
||||
const users = reactions.map(x => x.user);
|
||||
|
||||
if (users.length < 1) return;
|
||||
|
||||
os.popup(MkReactionsViewerDetails, {
|
||||
showing,
|
||||
reaction: '❤️',
|
||||
users,
|
||||
count: appearNote.value.reactionCount,
|
||||
targetElement: reactButton.value!,
|
||||
}, {}, 'closed');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function boostVisibility() {
|
||||
|
|
|
@ -99,7 +99,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkMediaList :mediaList="appearNote.files"/>
|
||||
</div>
|
||||
<MkPoll v-if="appearNote.poll" ref="pollViewer" :noteId="appearNote.id" :poll="appearNote.poll" :class="$style.poll"/>
|
||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="true" style="margin-top: 6px;"/>
|
||||
<div v-if="isEnabledUrlPreview">
|
||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url" :compact="true" :detail="true" style="margin-top: 6px;"/>
|
||||
</div>
|
||||
<div v-if="appearNote.renote" :class="$style.quote"><MkNoteSimple :note="appearNote.renote" :class="$style.quoteNote" :expandAllCws="props.expandAllCws"/></div>
|
||||
</div>
|
||||
<MkA v-if="appearNote.channel && !inChannel" :class="$style.channel" :to="`/channels/${appearNote.channel.id}`"><i class="ph-television ph-bold ph-lg"></i> {{ appearNote.channel.name }}</MkA>
|
||||
|
@ -226,6 +228,7 @@ import * as Misskey from 'misskey-js';
|
|||
import MkNoteSub from '@/components/MkNoteSub.vue';
|
||||
import MkNoteSimple from '@/components/MkNoteSimple.vue';
|
||||
import MkReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||
import MkReactionsViewerDetails from '@/components/MkReactionsViewer.details.vue';
|
||||
import MkMediaList from '@/components/MkMediaList.vue';
|
||||
import MkCwButton from '@/components/MkCwButton.vue';
|
||||
import MkPoll from '@/components/MkPoll.vue';
|
||||
|
@ -238,7 +241,7 @@ import { userPage } from '@/filters/user.js';
|
|||
import { notePage } from '@/filters/note.js';
|
||||
import number from '@/filters/number.js';
|
||||
import * as os from '@/os.js';
|
||||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { misskeyApi, misskeyApiGet } from '@/scripts/misskey-api.js';
|
||||
import * as sound from '@/scripts/sound.js';
|
||||
import { defaultStore, noteViewInterruptors } from '@/store.js';
|
||||
import { reactionPicker } from '@/scripts/reaction-picker.js';
|
||||
|
@ -259,6 +262,7 @@ import MkPagination, { type Paging } from '@/components/MkPagination.vue';
|
|||
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import { boostMenuItems, type Visibility } from '@/scripts/boost-quote.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
|
||||
const props = defineProps<{
|
||||
note: Misskey.entities.Note;
|
||||
|
@ -439,6 +443,28 @@ function boostVisibility() {
|
|||
}
|
||||
}
|
||||
|
||||
if (appearNote.value.reactionAcceptance === 'likeOnly') {
|
||||
useTooltip(reactButton, async (showing) => {
|
||||
const reactions = await misskeyApiGet('notes/reactions', {
|
||||
noteId: appearNote.value.id,
|
||||
limit: 10,
|
||||
_cacheKey_: appearNote.value.reactionCount,
|
||||
});
|
||||
|
||||
const users = reactions.map(x => x.user);
|
||||
|
||||
if (users.length < 1) return;
|
||||
|
||||
os.popup(MkReactionsViewerDetails, {
|
||||
showing,
|
||||
reaction: '❤️',
|
||||
users,
|
||||
count: appearNote.value.reactionCount,
|
||||
targetElement: reactButton.value!,
|
||||
}, {}, 'closed');
|
||||
});
|
||||
}
|
||||
|
||||
function renote(visibility: Visibility, localOnly: boolean = false) {
|
||||
pleaseLogin();
|
||||
showMovedDialog();
|
||||
|
|
|
@ -19,18 +19,21 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div style="margin-top: 16px;">{{ i18n.ts.authenticationRequiredToContinue }}</div>
|
||||
</div>
|
||||
|
||||
<div class="_gaps">
|
||||
<MkInput ref="passwordInput" v-model="password" :placeholder="i18n.ts.password" type="password" autocomplete="current-password webauthn" :withPasswordToggle="true">
|
||||
<template #prefix><i class="ph-password ph-bold ph-lg"></i></template>
|
||||
</MkInput>
|
||||
<form @submit.prevent="done">
|
||||
<div class="_gaps">
|
||||
<MkInput ref="passwordInput" v-model="password" :placeholder="i18n.ts.password" type="password" autocomplete="current-password webauthn" required :withPasswordToggle="true">
|
||||
<template #prefix><i class="ph-password ph-bold ph-lg"></i></template>
|
||||
</MkInput>
|
||||
|
||||
<MkInput v-if="$i.twoFactorEnabled" v-model="token" type="text" pattern="^([0-9]{6}|[A-Z0-9]{32})$" autocomplete="one-time-code" :spellcheck="false">
|
||||
<template #label>{{ i18n.ts.token }} ({{ i18n.ts['2fa'] }})</template>
|
||||
<template #prefix><i class="ph-keyhole ph-bold ph-lg"></i></template>
|
||||
</MkInput>
|
||||
<MkInput v-if="$i.twoFactorEnabled" v-model="token" type="text" :pattern="isBackupCode ? '^[A-Z0-9]{32}$' :'^[0-9]{6}$'" autocomplete="one-time-code" required :spellcheck="false" :inputmode="isBackupCode ? undefined : 'numeric'">
|
||||
<template #label>{{ i18n.ts.token }} ({{ i18n.ts['2fa'] }})</template>
|
||||
<template #prefix><i v-if="isBackupCode" class="ph-keyhole ph-bold ph-lg"></i><i v-else class="ph-math-operations ph-bold ph-lg"></i></template>
|
||||
<template #caption><button class="_textButton" type="button" @click="isBackupCode = !isBackupCode">{{ isBackupCode ? i18n.ts.useTotp : i18n.ts.useBackupCode }}</button></template>
|
||||
</MkInput>
|
||||
|
||||
<MkButton :disabled="(password ?? '') == '' || ($i.twoFactorEnabled && (token ?? '') == '')" primary rounded style="margin: 0 auto;" @click="done"><i class="ph-lock ph-bold ph-lg-open"></i> {{ i18n.ts.continue }}</MkButton>
|
||||
</div>
|
||||
<MkButton :disabled="(password ?? '') == '' || ($i.twoFactorEnabled && (token ?? '') == '')" type="submit" primary rounded style="margin: 0 auto;"><i class="ph-lock ph-bold ph-lg-open"></i> {{ i18n.ts.continue }}</MkButton>
|
||||
</div>
|
||||
</form>
|
||||
</MkSpacer>
|
||||
</MkModalWindow>
|
||||
</template>
|
||||
|
@ -54,6 +57,7 @@ const emit = defineEmits<{
|
|||
const dialog = shallowRef<InstanceType<typeof MkModalWindow>>();
|
||||
const passwordInput = shallowRef<InstanceType<typeof MkInput>>();
|
||||
const password = ref('');
|
||||
const isBackupCode = ref(false);
|
||||
const token = ref<string | null>(null);
|
||||
|
||||
function onClose() {
|
||||
|
@ -61,7 +65,7 @@ function onClose() {
|
|||
if (dialog.value) dialog.value.close();
|
||||
}
|
||||
|
||||
function done(res) {
|
||||
function done() {
|
||||
emit('done', { password: password.value, token: token.value });
|
||||
if (dialog.value) dialog.value.close();
|
||||
}
|
||||
|
|
|
@ -31,15 +31,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div v-if="user && user.securityKeys" class="or-hr">
|
||||
<p class="or-msg">{{ i18n.ts.or }}</p>
|
||||
</div>
|
||||
<div class="twofa-group totp-group">
|
||||
<p style="margin-bottom:0;">{{ i18n.ts['2fa'] }}</p>
|
||||
<div class="twofa-group totp-group _gaps">
|
||||
<MkInput v-if="user && user.usePasswordLessLogin" v-model="password" type="password" autocomplete="current-password" :withPasswordToggle="true" required>
|
||||
<template #label>{{ i18n.ts.password }}</template>
|
||||
<template #prefix><i class="ph-lock ph-bold ph-lg"></i></template>
|
||||
</MkInput>
|
||||
<MkInput v-model="token" type="text" pattern="^([0-9]{6}|[A-Z0-9]{32})$" autocomplete="one-time-code" :spellcheck="false" required>
|
||||
<template #label>{{ i18n.ts.token }}</template>
|
||||
<template #prefix><i class="ph-keyhole ph-bold ph-lg"></i></template>
|
||||
<MkInput v-model="token" type="text" :pattern="isBackupCode ? '^[A-Z0-9]{32}$' :'^[0-9]{6}$'" autocomplete="one-time-code" required :spellcheck="false" :inputmode="isBackupCode ? undefined : 'numeric'">
|
||||
<template #label>{{ i18n.ts.token }} ({{ i18n.ts['2fa'] }})</template>
|
||||
<template #prefix><i v-if="isBackupCode" class="ph-keyhole ph-bold ph-lg"></i><i v-else class="ph-math-operations ph-bold ph-lg"></i></template>
|
||||
<template #caption><button class="_textButton" type="button" @click="isBackupCode = !isBackupCode">{{ isBackupCode ? i18n.ts.useTotp : i18n.ts.useBackupCode }}</button></template>
|
||||
</MkInput>
|
||||
<MkButton type="submit" :disabled="signing" large primary rounded style="margin: 0 auto;">{{ signing ? i18n.ts.loggingIn : i18n.ts.login }}</MkButton>
|
||||
</div>
|
||||
|
@ -70,6 +70,7 @@ const password = ref('');
|
|||
const token = ref('');
|
||||
const host = ref(toUnicode(configHost));
|
||||
const totpLogin = ref(false);
|
||||
const isBackupCode = ref(false);
|
||||
const queryingKey = ref(false);
|
||||
const credentialRequest = ref<CredentialRequestOptions | null>(null);
|
||||
|
||||
|
|
|
@ -152,15 +152,16 @@ requestUrl.hash = '';
|
|||
window.fetch(`/url?url=${encodeURIComponent(requestUrl.href)}&lang=${versatileLang}`)
|
||||
.then(res => {
|
||||
if (!res.ok) {
|
||||
fetching.value = false;
|
||||
unknownUrl.value = true;
|
||||
return;
|
||||
if (_DEV_) {
|
||||
console.warn(`[HTTP${res.status}] Failed to fetch url preview`);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
return res.json();
|
||||
})
|
||||
.then((info: SummalyResult) => {
|
||||
if (info.url == null) {
|
||||
.then((info: SummalyResult | null) => {
|
||||
if (!info || info.url == null) {
|
||||
fetching.value = false;
|
||||
unknownUrl.value = true;
|
||||
return;
|
||||
|
|
|
@ -31,6 +31,7 @@ import { url as local } from '@/config.js';
|
|||
import * as os from '@/os.js';
|
||||
import { useTooltip } from '@/scripts/use-tooltip.js';
|
||||
import { safeURIDecode } from '@/scripts/safe-uri-decode.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
url: string;
|
||||
|
@ -45,7 +46,7 @@ const url = new URL(props.url);
|
|||
if (!['http:', 'https:'].includes(url.protocol)) throw new Error('invalid url');
|
||||
const el = ref();
|
||||
|
||||
if (props.showUrlPreview) {
|
||||
if (props.showUrlPreview && isEnabledUrlPreview.value) {
|
||||
useTooltip(el, (showing) => {
|
||||
os.popup(defineAsyncComponent(() => import('@/components/MkUrlPreviewPopup.vue')), {
|
||||
showing,
|
||||
|
|
|
@ -4,19 +4,15 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<MediaImage
|
||||
v-if="image"
|
||||
:image="image"
|
||||
:disableImageLink="true"
|
||||
/>
|
||||
<div :class="$style.root">
|
||||
<MkMediaList v-if="image" :mediaList="[image]" :class="$style.mediaList"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import MediaImage from '@/components/MkMediaImage.vue';
|
||||
import MkMediaList from '@/components/MkMediaList.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
block: Misskey.entities.PageBlock,
|
||||
|
@ -28,5 +24,17 @@ const image = ref<Misskey.entities.DriveFile | null>(null);
|
|||
onMounted(() => {
|
||||
image.value = props.page.attachedFiles.find(x => x.id === props.block.fileId) ?? null;
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.root {
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
}
|
||||
.mediaList {
|
||||
// MkMediaList 内の上部マージン 4px
|
||||
margin-top: -4px;
|
||||
height: calc(100% + 4px);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -4,9 +4,9 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div style="margin: 1em 0;">
|
||||
<MkNote v-if="note && !block.detailed" :key="note.id + ':normal'" v-model:note="note"/>
|
||||
<MkNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" v-model:note="note"/>
|
||||
<div :class="$style.root">
|
||||
<MkNote v-if="note && !block.detailed" :key="note.id + ':normal'" :note="note"/>
|
||||
<MkNoteDetailed v-if="note && block.detailed" :key="note.id + ':detail'" :note="note"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -32,3 +32,10 @@ onMounted(() => {
|
|||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.root {
|
||||
border: 1px solid var(--divider);
|
||||
border-radius: var(--radius);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -4,9 +4,11 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div class="_gaps">
|
||||
<div class="_gaps" :class="$style.textRoot">
|
||||
<Mfm :text="block.text ?? ''" :isNote="false"/>
|
||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
|
||||
<div v-if="isEnabledUrlPreview">
|
||||
<MkUrlPreview v-for="url in urls" :key="url" :url="url"/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@ -15,6 +17,7 @@ import { defineAsyncComponent } from 'vue';
|
|||
import * as mfm from '@transfem-org/sfm-js';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import { extractUrlFromMfm } from '@/scripts/extract-url-from-mfm.js';
|
||||
import { isEnabledUrlPreview } from '@/instance.js';
|
||||
|
||||
const MkUrlPreview = defineAsyncComponent(() => import('@/components/MkUrlPreview.vue'));
|
||||
|
||||
|
@ -25,3 +28,9 @@ const props = defineProps<{
|
|||
|
||||
const urls = props.block.text ? extractUrlFromMfm(mfm.parse(props.block.text)) : [];
|
||||
</script>
|
||||
|
||||
<style lang="scss" module>
|
||||
.textRoot {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -4,7 +4,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
-->
|
||||
|
||||
<template>
|
||||
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }" class="_gaps_s">
|
||||
<div :class="{ [$style.center]: page.alignCenter, [$style.serif]: page.font === 'serif' }" class="_gaps">
|
||||
<XBlock v-for="child in page.content" :key="child.id" :page="page" :block="child" :h="2"/>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
http-equiv="Content-Security-Policy"
|
||||
content="default-src 'self' https://newassets.hcaptcha.com/ https://challenges.cloudflare.com/ http://localhost:7493/;
|
||||
worker-src 'self';
|
||||
script-src 'self' 'unsafe-eval' https://*.hcaptcha.com https://challenges.cloudflare.com;
|
||||
script-src 'self' 'unsafe-eval' https://*.hcaptcha.com https://challenges.cloudflare.com https://esm.sh;
|
||||
style-src 'self' 'unsafe-inline';
|
||||
img-src 'self' data: blob: www.google.com xn--931a.moe launcher.moe localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000 activitypub.software secure.gravatar.com avatars.githubusercontent.com;
|
||||
media-src 'self' localhost:3000 localhost:5173 127.0.0.1:5173 127.0.0.1:3000;
|
||||
|
|
|
@ -36,6 +36,8 @@ export const infoImageUrl = computed(() => instance.infoImageUrl ?? DEFAULT_INFO
|
|||
|
||||
export const notFoundImageUrl = computed(() => instance.notFoundImageUrl ?? DEFAULT_NOT_FOUND_IMAGE_URL);
|
||||
|
||||
export const isEnabledUrlPreview = computed(() => instance.enableUrlPreview ?? true);
|
||||
|
||||
export async function fetchInstance(force = false): Promise<void> {
|
||||
if (!force) {
|
||||
const cachedAt = miLocalStorage.getItem('instanceCachedAt') ? parseInt(miLocalStorage.getItem('instanceCachedAt')!) : 0;
|
||||
|
|
|
@ -75,19 +75,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</MkSwitch>
|
||||
</div>
|
||||
</MkFolder>
|
||||
|
||||
<MkFolder>
|
||||
<template #label>Summaly Proxy</template>
|
||||
|
||||
<div class="_gaps_m">
|
||||
<MkInput v-model="summalyProxy">
|
||||
<template #prefix><i class="ph-link ph-bold ph-lg"></i></template>
|
||||
<template #label>Summaly Proxy URL</template>
|
||||
</MkInput>
|
||||
|
||||
<MkButton primary @click="save"><i class="ph-floppy-disk ph-bold ph-lg"></i> {{ i18n.ts.save }}</MkButton>
|
||||
</div>
|
||||
</MkFolder>
|
||||
</div>
|
||||
</FormSuspense>
|
||||
</MkSpacer>
|
||||
|
@ -112,7 +99,6 @@ import { fetchInstance } from '@/instance.js';
|
|||
import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
|
||||
const summalyProxy = ref<string>('');
|
||||
const enableHcaptcha = ref<boolean>(false);
|
||||
const enableMcaptcha = ref<boolean>(false);
|
||||
const enableRecaptcha = ref<boolean>(false);
|
||||
|
@ -128,7 +114,6 @@ const bannedEmailDomains = ref<string>('');
|
|||
|
||||
async function init() {
|
||||
const meta = await misskeyApi('admin/meta');
|
||||
summalyProxy.value = meta.summalyProxy;
|
||||
enableHcaptcha.value = meta.enableHcaptcha;
|
||||
enableMcaptcha.value = meta.enableMcaptcha;
|
||||
enableRecaptcha.value = meta.enableRecaptcha;
|
||||
|
@ -145,7 +130,6 @@ async function init() {
|
|||
|
||||
function save() {
|
||||
os.apiWithDialog('admin/update-meta', {
|
||||
summalyProxy: summalyProxy.value,
|
||||
enableIpLogging: enableIpLogging.value,
|
||||
enableActiveEmailValidation: enableActiveEmailValidation.value,
|
||||
enableVerifymailApi: enableVerifymailApi.value,
|
||||
|
|
|
@ -148,6 +148,53 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</div>
|
||||
</div>
|
||||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
<template #label>{{ i18n.ts._urlPreviewSetting.title }}</template>
|
||||
|
||||
<div class="_gaps_m">
|
||||
<MkSwitch v-model="urlPreviewEnabled">
|
||||
<template #label>{{ i18n.ts._urlPreviewSetting.enable }}</template>
|
||||
</MkSwitch>
|
||||
|
||||
<MkSwitch v-model="urlPreviewRequireContentLength">
|
||||
<template #label>{{ i18n.ts._urlPreviewSetting.requireContentLength }}</template>
|
||||
<template #caption>{{ i18n.ts._urlPreviewSetting.requireContentLengthDescription }}</template>
|
||||
</MkSwitch>
|
||||
|
||||
<MkInput v-model="urlPreviewMaximumContentLength" type="number">
|
||||
<template #label>{{ i18n.ts._urlPreviewSetting.maximumContentLength }}</template>
|
||||
<template #caption>{{ i18n.ts._urlPreviewSetting.maximumContentLengthDescription }}</template>
|
||||
</MkInput>
|
||||
|
||||
<MkInput v-model="urlPreviewTimeout" type="number">
|
||||
<template #label>{{ i18n.ts._urlPreviewSetting.timeout }}</template>
|
||||
<template #caption>{{ i18n.ts._urlPreviewSetting.timeoutDescription }}</template>
|
||||
</MkInput>
|
||||
|
||||
<MkInput v-model="urlPreviewUserAgent" type="text">
|
||||
<template #label>{{ i18n.ts._urlPreviewSetting.userAgent }}</template>
|
||||
<template #caption>{{ i18n.ts._urlPreviewSetting.userAgentDescription }}</template>
|
||||
</MkInput>
|
||||
|
||||
<div>
|
||||
<MkInput v-model="urlPreviewSummaryProxyUrl" type="text">
|
||||
<template #label>{{ i18n.ts._urlPreviewSetting.summaryProxy }}</template>
|
||||
<template #caption>[{{ i18n.ts.notUsePleaseLeaveBlank }}] {{ i18n.ts._urlPreviewSetting.summaryProxyDescription }}</template>
|
||||
</MkInput>
|
||||
|
||||
<div :class="$style.subCaption">
|
||||
{{ i18n.ts._urlPreviewSetting.summaryProxyDescription2 }}
|
||||
<ul style="padding-left: 20px; margin: 4px 0">
|
||||
<li>{{ i18n.ts._urlPreviewSetting.timeout }} / key:timeout</li>
|
||||
<li>{{ i18n.ts._urlPreviewSetting.maximumContentLength }} / key:contentLengthLimit</li>
|
||||
<li>{{ i18n.ts._urlPreviewSetting.requireContentLength }} / key:contentLengthRequired</li>
|
||||
<li>{{ i18n.ts._urlPreviewSetting.userAgent }} / key:userAgent</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</FormSection>
|
||||
</div>
|
||||
</FormSuspense>
|
||||
</MkSpacer>
|
||||
|
@ -178,6 +225,8 @@ import { fetchInstance, instance } from '@/instance.js';
|
|||
import { i18n } from '@/i18n.js';
|
||||
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import MkSelect from '@/components/MkSelect.vue';
|
||||
|
||||
const name = ref<string | null>(null);
|
||||
const shortName = ref<string | null>(null);
|
||||
|
@ -200,6 +249,12 @@ const perRemoteUserUserTimelineCacheMax = ref<number>(0);
|
|||
const perUserHomeTimelineCacheMax = ref<number>(0);
|
||||
const perUserListTimelineCacheMax = ref<number>(0);
|
||||
const notesPerOneAd = ref<number>(0);
|
||||
const urlPreviewEnabled = ref<boolean>(true);
|
||||
const urlPreviewTimeout = ref<number>(10000);
|
||||
const urlPreviewMaximumContentLength = ref<number>(1024 * 1024 * 10);
|
||||
const urlPreviewRequireContentLength = ref<boolean>(true);
|
||||
const urlPreviewUserAgent = ref<string | null>(null);
|
||||
const urlPreviewSummaryProxyUrl = ref<string | null>(null);
|
||||
|
||||
async function init(): Promise<void> {
|
||||
const meta = await misskeyApi('admin/meta');
|
||||
|
@ -224,9 +279,15 @@ async function init(): Promise<void> {
|
|||
perUserHomeTimelineCacheMax.value = meta.perUserHomeTimelineCacheMax;
|
||||
perUserListTimelineCacheMax.value = meta.perUserListTimelineCacheMax;
|
||||
notesPerOneAd.value = meta.notesPerOneAd;
|
||||
urlPreviewEnabled.value = meta.urlPreviewEnabled;
|
||||
urlPreviewTimeout.value = meta.urlPreviewTimeout;
|
||||
urlPreviewMaximumContentLength.value = meta.urlPreviewMaximumContentLength;
|
||||
urlPreviewRequireContentLength.value = meta.urlPreviewRequireContentLength;
|
||||
urlPreviewUserAgent.value = meta.urlPreviewUserAgent;
|
||||
urlPreviewSummaryProxyUrl.value = meta.urlPreviewSummaryProxyUrl;
|
||||
}
|
||||
|
||||
async function save(): void {
|
||||
async function save() {
|
||||
await os.apiWithDialog('admin/update-meta', {
|
||||
name: name.value,
|
||||
shortName: shortName.value === '' ? null : shortName.value,
|
||||
|
@ -249,6 +310,12 @@ async function save(): void {
|
|||
perUserHomeTimelineCacheMax: perUserHomeTimelineCacheMax.value,
|
||||
perUserListTimelineCacheMax: perUserListTimelineCacheMax.value,
|
||||
notesPerOneAd: notesPerOneAd.value,
|
||||
urlPreviewEnabled: urlPreviewEnabled.value,
|
||||
urlPreviewTimeout: urlPreviewTimeout.value,
|
||||
urlPreviewMaximumContentLength: urlPreviewMaximumContentLength.value,
|
||||
urlPreviewRequireContentLength: urlPreviewRequireContentLength.value,
|
||||
urlPreviewUserAgent: urlPreviewUserAgent.value,
|
||||
urlPreviewSummaryProxyUrl: urlPreviewSummaryProxyUrl.value,
|
||||
});
|
||||
|
||||
fetchInstance(true);
|
||||
|
@ -267,4 +334,9 @@ definePageMetadata(() => ({
|
|||
-webkit-backdrop-filter: var(--blur, blur(15px));
|
||||
backdrop-filter: var(--blur, blur(15px));
|
||||
}
|
||||
|
||||
.subCaption {
|
||||
font-size: 0.85em;
|
||||
color: var(--fgTransparentWeak);
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -18,16 +18,17 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkCodeEditor v-model="script" lang="is">
|
||||
<template #label>{{ i18n.ts._play.script }}</template>
|
||||
</MkCodeEditor>
|
||||
<MkSelect v-model="visibility">
|
||||
<template #label>{{ i18n.ts.visibility }}</template>
|
||||
<template #caption>{{ i18n.ts._play.visibilityDescription }}</template>
|
||||
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
|
||||
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
|
||||
</MkSelect>
|
||||
<div class="_buttons">
|
||||
<MkButton primary @click="save"><i class="ph-check ph-bold ph-lg"></i> {{ i18n.ts.save }}</MkButton>
|
||||
<MkButton @click="show"><i class="ph-eye ph-bold ph-lg"></i> {{ i18n.ts.show }}</MkButton>
|
||||
<MkButton v-if="flash" danger @click="del"><i class="ph-trash ph-bold ph-lg"></i> {{ i18n.ts.delete }}</MkButton>
|
||||
</div>
|
||||
<MkSelect v-model="visibility">
|
||||
<template #label>{{ i18n.ts.visibility }}</template>
|
||||
<option :key="'public'" :value="'public'">{{ i18n.ts.public }}</option>
|
||||
<option :key="'private'" :value="'private'">{{ i18n.ts.private }}</option>
|
||||
</MkSelect>
|
||||
</div>
|
||||
</MkSpacer>
|
||||
</MkStickyContainer>
|
||||
|
@ -367,7 +368,7 @@ const props = defineProps<{
|
|||
}>();
|
||||
|
||||
const flash = ref<Misskey.entities.Flash | null>(null);
|
||||
const visibility = ref<Misskey.entities.FlashUpdateRequest['visibility']>('public');
|
||||
const visibility = ref<'private' | 'public'>('public');
|
||||
|
||||
if (props.id) {
|
||||
flash.value = await misskeyApi('flash/show', {
|
||||
|
@ -420,6 +421,7 @@ async function save() {
|
|||
summary: summary.value,
|
||||
permissions: permissions.value,
|
||||
script: script.value,
|
||||
visibility: visibility.value,
|
||||
});
|
||||
router.push('/play/' + created.id + '/edit');
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ const draft = ref({
|
|||
users: [],
|
||||
keywords: [],
|
||||
excludeKeywords: [],
|
||||
excludeBots: false,
|
||||
withReplies: false,
|
||||
caseSensitive: false,
|
||||
localOnly: false,
|
||||
|
|
|
@ -26,6 +26,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template #label>{{ i18n.ts.users }}</template>
|
||||
<template #caption>{{ i18n.ts.antennaUsersDescription }} <button class="_textButton" @click="addUser">{{ i18n.ts.addUser }}</button></template>
|
||||
</MkTextarea>
|
||||
<MkSwitch v-model="excludeBots">{{ i18n.ts.antennaExcludeBots }}</MkSwitch>
|
||||
<MkSwitch v-model="withReplies">{{ i18n.ts.withReplies }}</MkSwitch>
|
||||
<MkTextarea v-model="keywords">
|
||||
<template #label>{{ i18n.ts.antennaKeywords }}</template>
|
||||
|
@ -78,6 +79,7 @@ const keywords = ref<string>(props.antenna.keywords.map(x => x.join(' ')).join('
|
|||
const excludeKeywords = ref<string>(props.antenna.excludeKeywords.map(x => x.join(' ')).join('\n'));
|
||||
const caseSensitive = ref<boolean>(props.antenna.caseSensitive);
|
||||
const localOnly = ref<boolean>(props.antenna.localOnly);
|
||||
const excludeBots = ref<boolean>(props.antenna.excludeBots);
|
||||
const withReplies = ref<boolean>(props.antenna.withReplies);
|
||||
const withFile = ref<boolean>(props.antenna.withFile);
|
||||
const notify = ref<boolean>(props.antenna.notify);
|
||||
|
@ -94,6 +96,7 @@ async function saveAntenna() {
|
|||
name: name.value,
|
||||
src: src.value,
|
||||
userListId: userListId.value,
|
||||
excludeBots: excludeBots.value,
|
||||
withReplies: withReplies.value,
|
||||
withFile: withFile.value,
|
||||
notify: notify.value,
|
||||
|
|
|
@ -8,7 +8,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<XContainer :draggable="true" @remove="() => $emit('remove')">
|
||||
<template #header><i class="ph-note ph-bold ph-lg"></i> {{ i18n.ts._pages.blocks.note }}</template>
|
||||
|
||||
<section style="padding: 0 16px 0 16px;">
|
||||
<section style="padding: 16px;" class="_gaps_s">
|
||||
<MkInput v-model="id">
|
||||
<template #label>{{ i18n.ts._pages.blocks._note.id }}</template>
|
||||
<template #caption>{{ i18n.ts._pages.blocks._note.idDescription }}</template>
|
||||
|
|
|
@ -6,48 +6,73 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<template>
|
||||
<MkStickyContainer>
|
||||
<template #header><MkPageHeader :actions="headerActions" :displayBackButton="true" :tabs="headerTabs"/></template>
|
||||
<MkSpacer :contentMax="700">
|
||||
<Transition :name="defaultStore.state.animation ? 'fade' : ''" mode="out-in">
|
||||
<div v-if="page" :key="page.id" class="xcukqgmh">
|
||||
<div class="main">
|
||||
<!--
|
||||
<div class="header">
|
||||
<h1>{{ page.title }}</h1>
|
||||
</div>
|
||||
-->
|
||||
<div class="banner">
|
||||
<MkMediaImage
|
||||
v-if="page.eyeCatchingImageId"
|
||||
:image="page.eyeCatchingImage"
|
||||
:cover="true"
|
||||
:disableImageLink="true"
|
||||
class="thumbnail"
|
||||
/>
|
||||
<MkSpacer :contentMax="800">
|
||||
<Transition
|
||||
:enterActiveClass="defaultStore.state.animation ? $style.fadeEnterActive : ''"
|
||||
:leaveActiveClass="defaultStore.state.animation ? $style.fadeLeaveActive : ''"
|
||||
:enterFromClass="defaultStore.state.animation ? $style.fadeEnterFrom : ''"
|
||||
:leaveToClass="defaultStore.state.animation ? $style.fadeLeaveTo : ''"
|
||||
>
|
||||
<div v-if="page" :key="page.id" class="_gaps">
|
||||
<div :class="$style.pageMain">
|
||||
<div :class="$style.pageBanner">
|
||||
<div :class="$style.pageBannerBgRoot">
|
||||
<MkImgWithBlurhash
|
||||
v-if="page.eyeCatchingImageId"
|
||||
:class="$style.pageBannerBg"
|
||||
:hash="page.eyeCatchingImage?.blurhash"
|
||||
:cover="true"
|
||||
:forceBlurhash="true"
|
||||
/>
|
||||
<img
|
||||
v-else-if="instance.backgroundImageUrl || instance.bannerUrl"
|
||||
:class="[$style.pageBannerBg, $style.pageBannerBgFallback1]"
|
||||
:src="getStaticImageUrl(instance.backgroundImageUrl ?? instance.bannerUrl!)"
|
||||
/>
|
||||
<div v-else :class="[$style.pageBannerBg, $style.pageBannerBgFallback2]"></div>
|
||||
</div>
|
||||
<div v-if="page.eyeCatchingImageId" :class="$style.pageBannerImage">
|
||||
<MkMediaImage
|
||||
:image="page.eyeCatchingImage!"
|
||||
:cover="true"
|
||||
:disableImageLink="true"
|
||||
:class="$style.thumbnail"
|
||||
/>
|
||||
</div>
|
||||
<div :class="$style.pageBannerTitle" class="_gaps_s">
|
||||
<h1>{{ page.title || page.name }}</h1>
|
||||
<div v-if="page.user" :class="$style.pageBannerTitleUser">
|
||||
<MkAvatar :user="page.user" :class="$style.avatar" indicator link preview/> <MkA :to="`/@${username}`"><MkUserName :user="page.user" :nowrap="false"/></MkA>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="content">
|
||||
<div :class="$style.pageContent">
|
||||
<XPage :page="page"/>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="like">
|
||||
<div :class="$style.pageActions">
|
||||
<div>
|
||||
<MkButton v-if="page.isLiked" v-tooltip="i18n.ts._pages.unlike" class="button" asLike primary @click="unlike()"><i class="ph-heart-break ph-bold ph-lg"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
||||
<MkButton v-else v-tooltip="i18n.ts._pages.like" class="button" asLike @click="like()"><i class="ph-heart ph-bold ph-lg"></i><span v-if="page.likedCount > 0" class="count">{{ page.likedCount }}</span></MkButton>
|
||||
</div>
|
||||
<div class="other">
|
||||
<button v-tooltip="i18n.ts.shareWithNote" v-click-anime class="_button" @click="shareWithNote"><i class="ph-rocket-launch ph-bold ph-lg ti-fw"></i></button>
|
||||
<button v-tooltip="i18n.ts.copyLink" v-click-anime class="_button" @click="copyLink"><i class="ph-share-network ph-bold ph-lg ti-fw"></i></button>
|
||||
<button v-if="isSupportShare()" v-tooltip="i18n.ts.share" v-click-anime class="_button" @click="share"><i class="ph-share-network ph-bold ph-lg ti-fw"></i></button>
|
||||
<div :class="$style.other">
|
||||
<button v-tooltip="i18n.ts.copyLink" class="_button" :class="$style.generalActionButton" @click="copyLink"><i class="ph-link ph-bold ph-lg ti-fw"></i></button>
|
||||
<button v-tooltip="i18n.ts.share" class="_button" :class="$style.generalActionButton" @click="share"><i class="ph-share-network ph-bold ph-lg ti-fw"></i></button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="user">
|
||||
<MkAvatar :user="page.user" class="avatar" link preview/>
|
||||
<div class="name">
|
||||
<MkUserName :user="page.user" style="display: block;"/>
|
||||
<MkAcct :user="page.user"/>
|
||||
</div>
|
||||
<MkFollowButton v-if="!$i || $i.id != page.user.id" :user="page.user" :inline="true" :transparent="false" :full="true" large class="koudoku"/>
|
||||
<div :class="$style.pageUser">
|
||||
<MkAvatar :user="page.user" :class="$style.avatar" link preview/>
|
||||
<MkA :to="`/@${username}`">
|
||||
<MkUserName :user="page.user" :class="$style.name"/>
|
||||
<MkAcct :user="page.user" :class="$style.acct"/>
|
||||
</MkA>
|
||||
<MkFollowButton v-if="!$i || $i.id != page.user.id" :user="page.user!" :inline="true" :transparent="false" :full="true" :class="$style.follow"/>
|
||||
</div>
|
||||
<div class="links">
|
||||
<MkA :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
||||
<div :class="$style.pageDate">
|
||||
<div><i class="ti ti-clock"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
||||
<div v-if="page.createdAt != page.updatedAt"><i class="ti ti-clock-edit"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
||||
</div>
|
||||
<div :class="$style.pageLinks">
|
||||
<MkA v-if="!$i || $i.id !== page.userId" :to="`/@${username}/pages/${pageName}/view-source`" class="link">{{ i18n.ts._pages.viewSource }}</MkA>
|
||||
<template v-if="$i && $i.id === page.userId">
|
||||
<MkA :to="`/pages/edit/${page.id}`" class="link">{{ i18n.ts._pages.editThisPage }}</MkA>
|
||||
<button v-if="$i.pinnedPageId === page.id" class="link _textButton" @click="pin(false)">{{ i18n.ts.unpin }}</button>
|
||||
|
@ -55,10 +80,6 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
</template>
|
||||
</div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<div><i class="ph-clock ph-bold ph-lg"></i> {{ i18n.ts.createdAt }}: <MkTime :time="page.createdAt" mode="detail"/></div>
|
||||
<div v-if="page.createdAt != page.updatedAt"><i class="ph-clock ph-bold ph-lg"></i> {{ i18n.ts.updatedAt }}: <MkTime :time="page.updatedAt" mode="detail"/></div>
|
||||
</div>
|
||||
<MkAd :prefer="['horizontal', 'horizontal-big']"/>
|
||||
<MkContainer :max-height="300" :foldable="true" class="other">
|
||||
<template #icon><i class="ph-clock ph-bold ph-lg"></i></template>
|
||||
|
@ -84,6 +105,7 @@ import * as os from '@/os.js';
|
|||
import { misskeyApi } from '@/scripts/misskey-api.js';
|
||||
import { url } from '@/config.js';
|
||||
import MkMediaImage from '@/components/MkMediaImage.vue';
|
||||
import MkImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||
import MkContainer from '@/components/MkContainer.vue';
|
||||
import MkPagination from '@/components/MkPagination.vue';
|
||||
|
@ -94,6 +116,8 @@ import { pageViewInterruptors, defaultStore } from '@/store.js';
|
|||
import { deepClone } from '@/scripts/clone.js';
|
||||
import { $i } from '@/account.js';
|
||||
import { isSupportShare } from '@/scripts/navigator.js';
|
||||
import { instance } from '@/instance.js';
|
||||
import { getStaticImageUrl } from '@/scripts/media-proxy.js';
|
||||
import copyToClipboard from '@/scripts/copy-to-clipboard.js';
|
||||
|
||||
const props = defineProps<{
|
||||
|
@ -133,35 +157,63 @@ function fetchPage() {
|
|||
});
|
||||
}
|
||||
|
||||
function share() {
|
||||
navigator.share({
|
||||
title: page.value.title ?? page.value.name,
|
||||
text: page.value.summary,
|
||||
url: `${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
||||
});
|
||||
function share(ev: MouseEvent) {
|
||||
if (!page.value) return;
|
||||
|
||||
os.popupMenu([
|
||||
{
|
||||
text: i18n.ts.shareWithNote,
|
||||
icon: 'ti ti-pencil',
|
||||
action: shareWithNote,
|
||||
},
|
||||
...(isSupportShare() ? [{
|
||||
text: i18n.ts.share,
|
||||
icon: 'ti ti-share',
|
||||
action: shareWithNavigator,
|
||||
}] : []),
|
||||
], ev.currentTarget ?? ev.target);
|
||||
}
|
||||
|
||||
function copyLink() {
|
||||
if (!page.value) return;
|
||||
|
||||
copyToClipboard(`${url}/@${page.value.user.username}/pages/${page.value.name}`);
|
||||
os.success();
|
||||
}
|
||||
|
||||
function shareWithNote() {
|
||||
if (!page.value) return;
|
||||
|
||||
os.post({
|
||||
initialText: `${page.value.title || page.value.name} ${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
||||
initialText: `${page.value.title || page.value.name}\n${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
||||
instant: true,
|
||||
});
|
||||
}
|
||||
|
||||
function shareWithNavigator() {
|
||||
if (!page.value) return;
|
||||
|
||||
navigator.share({
|
||||
title: page.value.title ?? page.value.name,
|
||||
text: page.value.summary ?? undefined,
|
||||
url: `${url}/@${page.value.user.username}/pages/${page.value.name}`,
|
||||
});
|
||||
}
|
||||
|
||||
function like() {
|
||||
if (!page.value) return;
|
||||
|
||||
os.apiWithDialog('pages/like', {
|
||||
pageId: page.value.id,
|
||||
}).then(() => {
|
||||
page.value.isLiked = true;
|
||||
page.value.likedCount++;
|
||||
page.value!.isLiked = true;
|
||||
page.value!.likedCount++;
|
||||
});
|
||||
}
|
||||
|
||||
async function unlike() {
|
||||
if (!page.value) return;
|
||||
|
||||
const confirm = await os.confirm({
|
||||
type: 'warning',
|
||||
text: i18n.ts.unlikeConfirm,
|
||||
|
@ -170,12 +222,14 @@ async function unlike() {
|
|||
os.apiWithDialog('pages/unlike', {
|
||||
pageId: page.value.id,
|
||||
}).then(() => {
|
||||
page.value.isLiked = false;
|
||||
page.value.likedCount--;
|
||||
page.value!.isLiked = false;
|
||||
page.value!.likedCount--;
|
||||
});
|
||||
}
|
||||
|
||||
function pin(pin) {
|
||||
if (!page.value) return;
|
||||
|
||||
os.apiWithDialog('i/update', {
|
||||
pinnedPageId: pin ? page.value.id : null,
|
||||
});
|
||||
|
@ -200,109 +254,185 @@ definePageMetadata(() => ({
|
|||
}));
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.fade-enter-active,
|
||||
.fade-leave-active {
|
||||
<style lang="scss" module>
|
||||
.fadeEnterActive,
|
||||
.fadeLeaveActive {
|
||||
transition: opacity 0.125s ease;
|
||||
}
|
||||
.fade-enter-from,
|
||||
.fade-leave-to {
|
||||
.fadeEnterFrom,
|
||||
.fadeLeaveTo {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.xcukqgmh {
|
||||
> .main {
|
||||
padding: 32px;
|
||||
.generalActionButton {
|
||||
height: 2.5rem;
|
||||
width: 2.5rem;
|
||||
text-align: center;
|
||||
border-radius: 99rem;
|
||||
|
||||
> .header {
|
||||
padding: 16px;
|
||||
|
||||
> h1 {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
> .banner {
|
||||
> .thumbnail {
|
||||
// TODO: 良い感じのアスペクト比で表示
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
aspect-ratio: 3/1;
|
||||
border-radius: var(--radius);
|
||||
overflow: hidden;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
> .content {
|
||||
margin-top: 16px;
|
||||
padding: 16px 0 0 0;
|
||||
}
|
||||
|
||||
> .actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin-top: 16px;
|
||||
padding: 16px 0 0 0;
|
||||
border-top: solid 0.5px var(--divider);
|
||||
|
||||
> .other {
|
||||
margin-left: auto;
|
||||
|
||||
> button {
|
||||
padding: 8px;
|
||||
margin: 0 8px;
|
||||
|
||||
&:hover {
|
||||
color: var(--fgHighlighted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
> .user {
|
||||
margin-top: 16px;
|
||||
padding: 16px 0 0 0;
|
||||
border-top: solid 0.5px var(--divider);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
> .avatar {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
}
|
||||
|
||||
> .name {
|
||||
margin: 0 0 0 12px;
|
||||
font-size: 90%;
|
||||
}
|
||||
|
||||
> .koudoku {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
> .links {
|
||||
margin-top: 16px;
|
||||
padding: 24px 0 0 0;
|
||||
border-top: solid 0.5px var(--divider);
|
||||
|
||||
> .link {
|
||||
margin-right: 0.75em;
|
||||
}
|
||||
}
|
||||
& :global(.ti) {
|
||||
line-height: 2.5rem;
|
||||
}
|
||||
|
||||
> .footer {
|
||||
margin: var(--margin) 0 var(--margin) 0;
|
||||
font-size: 85%;
|
||||
opacity: 0.75;
|
||||
&:hover,
|
||||
&:focus-visible {
|
||||
background-color: var(--accentedBg);
|
||||
color: var(--accent);
|
||||
text-decoration: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style module>
|
||||
.pageMain {
|
||||
border-radius: var(--radius);
|
||||
padding: 2rem;
|
||||
background: var(--panel);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.pageBanner {
|
||||
width: calc(100% + 4rem);
|
||||
margin: -2rem -2rem 1.5rem;
|
||||
border-radius: var(--radius) var(--radius) 0 0;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
> .pageBannerBgRoot {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
|
||||
.pageBannerBg {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
opacity: .2;
|
||||
filter: brightness(1.2);
|
||||
}
|
||||
|
||||
.pageBannerBgFallback1 {
|
||||
filter: blur(20px);
|
||||
}
|
||||
|
||||
.pageBannerBgFallback2 {
|
||||
background-color: var(--accentedBg);
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
height: 100px;
|
||||
background: linear-gradient(0deg, var(--panel), transparent);
|
||||
}
|
||||
}
|
||||
|
||||
> .pageBannerImage {
|
||||
position: relative;
|
||||
padding-top: 56.25%;
|
||||
|
||||
> .thumbnail {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
> .pageBannerTitle {
|
||||
position: relative;
|
||||
padding: 1.5rem 2rem;
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 700;
|
||||
color: var(--fg);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.pageBannerTitleUser {
|
||||
--height: 32px;
|
||||
|
||||
.avatar {
|
||||
height: var(--height);
|
||||
width: var(--height);
|
||||
}
|
||||
|
||||
line-height: var(--height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.pageContent {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.pageActions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
border-top: 1px solid var(--divider);
|
||||
padding-top: 1.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
> .other {
|
||||
margin-left: auto;
|
||||
display: flex;
|
||||
gap: var(--marginHalf);
|
||||
}
|
||||
}
|
||||
|
||||
.pageUser {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
|
||||
border-top: 1px solid var(--divider);
|
||||
padding-top: 1.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
.avatar,
|
||||
.name,
|
||||
.acct {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
width: 4rem;
|
||||
height: 4rem;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
.name {
|
||||
font-size: 110%;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.acct {
|
||||
font-size: 90%;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.follow {
|
||||
margin-left: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.pageDate {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.pageLinks {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--marginHalf);
|
||||
}
|
||||
|
||||
.relatedPagesRoot {
|
||||
padding: var(--margin);
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkSpacer :marginMin="20" :marginMax="28">
|
||||
<div class="_gaps">
|
||||
<div>{{ i18n.ts._2fa.step3Title }}</div>
|
||||
<MkInput v-model="token" autocomplete="one-time-code"></MkInput>
|
||||
<MkInput v-model="token" autocomplete="one-time-code" inputmode="numeric"></MkInput>
|
||||
<div>{{ i18n.ts._2fa.step3 }}</div>
|
||||
</div>
|
||||
<div class="_buttonsCenter" style="margin-top: 16px;">
|
||||
|
|
|
@ -80,7 +80,7 @@ import MkSwitch from '@/components/MkSwitch.vue';
|
|||
import FormSection from '@/components/form/section.vue';
|
||||
import MkFolder from '@/components/MkFolder.vue';
|
||||
import * as os from '@/os.js';
|
||||
import { signinRequired } from '@/account.js';
|
||||
import { signinRequired, updateAccount } from '@/account.js';
|
||||
import { i18n } from '@/i18n.js';
|
||||
|
||||
const $i = signinRequired();
|
||||
|
@ -116,6 +116,10 @@ async function unregisterTOTP(): Promise<void> {
|
|||
os.apiWithDialog('i/2fa/unregister', {
|
||||
password: auth.result.password,
|
||||
token: auth.result.token,
|
||||
}).then(res => {
|
||||
updateAccount({
|
||||
twoFactorEnabled: false,
|
||||
});
|
||||
}).catch(error => {
|
||||
os.alert({
|
||||
type: 'error',
|
||||
|
|
|
@ -3,18 +3,19 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { bundledThemesInfo } from 'shiki';
|
||||
import { getHighlighterCore, loadWasm } from 'shiki/core';
|
||||
import darkPlus from 'shiki/themes/dark-plus.mjs';
|
||||
import { bundledThemesInfo } from 'shiki/themes';
|
||||
import { bundledLanguagesInfo } from 'shiki/langs';
|
||||
import { unique } from './array.js';
|
||||
import { deepClone } from './clone.js';
|
||||
import { deepMerge } from './merge.js';
|
||||
import type { Highlighter, LanguageRegistration, ThemeRegistration, ThemeRegistrationRaw } from 'shiki';
|
||||
import type { HighlighterCore, LanguageRegistration, ThemeRegistration, ThemeRegistrationRaw } from 'shiki/core';
|
||||
import { ColdDeviceStorage } from '@/store.js';
|
||||
import lightTheme from '@/themes/_light.json5';
|
||||
import darkTheme from '@/themes/_dark.json5';
|
||||
|
||||
let _highlighter: Highlighter | null = null;
|
||||
let _highlighter: HighlighterCore | null = null;
|
||||
|
||||
export async function getTheme(mode: 'light' | 'dark', getName: true): Promise<string>;
|
||||
export async function getTheme(mode: 'light' | 'dark', getName?: false): Promise<ThemeRegistration | ThemeRegistrationRaw>;
|
||||
|
@ -51,16 +52,14 @@ export async function getTheme(mode: 'light' | 'dark', getName = false): Promise
|
|||
return darkPlus;
|
||||
}
|
||||
|
||||
export async function getHighlighter(): Promise<Highlighter> {
|
||||
export async function getHighlighter(): Promise<HighlighterCore> {
|
||||
if (!_highlighter) {
|
||||
return await initHighlighter();
|
||||
}
|
||||
return _highlighter;
|
||||
}
|
||||
|
||||
export async function initHighlighter() {
|
||||
const aiScriptGrammar = await import('aiscript-vscode/aiscript/syntaxes/aiscript.tmLanguage.json');
|
||||
|
||||
async function initHighlighter() {
|
||||
await loadWasm(import('shiki/onig.wasm?init'));
|
||||
|
||||
// テーマの重複を消す
|
||||
|
@ -69,11 +68,12 @@ export async function initHighlighter() {
|
|||
...(await Promise.all([getTheme('light'), getTheme('dark')])),
|
||||
]);
|
||||
|
||||
const jsLangInfo = bundledLanguagesInfo.find(t => t.id === 'javascript');
|
||||
const highlighter = await getHighlighterCore({
|
||||
themes,
|
||||
langs: [
|
||||
import('shiki/langs/javascript.mjs'),
|
||||
aiScriptGrammar.default as unknown as LanguageRegistration,
|
||||
...(jsLangInfo ? [async () => await jsLangInfo.import()] : []),
|
||||
async () => (await import('aiscript-vscode/aiscript/syntaxes/aiscript.tmLanguage.json')).default as unknown as LanguageRegistration,
|
||||
],
|
||||
});
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
import { ref } from 'vue';
|
||||
import tinycolor from 'tinycolor2';
|
||||
import { deepClone } from './clone.js';
|
||||
import type { BuiltinTheme } from 'shiki';
|
||||
import type { BundledTheme } from 'shiki/themes';
|
||||
import { globalEvents } from '@/events.js';
|
||||
import lightTheme from '@/themes/_light.json5';
|
||||
import darkTheme from '@/themes/_dark.json5';
|
||||
|
@ -20,7 +20,7 @@ export type Theme = {
|
|||
base?: 'dark' | 'light';
|
||||
props: Record<string, string>;
|
||||
codeHighlighter?: {
|
||||
base: BuiltinTheme;
|
||||
base: BundledTheme;
|
||||
overrides?: Record<string, any>;
|
||||
} | {
|
||||
base: '_none_';
|
||||
|
|
|
@ -7,7 +7,6 @@ import { markRaw, ref } from 'vue';
|
|||
import * as Misskey from 'misskey-js';
|
||||
import { miLocalStorage } from './local-storage.js';
|
||||
import type { SoundType } from '@/scripts/sound.js';
|
||||
import type { BuiltinTheme as ShikiBuiltinTheme } from 'shiki';
|
||||
import { Storage } from '@/pizzax.js';
|
||||
import { hemisphere } from '@/scripts/intl-const.js';
|
||||
|
||||
|
|
|
@ -8,7 +8,12 @@ import { markRaw } from 'vue';
|
|||
import { $i } from '@/account.js';
|
||||
import { wsOrigin } from '@/config.js';
|
||||
|
||||
// heart beat interval in ms
|
||||
const HEART_BEAT_INTERVAL = 1000 * 60;
|
||||
|
||||
let stream: Misskey.Stream | null = null;
|
||||
let timeoutHeartBeat: ReturnType<typeof setTimeout> | null = null;
|
||||
let lastHeartbeatCall = 0;
|
||||
|
||||
export function useStream(): Misskey.Stream {
|
||||
if (stream) return stream;
|
||||
|
@ -17,7 +22,18 @@ export function useStream(): Misskey.Stream {
|
|||
token: $i.token,
|
||||
} : null));
|
||||
|
||||
window.setTimeout(heartbeat, 1000 * 60);
|
||||
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
|
||||
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
|
||||
|
||||
// send heartbeat right now when last send time is over HEART_BEAT_INTERVAL
|
||||
document.addEventListener('visibilitychange', () => {
|
||||
if (
|
||||
!stream
|
||||
|| document.visibilityState !== 'visible'
|
||||
|| Date.now() - lastHeartbeatCall < HEART_BEAT_INTERVAL
|
||||
) return;
|
||||
heartbeat();
|
||||
});
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
@ -26,5 +42,7 @@ function heartbeat(): void {
|
|||
if (stream != null && document.visibilityState === 'visible') {
|
||||
stream.heartbeat();
|
||||
}
|
||||
window.setTimeout(heartbeat, 1000 * 60);
|
||||
lastHeartbeatCall = Date.now();
|
||||
if (timeoutHeartBeat) window.clearTimeout(timeoutHeartBeat);
|
||||
timeoutHeartBeat = window.setTimeout(heartbeat, HEART_BEAT_INTERVAL);
|
||||
}
|
||||
|
|
|
@ -465,12 +465,13 @@ rt {
|
|||
border-radius: 10px;
|
||||
|
||||
--bg: #F1E8DC;
|
||||
--panel: #fff;
|
||||
--fg: #693410;
|
||||
--switchOffBg: rgba(0, 0, 0, 0.1);
|
||||
--switchOffFg: rgb(255, 255, 255);
|
||||
--switchOnBg: var(--accent);
|
||||
--switchOnFg: rgb(255, 255, 255);
|
||||
}
|
||||
|
||||
html[data-color-mode=dark] ._woodenFrame {
|
||||
--bg: #1d0c02;
|
||||
--fg: #F1E8DC;
|
||||
--panel: #192320;
|
||||
}
|
||||
|
||||
._woodenFrameH {
|
||||
|
|
|
@ -5,11 +5,30 @@ import { type UserConfig, defineConfig } from 'vite';
|
|||
|
||||
import locales from '../../locales/index.js';
|
||||
import meta from '../../package.json';
|
||||
import packageInfo from './package.json' assert { type: 'json' };
|
||||
import pluginUnwindCssModuleClassName from './lib/rollup-plugin-unwind-css-module-class-name.js';
|
||||
import pluginJson5 from './vite.json5.js';
|
||||
|
||||
const extensions = ['.ts', '.tsx', '.js', '.jsx', '.mjs', '.json', '.json5', '.svg', '.sass', '.scss', '.css', '.vue'];
|
||||
|
||||
/**
|
||||
* Misskeyのフロントエンドにバンドルせず、CDNなどから別途読み込むリソースを記述する。
|
||||
* CDNを使わずにバンドルしたい場合、以下の配列から該当要素を削除orコメントアウトすればOK
|
||||
*/
|
||||
const externalPackages = [
|
||||
// shiki(コードブロックのシンタックスハイライトで使用中)はテーマ・言語の定義の容量が大きいため、それらはCDNから読み込む
|
||||
{
|
||||
name: 'shiki',
|
||||
match: /^shiki\/(?<subPkg>(langs|themes))$/,
|
||||
path(id: string, pattern: RegExp): string {
|
||||
const match = pattern.exec(id)?.groups;
|
||||
return match
|
||||
? `https://esm.sh/shiki@${packageInfo.dependencies.shiki}/${match['subPkg']}`
|
||||
: id;
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
const hash = (str: string, seed = 0): number => {
|
||||
let h1 = 0xdeadbeef ^ seed,
|
||||
h2 = 0x41c6ce57 ^ seed;
|
||||
|
@ -110,6 +129,7 @@ export function getConfig(): UserConfig {
|
|||
input: {
|
||||
app: './src/_boot_.ts',
|
||||
},
|
||||
external: externalPackages.map(p => p.match),
|
||||
output: {
|
||||
manualChunks: {
|
||||
vue: ['vue'],
|
||||
|
@ -117,6 +137,15 @@ export function getConfig(): UserConfig {
|
|||
},
|
||||
chunkFileNames: process.env.NODE_ENV === 'production' ? '[hash:8].js' : '[name]-[hash:8].js',
|
||||
assetFileNames: process.env.NODE_ENV === 'production' ? '[hash:8][extname]' : '[name]-[hash:8][extname]',
|
||||
paths(id) {
|
||||
for (const p of externalPackages) {
|
||||
if (p.match.test(id)) {
|
||||
return p.path(id, p.match);
|
||||
}
|
||||
}
|
||||
|
||||
return id;
|
||||
},
|
||||
},
|
||||
},
|
||||
cssCodeSplit: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue