Last active
June 10, 2022 13:16
-
-
Save ThinaticSystem/b222efcbfb306f2704c69c70b84ed91a to your computer and use it in GitHub Desktop.
クエリリムーバ(Misskeyプラグイン)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### { | |
name: "クエリリムーバ" | |
author: "@[email protected]" | |
version: 6 | |
description: "投稿フォームに入力された文字列からURLクエリパラメータを除去して投稿します。クエリパラメータを削除したいURLの直後にconfigで指定した末端識別文字列を入れてください。" | |
permissions: [] | |
config: { | |
endStr: { | |
type: "string" | |
label: "末端識別文字列" | |
description: "URLの末尾を識別するために探す文字列です。" | |
default: "??" | |
} | |
} | |
} | |
@removeQueryParam(note) { | |
? (Str:incl(note.text Plugin:config.endStr) = no) { | |
<< note | |
} | |
note.text <- Str:replace( | |
note.text | |
Str:slice( | |
note.text | |
Str:index_of(note.text "?") | |
(Str:index_of(note.text Plugin:config.endStr) + Str:len(Plugin:config.endStr)) | |
) | |
"" | |
) | |
removeQueryParam(note) | |
} | |
// 画像だけのテキストなし投稿のときnullが入るので先に分岐で抜ける | |
@checkNoText(note) { | |
? (note.text = _) { | |
<< note | |
} | |
removeQueryParam(note) | |
} | |
Plugin:register_note_post_interruptor(checkNoText) |
v4
複数URLのクエリパラメータ除去に対応
v5
テキストなし画像投稿ができない問題を修正
コードブロックの中は無視するみたいな実装が必要そう
honi = funi?.nuto ?? mope;
って投稿しようとしたら吹き飛んでパニックになった
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
v3
v2以前でのアクション一覧から実行してコピーして…という形式を廃止し
http://example.com/debobi?honi=funi??
のようにURLの直後に末端識別文字列??
が付いているURLからクエリパラメータを投稿時に自動で削除するようにしました。末端識別文字列
??
は設定でカスタマイズできます。