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" indexableDescription: "Allow built-in search to show your public posts"
languageForTranslation: "Post translation language" languageForTranslation: "Post translation language"
detectPostLanguage: "Automatically detect the language and show a translate button for posts in foreign languages" 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: _sensitiveMediaDetection:
description: "Reduces the effort of server moderation through automatically recognizing description: "Reduces the effort of server moderation through automatically recognizing

View file

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

View file

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

View file

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

View file

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

View file

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