mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-25 03:17:38 -07:00
Added custom search engine
This commit is contained in:
parent
ef5accd92c
commit
e1481fc8ee
4 changed files with 6 additions and 2 deletions
1
packages/backend/src/config/sane-defaults.ts
Normal file
1
packages/backend/src/config/sane-defaults.ts
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const engine = "https://www.google.com/search?q="
|
|
@ -3,6 +3,7 @@ import type * as mfm from "mfm-js";
|
||||||
import config from "@/config/index.js";
|
import config from "@/config/index.js";
|
||||||
import { intersperse } from "@/prelude/array.js";
|
import { intersperse } from "@/prelude/array.js";
|
||||||
import type { IMentionedRemoteUsers } from "@/models/entities/note.js";
|
import type { IMentionedRemoteUsers } from "@/models/entities/note.js";
|
||||||
|
import { engine } from "@/config/sane-defaults.js";
|
||||||
|
|
||||||
export function toHtml(
|
export function toHtml(
|
||||||
nodes: mfm.MfmNode[] | null,
|
nodes: mfm.MfmNode[] | null,
|
||||||
|
@ -156,7 +157,7 @@ export function toHtml(
|
||||||
|
|
||||||
search(node) {
|
search(node) {
|
||||||
const a = doc.createElement("a");
|
const a = doc.createElement("a");
|
||||||
a.href = `https://search.annoyingorange.xyz/search?q=${node.props.query}`;
|
a.href = `${engine}{node.props.query}`;
|
||||||
a.textContent = node.props.content;
|
a.textContent = node.props.content;
|
||||||
return a;
|
return a;
|
||||||
},
|
},
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from "vue";
|
import { ref } from "vue";
|
||||||
import { i18n } from "@/i18n";
|
import { i18n } from "@/i18n";
|
||||||
|
import {engine} from "../../../../sane-defaults"
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
q: string;
|
q: string;
|
||||||
|
@ -20,7 +21,7 @@ const query = ref(props.q);
|
||||||
|
|
||||||
const search = () => {
|
const search = () => {
|
||||||
window.open(
|
window.open(
|
||||||
`https://search.annoyingorange.xyz/search?q=${query.value}`,
|
`${engine}${query.value}`,
|
||||||
"_blank",
|
"_blank",
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
1
sane-defaults.js
Normal file
1
sane-defaults.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
export const engine = "https://www.google.com/search?q="
|
Loading…
Reference in a new issue