131 lines
7.3 KiB
JSON
131 lines
7.3 KiB
JSON
{
|
|
"categories": [
|
|
{
|
|
"background": "color\u003d#8886C8",
|
|
"id": "2d3ab593-ca66-47f5-9506-c3d211b2657d",
|
|
"name": "Hydrus",
|
|
"shortcuts": [
|
|
{
|
|
"codeOnPrepare": "if (getVariable(/*[variable]*/\"790c08b8-6204-4f7f-8e8e-e6a4806017bc\"/*[/variable]*/) \u003d\u003d \"\") {\n setVariable(/*[variable]*/\"790c08b8-6204-4f7f-8e8e-e6a4806017bc\"/*[/variable]*/, prompt(\"Please enter your Hydrus ClientAPI URL\"));\n}\n\nif (getVariable(/*[variable]*/\"790c08b8-6204-4f7f-8e8e-e6a4806017bc\"/*[/variable]*/) \u003d\u003d \"\") {\n showToast(\"Hydrus ClientAPI URL still empty, aborting.\");\n abort();\n}\n\nif (getVariable(/*[variable]*/\"2c7bf1c2-dabd-41fd-b572-8a67575f07c7\"/*[/variable]*/) \u003d\u003d \"\") {\n if (confirm(\"If you want to request an API key, please start the \u0027API request\u0027 dialogue in Hydrus, then press OK. If you want to enter your API key manually, press Cancel.\")) {\n executeShortcut(/*[shortcut]*/\"b20986e7-40c5-4287-81c9-7a32f7f41913\"/*[/shortcut]*/);\n } else {\n setVariable(/*[variable]*/\"2c7bf1c2-dabd-41fd-b572-8a67575f07c7\"/*[/variable]*/, promptPassword(\"Please enter your Hydrus API key\"));\n }\n}\n\nif (getVariable(/*[variable]*/\"2c7bf1c2-dabd-41fd-b572-8a67575f07c7\"/*[/variable]*/) \u003d\u003d \"\") {\n showToast(\"Hydrus API key still empty, aborting.\");\n abort();\n}",
|
|
"description": "Asks for Hydrus URL and API key",
|
|
"executionType": "scripting",
|
|
"iconName": "custom-icon_04e0e038-6af2-4bce-91fd-bece7728a1d3.png",
|
|
"id": "15a66167-d819-431d-a616-46d36bafaa88",
|
|
"name": "Setup Hydrus Variables"
|
|
},
|
|
{
|
|
"bodyContent": "{\n \"url\" : \"{{4d098304-464a-4c2a-9e5e-e43b68c13814}}\",\n \"destination_page_name\" : \"phone url import\"\n}",
|
|
"codeOnPrepare": "executeShortcut(/*[shortcut]*/\"15a66167-d819-431d-a616-46d36bafaa88\"/*[/shortcut]*/);",
|
|
"codeOnSuccess": "setVariable(/*[variable]*/\"2c7bf1c2-dabd-41fd-b572-8a67575f07c7\"/*[/variable]*/, JSON.parse(response.body).access_key);",
|
|
"contentType": "application/json",
|
|
"description": "Request an API key from Hydrus",
|
|
"iconName": "custom-icon_04e0e038-6af2-4bce-91fd-bece7728a1d3.png",
|
|
"id": "b20986e7-40c5-4287-81c9-7a32f7f41913",
|
|
"name": "Request key",
|
|
"responseHandling": {
|
|
"failureOutput": "simple",
|
|
"successMessage": "API key was saved.",
|
|
"successOutput": "message",
|
|
"uiType": "toast"
|
|
},
|
|
"retryPolicy": "wait_for_internet",
|
|
"url": "{{790c08b8-6204-4f7f-8e8e-e6a4806017bc}}/request_new_permissions?name\u003dPhone\u0026basic_permissions\u003d[0,1]"
|
|
},
|
|
{
|
|
"bodyContent": "{\n \"url\" : \"{{4d098304-464a-4c2a-9e5e-e43b68c13814}}\",\n \"destination_page_name\" : \"phone url import\"\n}",
|
|
"codeOnPrepare": "executeShortcut(/*[shortcut]*/\"15a66167-d819-431d-a616-46d36bafaa88\"/*[/shortcut]*/);",
|
|
"codeOnSuccess": "var toast \u003d \"API key is valid.\\n\"\nvar url \u003d JSON.parse(response.body).basic_permissions.includes(0)\nvar file \u003d JSON.parse(response.body).basic_permissions.includes(1)\n\nif (!url \u0026\u0026 !file) {\n toast +\u003d \"All permissions missing!\";\n} else if (!url) {\n toast +\u003d \"URL permission missing!\";\n} else if (!file) {\n toast +\u003d \"File permission missing!\";\n}\n\nshowToast(toast);",
|
|
"contentType": "application/json",
|
|
"description": "Verifies API key with Hydrus",
|
|
"headers": [
|
|
{
|
|
"id": "291d20d2-9729-4d65-9fa7-96cba40981cb",
|
|
"key": "Hydrus-Client-API-Access-Key",
|
|
"value": "{{2c7bf1c2-dabd-41fd-b572-8a67575f07c7}}"
|
|
}
|
|
],
|
|
"iconName": "custom-icon_04e0e038-6af2-4bce-91fd-bece7728a1d3.png",
|
|
"id": "923939ae-1e9a-4f69-89f2-820d30065d35",
|
|
"name": "Verify key",
|
|
"responseHandling": {
|
|
"failureOutput": "simple",
|
|
"successOutput": "none",
|
|
"uiType": "toast"
|
|
},
|
|
"retryPolicy": "wait_for_internet",
|
|
"url": "{{790c08b8-6204-4f7f-8e8e-e6a4806017bc}}/verify_access_key"
|
|
},
|
|
{
|
|
"codeOnPrepare": "executeShortcut(/*[shortcut]*/\"15a66167-d819-431d-a616-46d36bafaa88\"/*[/shortcut]*/);",
|
|
"codeOnSuccess": "var toast \u003d \"File \"\nvar status \u003d JSON.parse(response.body).status\n\nswitch (status) {\n case 1:\n toast +\u003d \"was successfully imported.\";\n break;\n case 2:\n toast +\u003d \"already in database.\";\n break;\n case 3:\n toast +\u003d \"previously deleted.\";\n break;\n case 4:\n toast +\u003d \"failed to import.\";\n break;\n case 7:\n toast +\u003d \"vetoed.\";\n break;\n}\n\nshowToast(toast);",
|
|
"contentType": "application/octet-stream",
|
|
"description": "Sends a file to Hydrus",
|
|
"headers": [
|
|
{
|
|
"id": "220ca30b-27e0-4d2f-b4dc-88a76f492dee",
|
|
"key": "Hydrus-Client-API-Access-Key",
|
|
"value": "{{2c7bf1c2-dabd-41fd-b572-8a67575f07c7}}"
|
|
}
|
|
],
|
|
"iconName": "custom-icon_04e0e038-6af2-4bce-91fd-bece7728a1d3.png",
|
|
"id": "22484fb3-bff9-470c-a699-38aaf825331f",
|
|
"method": "POST",
|
|
"name": "Send file",
|
|
"requestBodyType": "file",
|
|
"responseHandling": {
|
|
"failureOutput": "simple",
|
|
"successMessage": "File was sent to Hydrus.",
|
|
"successOutput": "message",
|
|
"uiType": "toast"
|
|
},
|
|
"retryPolicy": "wait_for_internet",
|
|
"url": "{{790c08b8-6204-4f7f-8e8e-e6a4806017bc}}/add_files/add_file"
|
|
},
|
|
{
|
|
"bodyContent": "{\n \"url\" : \"{{4d098304-464a-4c2a-9e5e-e43b68c13814}}\",\n \"destination_page_name\" : \"phone url import\"\n}",
|
|
"codeOnPrepare": "executeShortcut(/*[shortcut]*/\"15a66167-d819-431d-a616-46d36bafaa88\"/*[/shortcut]*/);",
|
|
"contentType": "application/json",
|
|
"description": "Sends a URL to Hydrus",
|
|
"headers": [
|
|
{
|
|
"id": "0d5b861f-5ad7-4fb2-8661-ed856a540134",
|
|
"key": "Hydrus-Client-API-Access-Key",
|
|
"value": "{{2c7bf1c2-dabd-41fd-b572-8a67575f07c7}}"
|
|
}
|
|
],
|
|
"iconName": "custom-icon_04e0e038-6af2-4bce-91fd-bece7728a1d3.png",
|
|
"id": "db09da4e-69ff-4500-8a6d-3b0adfd5cac9",
|
|
"method": "POST",
|
|
"name": "Send URL",
|
|
"responseHandling": {
|
|
"failureOutput": "simple",
|
|
"successMessage": "{{4d098304-464a-4c2a-9e5e-e43b68c13814}} was sent to Hydrus.",
|
|
"successOutput": "message",
|
|
"uiType": "toast"
|
|
},
|
|
"retryPolicy": "wait_for_internet",
|
|
"url": "{{790c08b8-6204-4f7f-8e8e-e6a4806017bc}}/add_urls/add_url"
|
|
}
|
|
]
|
|
}
|
|
],
|
|
"variables": [
|
|
{
|
|
"flags": 1,
|
|
"id": "4d098304-464a-4c2a-9e5e-e43b68c13814",
|
|
"key": "hydrus_add_url",
|
|
"type": "text"
|
|
},
|
|
{
|
|
"id": "2c7bf1c2-dabd-41fd-b572-8a67575f07c7",
|
|
"key": "hydrus_api_key",
|
|
"value": ""
|
|
},
|
|
{
|
|
"id": "790c08b8-6204-4f7f-8e8e-e6a4806017bc",
|
|
"key": "hydrus_url",
|
|
"value": ""
|
|
}
|
|
],
|
|
"version": 59
|
|
} |