make it toggleable

This commit is contained in:
naskya 2023-09-17 12:23:20 +09:00
parent fbe1ab1b85
commit 12eabc81f0
No known key found for this signature in database
GPG key ID: 164DFF24E2D40139
6 changed files with 24 additions and 5 deletions

View file

@ -1142,6 +1142,7 @@ indexable: "Indexable"
indexableDescription: "Allow built-in search to show your public posts"
languageForTranslation: "Post translation language"
detectPostLanguage: "Automatically detect the language and show a translate button for posts in foreign languages"
openServerInfo: "Show server information by clicking the server ticker on a post"
_sensitiveMediaDetection:
description: "Reduces the effort of server moderation through automatically recognizing

View file

@ -1982,3 +1982,4 @@ importZip: ZIPをインポート
emojiPackCreator: 絵文字パックの作者
confirm: 確認
exportZip: ZIPをエクスポート
openServerInfo: "投稿内のサーバー名をクリックでサーバー情報を開く"

View file

@ -4,7 +4,7 @@
v-tooltip="capitalize(instance.softwareName)"
class="hpaizdrt"
:style="bg"
@click.stop="os.pageWindow(instanceInfoUrl)"
@click.stop="openServerInfo"
>
<img class="icon" :src="getInstanceIcon(instance)" aria-hidden="true" />
<span class="name">{{ instance.name }}</span>
@ -17,7 +17,8 @@ import { ref } from "vue";
import { instanceName } from "@/config";
import { instance as Instance } from "@/instance";
import { getProxiedImageUrlNullable } from "@/scripts/media-proxy";
import * as os from "@/os";
import { defaultStore } from "@/store";
import { pageWindow } from "@/os";
const props = defineProps<{
instance?: {
@ -43,9 +44,6 @@ const instance = props.instance ?? {
softwareName: Instance.softwareName ?? "Firefish",
};
const instanceInfoUrl =
props.host == null ? "/about" : `/instance-info/${props.host}`;
const commonNames = new Map<string, string>([
["birdsitelive", "BirdsiteLIVE"],
["bookwyrm", "BookWyrm"],
@ -89,6 +87,13 @@ function getInstanceIcon(instance): string {
"/client-assets/dummy.png"
);
}
function openServerInfo() {
if (!defaultStore.state.openServerInfo) return;
const instanceInfoUrl =
props.host == null ? "/about" : `/instance-info/${props.host}`;
pageWindow(instanceInfoUrl);
}
</script>
<style lang="scss" scoped>

View file

@ -83,6 +83,9 @@
<FormSwitch v-model="detectPostLanguage" class="_formBlock">{{
i18n.ts.detectPostLanguage
}}</FormSwitch>
<FormSwitch v-model="openServerInfo" class="_formBlock">{{
i18n.ts.openServerInfo
}}</FormSwitch>
<FormSelect v-model="serverDisconnectedBehavior" class="_formBlock">
<template #label>{{ i18n.ts.whenServerDisconnected }}</template>
@ -373,6 +376,9 @@ const showTimelineReplies = computed(
const detectPostLanguage = computed(
defaultStore.makeGetterSetter("detectPostLanguage"),
);
const openServerInfo = computed(
defaultStore.makeGetterSetter("openServerInfo"),
);
watch(swipeOnDesktop, () => {
defaultStore.set("swipeOnMobile", true);

View file

@ -117,6 +117,8 @@ const defaultStoreSaveKeys: (keyof (typeof defaultStore)["state"])[] = [
"enableEmojiReactions",
"showEmojisInReactionNotifications",
"showTimelineReplies",
"detectPostLanguage",
"openServerInfo",
];
const coldDeviceStorageSaveKeys: (keyof typeof ColdDeviceStorage.default)[] = [
"lightTheme",

View file

@ -349,6 +349,10 @@ export const defaultStore = markRaw(
where: "deviceAccount",
default: true,
},
openServerInfo: {
where: "device",
default: true,
},
}),
);