From 3bed0b4471473ca24d4091db3d56808e37932f2e Mon Sep 17 00:00:00 2001 From: bunnybeam Date: Wed, 26 Feb 2025 00:11:28 +0000 Subject: [PATCH] Link Action v1.0.0 --- link-action.ais | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 link-action.ais diff --git a/link-action.ais b/link-action.ais new file mode 100644 index 0000000..2b308a6 --- /dev/null +++ b/link-action.ais @@ -0,0 +1,33 @@ +/// @ 0.19.0 +### { + name: "Link Action" + version: "1.0.0" + author: "@bunnybeam@transfem.social" + description: "Add post form actions that navigate to a specified page when clicked." + config: { + links: { + type: "string" + label: "Links" + description: "List of links, each in the form 'label*link'." + default: "Link Action on Kitsudev*https://kitsunes.dev/bunnybeam/misskey-plugins/src/branch/main/link-action.ais,plugin settings*settings/plugin" + } + } +} + +// Get the list of links by splitting the config line and trimming the results +@get_link_list() { + let raw_list = Plugin:config.links.split(",") + let new_list = [] + each let name, raw_list { + new_list.push(name.trim()) + } + return new_list +} + +// Register post form actions for each link +each let link, get_link_list() { + let parts = link.split("*") + Plugin:register_post_form_action(`Go to {parts[0]}`, @(note, rewrite) { + Plugin:open_url(parts[1]) + }) +}