diff --git a/packages/client/src/components/MkSearchBox.vue b/packages/client/src/components/MkSearchBox.vue index 33ff4217..6d636b0c 100644 --- a/packages/client/src/components/MkSearchBox.vue +++ b/packages/client/src/components/MkSearchBox.vue @@ -115,10 +115,20 @@ const emit = defineEmits<{ const modal = shallowRef>(); -const searchWords = ref(""); -const searchUsers = ref(""); -const searchRange = ref(""); -const searchPostsWithFiles = ref(false); +const searchParams = new URLSearchParams(window.location.search); + +const searchWords = ref(searchParams.get("q") ?? ""); +const searchUsers = ref( + searchParams.get("user") ?? searchParams.get("host") ?? "", +); +const searchRange = ref( + searchParams.has("since") || searchParams.has("until") + ? `${searchParams.get("since") ?? ""}-${ + searchParams.get("until") ?? "" + }` + : "", +); +const searchPostsWithFiles = ref(searchParams.get("withFiles") === "true"); function done(canceled: boolean, result?: searchQuery) { emit("done", { canceled, result });