forked from naskya/firefish
feat: ability to specify search engine for search MFM
This commit is contained in:
parent
be496d2d24
commit
6661550a87
6 changed files with 42 additions and 1 deletions
|
@ -32,6 +32,13 @@
|
|||
|
||||
## 細かい変更点
|
||||
|
||||
- 検索の MFM で使用する検索エンジンを設定から変更可能に
|
||||
- 以下の選択肢から選べます
|
||||
- DuckDuckGo (duckduckgo.com)
|
||||
- SearXNG (searx.be)
|
||||
- Google Search (google.com)
|
||||
- Moon Search (search.naskya.net)
|
||||
- サーバーの投稿検索
|
||||
- サーバー設定の初期値を変更
|
||||
- 新規登録を無効化
|
||||
- サーバーメトリクスの表示を有効化
|
||||
|
|
|
@ -2155,3 +2155,5 @@ privacyForNerds: "Privacy protection in public places"
|
|||
disableToast: "Don't show the \"Welcome back\" banner"
|
||||
hideMyIcon: "Hide my icon"
|
||||
hideMyName: "Hide my name and ID"
|
||||
searchEngine: "Search engine used in search bar MFM"
|
||||
postSearch: "Post search on this server"
|
||||
|
|
|
@ -2009,3 +2009,5 @@ disableToast: "「おかえりなさい、◯◯さん」を表示しない"
|
|||
hideMyIcon: "自分のアイコンを表示しない"
|
||||
hideMyName: "自分の名前とIDを表示しない"
|
||||
openServerInfo: "投稿内のサーバー名をクリックでサーバー情報を開く"
|
||||
searchEngine: "検索の MFM で使用する検索エンジン"
|
||||
postSearch: "このサーバーの投稿検索"
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
import { ref } from "vue";
|
||||
import { i18n } from "@/i18n";
|
||||
import { useRouter } from "@/router";
|
||||
import { defaultStore } from "@/store";
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
|
@ -22,7 +23,9 @@ const props = defineProps<{
|
|||
const query = ref(props.q);
|
||||
|
||||
const search = () => {
|
||||
router.push(`/search/${query.value}`);
|
||||
if (defaultStore.state.searchURL === "")
|
||||
router.push(`/search?q=${query.value}`);
|
||||
else window.open(`${defaultStore.state.searchURL}${query.value}`, "_blank");
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
@ -108,6 +108,28 @@
|
|||
{{ i18n.ts._serverDisconnectedBehavior.nothing }}
|
||||
</option>
|
||||
</FormSelect>
|
||||
|
||||
<FormSelect v-model="searchURL" class="_formBlock">
|
||||
<template #label
|
||||
>{{ i18n.ts.searchEngine
|
||||
}}<span class="_beta">{{
|
||||
i18n.ts.originalFeature
|
||||
}}</span></template
|
||||
>
|
||||
<option value="https://duckduckgo.com/?q=">
|
||||
DuckDuckGo (duckduckgo.com)
|
||||
</option>
|
||||
<option value="https://searx.be/?q=">SearXNG (searx.be)</option>
|
||||
<option value="https://google.com/search?q=">
|
||||
Google Search (google.com)
|
||||
</option>
|
||||
<option value="https://search.naskya.net/?q=">
|
||||
Moon Search (search.naskya.net)
|
||||
</option>
|
||||
<option value="">
|
||||
{{ i18n.ts.postSearch }}
|
||||
</option>
|
||||
</FormSelect>
|
||||
</FormSection>
|
||||
|
||||
<FormSection>
|
||||
|
@ -481,6 +503,7 @@ const hideMyName = computed(defaultStore.makeGetterSetter("hideMyName"));
|
|||
const openServerInfo = computed(
|
||||
defaultStore.makeGetterSetter("openServerInfo"),
|
||||
);
|
||||
const searchURL = computed(defaultStore.makeGetterSetter("searchURL"));
|
||||
|
||||
watch(swipeOnDesktop, () => {
|
||||
defaultStore.set("swipeOnMobile", true);
|
||||
|
|
|
@ -393,6 +393,10 @@ export const defaultStore = markRaw(
|
|||
where: "device",
|
||||
default: true,
|
||||
},
|
||||
searchURL: {
|
||||
where: "device",
|
||||
default: "https://duckduckgo.com/?q=",
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in a new issue