actually make patches work

This commit is contained in:
Chaos 2022-12-28 19:16:16 +00:00
parent 09f47e0cd0
commit 962f981d83
No known key found for this signature in database
4 changed files with 49 additions and 8 deletions

View file

@ -4,9 +4,10 @@
then "/secrets/music_stream_password"
else "$HOME/.secrets/music_stream_password";
in {
home.packages = with pkgs; [mpv ffmpeg yt-dlp];
home.packages = with pkgs; [ffmpeg yt-dlp];
programs.mpv = {
enable = true;
scripts = with pkgs.mpvScripts; [ mpris ];
config = {
script-opts = "ytdl_hook-ytdl_path=${pkgs.yt-dlp}/bin/yt-dlp";
slang = "en";

View file

@ -138,10 +138,6 @@ in {
}
];
ensureDatabases = ["misskey"];
initialScript = pkgs.writeText "init" ''
create user misskey with password 'password';
grant all privileges on database misskey to misskey;
'';
};
services.redis.servers."misskey" = {

View file

@ -19,11 +19,15 @@ in
inherit version src;
# some of my own personal patches
# copy-link-non-monospace doesn't do much on https, no idea why
patches = [./copy-link-non-monospace.patch ./reorder-note-menu.patch];
patches = [
# Nya!
./search-allow-query-posts-and-users.patch
./copy-link-non-monospace.patch
./reorder-note-menu.patch
];
installPhase = ''
cp -r $src $out
cp -r . $out
'';
meta = with lib; {

View file

@ -0,0 +1,40 @@
diff --git a/packages/client/src/pages/search.vue b/packages/client/src/pages/search.vue
index c080b76..cdfb47c 100644
--- a/packages/client/src/pages/search.vue
+++ b/packages/client/src/pages/search.vue
@@ -12,12 +12,35 @@ import { computed } from 'vue';
import XNotes from '@/components/MkNotes.vue';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
+import * as os from '@/os';
+import { mainRouter } from '@/router';
const props = defineProps<{
query: string;
channel?: string;
}>();
+const query = props.query;
+
+# TODO: get this to work without being logged in
+if (localStorage.getItem('account') != null) {
+ if (query.startsWith('https://') || (query.startsWith('@') && !query.includes(' '))) {
+ const promise = os.api('ap/show', {
+ uri: props.query,
+ });
+
+ os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
+
+ const res = await promise;
+
+ if (res.type === 'User') {
+ mainRouter.replace(`/@${res.object.username}@${res.object.host}`);
+ } else if (res.type === 'Note') {
+ mainRouter.replace(`/notes/${res.object.id}`);
+ }
+ }
+}
+
const pagination = {
endpoint: 'notes/search' as const,
limit: 10,