From edc63891f7b8dea4eb0803f8277307a9db46a74b Mon Sep 17 00:00:00 2001
From: kozakura913 <98575220+kozakura913@users.noreply.github.com>
Date: Thu, 19 Dec 2024 13:06:46 +0900
Subject: [PATCH 1/4] wip
---
packages/frontend/src/components/MkGoogle.vue | 13 ++++++++++++-
packages/frontend/src/pages/settings/privacy.vue | 6 ++++++
packages/frontend/src/store.ts | 4 ++++
3 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/packages/frontend/src/components/MkGoogle.vue b/packages/frontend/src/components/MkGoogle.vue
index da7bcde4d8..b52f6ae4c2 100644
--- a/packages/frontend/src/components/MkGoogle.vue
+++ b/packages/frontend/src/components/MkGoogle.vue
@@ -12,7 +12,12 @@ SPDX-License-Identifier: AGPL-3.0-only
diff --git a/packages/frontend/src/pages/settings/privacy.vue b/packages/frontend/src/pages/settings/privacy.vue
index 0c8e81266e..a89001350b 100644
--- a/packages/frontend/src/pages/settings/privacy.vue
+++ b/packages/frontend/src/pages/settings/privacy.vue
@@ -100,6 +100,11 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.keepCw }}
+
+
+ {{ i18n.ts.search }}
+ {{ i18n.ts._embedCodeGen.maxHeightDescription }}
+
@@ -135,6 +140,7 @@ const defaultNoteSearchbility = computed(defaultStore.makeGetterSetter('defaultN
const rememberNoteSearchbility = computed(defaultStore.makeGetterSetter('rememberNoteSearchbility'));
const rememberNoteVisibility = computed(defaultStore.makeGetterSetter('rememberNoteVisibility'));
const keepCw = computed(defaultStore.makeGetterSetter('keepCw'));
+const searchEngine = computed(defaultStore.makeGetterSetter('searchEngine'));
function save() {
console.log(typeof(searchableBy.value));
diff --git a/packages/frontend/src/store.ts b/packages/frontend/src/store.ts
index f2b3d35c94..bf4c1f3607 100644
--- a/packages/frontend/src/store.ts
+++ b/packages/frontend/src/store.ts
@@ -153,6 +153,10 @@ export const defaultStore = markRaw(new Storage('base', {
where: 'account',
default: [] as string[],
},
+ searchEngine: {
+ where: 'account',
+ default: '/search?q=%s',
+ },
menu: {
where: 'deviceAccount',
From fff5069b480648aecb7813ff969f2e781d119c68 Mon Sep 17 00:00:00 2001
From: kozakura913 <98575220+kozakura913@users.noreply.github.com>
Date: Thu, 19 Dec 2024 13:32:28 +0900
Subject: [PATCH 2/4] fix
---
packages/frontend/src/pages/settings/privacy.vue | 1 +
1 file changed, 1 insertion(+)
diff --git a/packages/frontend/src/pages/settings/privacy.vue b/packages/frontend/src/pages/settings/privacy.vue
index a89001350b..520c2c63a6 100644
--- a/packages/frontend/src/pages/settings/privacy.vue
+++ b/packages/frontend/src/pages/settings/privacy.vue
@@ -115,6 +115,7 @@ import MkSelect from '@/components/MkSelect.vue';
import FormSection from '@/components/form/section.vue';
import MkFolder from '@/components/MkFolder.vue';
import MkInfo from '@/components/MkInfo.vue';
+import MkInput from '@/components/MkInput.vue';
import { misskeyApi } from '@/scripts/misskey-api.js';
import { defaultStore } from '@/store.js';
import { i18n } from '@/i18n.js';
From 01d2a4771d2bd3d148d413556dec969ecea298de Mon Sep 17 00:00:00 2001
From: kozakura913 <98575220+kozakura913@users.noreply.github.com>
Date: Thu, 19 Dec 2024 13:41:07 +0900
Subject: [PATCH 3/4] encodeURIComponent
---
packages/frontend/src/components/MkGoogle.vue | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/packages/frontend/src/components/MkGoogle.vue b/packages/frontend/src/components/MkGoogle.vue
index b52f6ae4c2..21bc007c37 100644
--- a/packages/frontend/src/components/MkGoogle.vue
+++ b/packages/frontend/src/components/MkGoogle.vue
@@ -26,9 +26,7 @@ const props = defineProps<{
const query = ref(props.q);
const search = () => {
- const sp = new URLSearchParams();
- sp.append('q', query.value);
- const searchUrl = String(defaultStore.state.searchEngine).replaceAll('%s', sp.toString());
+ const searchUrl = String(defaultStore.state.searchEngine).replaceAll('%s', encodeURIComponent(query.value));
const url = new URL(searchUrl, local);
if (url.origin === local) {
router.push(url.toString().substring(local.length));
From 6961de7718a84cc394e35e7336b2e8845025667c Mon Sep 17 00:00:00 2001
From: kozakura913 <98575220+kozakura913@users.noreply.github.com>
Date: Thu, 19 Dec 2024 13:57:50 +0900
Subject: [PATCH 4/4] locale
---
locales/index.d.ts | 4 ++++
locales/ja-JP.yml | 1 +
packages/frontend/src/pages/settings/privacy.vue | 4 ++--
3 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/locales/index.d.ts b/locales/index.d.ts
index 7f5c05d572..3d4bbde9e9 100644
--- a/locales/index.d.ts
+++ b/locales/index.d.ts
@@ -4211,6 +4211,10 @@ export interface Locale extends ILocale {
* CWを維持する
*/
"keepCw": string;
+ /**
+ * %sが検索語句に置き換えられます
+ */
+ "searchEngineDescription": string;
/**
* Pub/Subのアカウント
*/
diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml
index b85892a01c..e6d58b45b2 100644
--- a/locales/ja-JP.yml
+++ b/locales/ja-JP.yml
@@ -1044,6 +1044,7 @@ usernameInfo: "サーバー上であなたのアカウントを一意に識別
aiChanMode: "藍モード"
devMode: "開発者モード"
keepCw: "CWを維持する"
+searchEngineDescription: "%sが検索語句に置き換えられます"
pubSub: "Pub/Subのアカウント"
lastCommunication: "直近の通信"
resolved: "解決済み"
diff --git a/packages/frontend/src/pages/settings/privacy.vue b/packages/frontend/src/pages/settings/privacy.vue
index 520c2c63a6..6c883f4a85 100644
--- a/packages/frontend/src/pages/settings/privacy.vue
+++ b/packages/frontend/src/pages/settings/privacy.vue
@@ -102,8 +102,8 @@ SPDX-License-Identifier: AGPL-3.0-only
{{ i18n.ts.keepCw }}
- {{ i18n.ts.search }}
- {{ i18n.ts._embedCodeGen.maxHeightDescription }}
+ {{ i18n.ts.search }}yojo-art
+ {{ i18n.ts.searchEngineDescription }}