From d69465b22983e7d3c929228f798f344fdbe9af7c Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:07:32 +0000 Subject: [PATCH 1/2] Add Log Response Body option --- .../tools/webRequest/1.0.0/index.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/FlowPluginsTs/CommunityFlowPlugins/tools/webRequest/1.0.0/index.ts b/FlowPluginsTs/CommunityFlowPlugins/tools/webRequest/1.0.0/index.ts index 92cd8d6..486ba5b 100644 --- a/FlowPluginsTs/CommunityFlowPlugins/tools/webRequest/1.0.0/index.ts +++ b/FlowPluginsTs/CommunityFlowPlugins/tools/webRequest/1.0.0/index.ts @@ -74,6 +74,16 @@ const details = (): IpluginDetails => ({ }, tooltip: 'Specify request body', }, + { + label: 'Log Response Body', + name: 'logResponseBody', + type: 'boolean', + defaultValue: 'false', + inputUI: { + type: 'switch', + }, + tooltip: 'Specify whether to log response body in the job report', + }, ], outputs: [ { @@ -93,6 +103,7 @@ const plugin = async (args: IpluginInputArgs): Promise => { const requestUrl = String(args.inputs.requestUrl); const requestHeaders = JSON.parse(String(args.inputs.requestHeaders)); const requestBody = JSON.parse(String(args.inputs.requestBody)); + const { logResponseBody } = args.inputs; const requestConfig = { method, @@ -104,6 +115,10 @@ const plugin = async (args: IpluginInputArgs): Promise => { try { const res = await args.deps.axios(requestConfig); args.jobLog(`Web request succeeded: Status Code: ${res.status}`); + + if (logResponseBody) { + args.jobLog(`Response Body: ${JSON.stringify(res.data)}`); + } } catch (err) { args.jobLog('Web Request Failed'); args.jobLog(JSON.stringify(err)); From fe53c48ccd33d3f3cbd97f9a4b657ff1376d9d14 Mon Sep 17 00:00:00 2001 From: HaveAGitGat <43864057+HaveAGitGat@users.noreply.github.com> Date: Mon, 3 Feb 2025 18:09:11 +0000 Subject: [PATCH 2/2] Apply auto-build changes --- .../file/deleteFile/1.0.0/index.js | 2 +- .../tools/webRequest/1.0.0/index.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/FlowPlugins/CommunityFlowPlugins/file/deleteFile/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/file/deleteFile/1.0.0/index.js index 40d2c70..bf2ce69 100644 --- a/FlowPlugins/CommunityFlowPlugins/file/deleteFile/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/file/deleteFile/1.0.0/index.js @@ -42,7 +42,7 @@ var fileUtils_1 = require("../../../../FlowHelpers/1.0.0/fileUtils"); /* eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }] */ var details = function () { return ({ name: 'Delete File', - description: 'Delete the working file or original file.', + description: "\n Delete the working file or original file.\n You don't need to use this plugin to clean up files in the cache, Tdarr will do this automatically after the flow.\n To manually clear the cache, use the 'Clear Cache' flow plugin.\n ", style: { borderColor: 'red', }, diff --git a/FlowPlugins/CommunityFlowPlugins/tools/webRequest/1.0.0/index.js b/FlowPlugins/CommunityFlowPlugins/tools/webRequest/1.0.0/index.js index 64a1712..c4e3c24 100644 --- a/FlowPlugins/CommunityFlowPlugins/tools/webRequest/1.0.0/index.js +++ b/FlowPlugins/CommunityFlowPlugins/tools/webRequest/1.0.0/index.js @@ -103,6 +103,16 @@ var details = function () { return ({ }, tooltip: 'Specify request body', }, + { + label: 'Log Response Body', + name: 'logResponseBody', + type: 'boolean', + defaultValue: 'false', + inputUI: { + type: 'switch', + }, + tooltip: 'Specify whether to log response body in the job report', + }, ], outputs: [ { @@ -114,7 +124,7 @@ var details = function () { return ({ exports.details = details; // eslint-disable-next-line @typescript-eslint/no-unused-vars var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function () { - var lib, method, requestUrl, requestHeaders, requestBody, requestConfig, res, err_1; + var lib, method, requestUrl, requestHeaders, requestBody, logResponseBody, requestConfig, res, err_1; return __generator(this, function (_a) { switch (_a.label) { case 0: @@ -125,6 +135,7 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function requestUrl = String(args.inputs.requestUrl); requestHeaders = JSON.parse(String(args.inputs.requestHeaders)); requestBody = JSON.parse(String(args.inputs.requestBody)); + logResponseBody = args.inputs.logResponseBody; requestConfig = { method: method, url: requestUrl, @@ -138,6 +149,9 @@ var plugin = function (args) { return __awaiter(void 0, void 0, void 0, function case 2: res = _a.sent(); args.jobLog("Web request succeeded: Status Code: ".concat(res.status)); + if (logResponseBody) { + args.jobLog("Response Body: ".concat(JSON.stringify(res.data))); + } return [3 /*break*/, 4]; case 3: err_1 = _a.sent();