forked from bunnybeam/misskey-plugins
33 lines
919 B
Text
33 lines
919 B
Text
/// @ 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])
|
|
})
|
|
}
|