From 343d19087bad763fa05ebbae03d1f035b4a1beb5 Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Sat, 21 Jun 2025 15:56:00 +0200 Subject: [PATCH 01/10] add service sftpgo --- src/components/services/Sftpgo.vue | 91 ++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 src/components/services/Sftpgo.vue diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue new file mode 100644 index 0000000..73a7b6e --- /dev/null +++ b/src/components/services/Sftpgo.vue @@ -0,0 +1,91 @@ + + + + + From 47bd7ec0a2a8086aad4a4cd6e5751faceede6f8c Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Sat, 21 Jun 2025 21:25:47 +0200 Subject: [PATCH 02/10] update customerservices --- docs/customservices.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/customservices.md b/docs/customservices.md index c1f0812..502c5b5 100644 --- a/docs/customservices.md +++ b/docs/customservices.md @@ -48,6 +48,7 @@ within Homer: - [rTorrent](#rtorrent) - [SABnzbd](#sabnzbd) - [Scrutiny](#scrutiny) +- [SFTPGo](#sftpgo) - [Speedtest Tracker](#speedtesttracker) - [Tautulli](#tautulli) - [Tdarr](#tdarr) @@ -646,6 +647,20 @@ This service displays info about the total number of disk passed and failed S.M. updateInterval: 5000 # (Optional) Interval (in ms) for updating the status ``` +## SFTPGo + +This service displays a version string instead of a subtitle. +And this service display the number of active connections +The indicator shows SFTPGo is online, offline. Example configuration: + +```yaml +- name: "SFTPGO container" + type: "SFTPGo" + logo: assets/tools/sample.png + url: http://sftp-go.example.com + sftpgo_api_key: 'hYdn26pTteWZNzbAXoiqgR.jG7TKwtoMRAMrJAGgdr3Ha' +``` + ## SpeedtestTracker This service will show the download and upload speeds in Mbit/s and the ping in ms. From fe0e164659cca012987c1170778907a79cb7110e Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Sat, 21 Jun 2025 21:28:07 +0200 Subject: [PATCH 03/10] add number of active connections and i renamed sftpgo_api_key to sftpgoApiKey to maintain naming consistency with the rest of the codebase --- src/components/services/Sftpgo.vue | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue index 73a7b6e..3b4e2f5 100644 --- a/src/components/services/Sftpgo.vue +++ b/src/components/services/Sftpgo.vue @@ -6,8 +6,11 @@ - @@ -23,7 +26,7 @@ import service from "@/mixins/service.js"; export default { - name: "Sftgo", + name: "SFTPGo", mixins: [service], props: { item: Object, @@ -31,6 +34,7 @@ export default { data: () => ({ fetchOk: null, versionstring: null, + activeConnections: null, }), computed: { status: function () { @@ -43,13 +47,17 @@ export default { methods: { fetchStatus: async function () { let headers = {}; - if (this.item.sftpgo_api_key) { - headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgo_api_key}`; + if (this.item.sftpgoApiKey) { + headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgoApiKey}`; } try { const response = await this.fetch("/api/v2/version", { headers }); - this.fetchOk = true; this.versionstring = response.version || "inconnue"; + + const connResponse = await this.fetch("/api/v2/connections", { headers }); + this.activeConnections = Array.isArray(connResponse) ? connResponse.length : null; + + this.fetchOk = true; } catch (e) { this.fetchOk = false; console.log(e); From 6500ecb4ec5f09dd0353c4663e48199069bce2e8 Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Sat, 21 Jun 2025 21:29:09 +0200 Subject: [PATCH 04/10] i renamed sftpgo_api_key to sftpgoApiKey --- docs/customservices.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/customservices.md b/docs/customservices.md index 502c5b5..32e1d97 100644 --- a/docs/customservices.md +++ b/docs/customservices.md @@ -658,7 +658,7 @@ The indicator shows SFTPGo is online, offline. Example configuration: type: "SFTPGo" logo: assets/tools/sample.png url: http://sftp-go.example.com - sftpgo_api_key: 'hYdn26pTteWZNzbAXoiqgR.jG7TKwtoMRAMrJAGgdr3Ha' + sftpgoApiKey: 'hYdn26pTteWZNzbAXoiqgR.jG7TKwtoMRAMrJAGgdr3Ha' ``` ## SpeedtestTracker From df9f4cb3cb317cf6d45569b59fb29ed12f830a08 Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Sat, 21 Jun 2025 21:36:47 +0200 Subject: [PATCH 05/10] fix: use snake_case (sftpgo_api_key) instead of camelCase (sftpgoApiKey) to match Homer conventions --- docs/customservices.md | 2 +- src/components/services/Sftpgo.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/customservices.md b/docs/customservices.md index 32e1d97..90163f0 100644 --- a/docs/customservices.md +++ b/docs/customservices.md @@ -658,7 +658,7 @@ The indicator shows SFTPGo is online, offline. Example configuration: type: "SFTPGo" logo: assets/tools/sample.png url: http://sftp-go.example.com - sftpgoApiKey: 'hYdn26pTteWZNzbAXoiqgR.jG7TKwtoMRAMrJAGgdr3Ha' + sftpgo_api_key: "hYdn26pTteWZNzbAXoiqgR.jG7TKwtoMRAMrJAGgdr3Ha" ``` ## SpeedtestTracker diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue index 3b4e2f5..b44474c 100644 --- a/src/components/services/Sftpgo.vue +++ b/src/components/services/Sftpgo.vue @@ -47,8 +47,8 @@ export default { methods: { fetchStatus: async function () { let headers = {}; - if (this.item.sftpgoApiKey) { - headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgoApiKey}`; + if (this.item.sftpgo_api_key) { + headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgo_api_key}`; } try { const response = await this.fetch("/api/v2/version", { headers }); From 440160fc6a9440a4ab8b05be34c1ea66d7ead9cd Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Wed, 2 Jul 2025 13:14:04 +0200 Subject: [PATCH 06/10] fix english/french (api version) unknown --- src/components/services/Sftpgo.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue index b44474c..3424e23 100644 --- a/src/components/services/Sftpgo.vue +++ b/src/components/services/Sftpgo.vue @@ -52,7 +52,7 @@ export default { } try { const response = await this.fetch("/api/v2/version", { headers }); - this.versionstring = response.version || "inconnue"; + this.versionstring = response.version || "unknown"; const connResponse = await this.fetch("/api/v2/connections", { headers }); this.activeConnections = Array.isArray(connResponse) ? connResponse.length : null; From 2d7b8e3eef2f909a24adcfa657de7b1743e27d95 Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Wed, 2 Jul 2025 14:07:01 +0200 Subject: [PATCH 07/10] fix dual call fetch with one RTT (Promise.all) --- src/components/services/Sftpgo.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue index 3424e23..d8bf8bb 100644 --- a/src/components/services/Sftpgo.vue +++ b/src/components/services/Sftpgo.vue @@ -51,16 +51,17 @@ export default { headers["X-SFTPGO-API-KEY"] = `${this.item.sftpgo_api_key}`; } try { - const response = await this.fetch("/api/v2/version", { headers }); - this.versionstring = response.version || "unknown"; + const [versionRes, connRes] = await Promise.all([ + this.fetch("/api/v2/version", { headers }), + this.fetch("/api/v2/connections", { headers }), + ]); - const connResponse = await this.fetch("/api/v2/connections", { headers }); - this.activeConnections = Array.isArray(connResponse) ? connResponse.length : null; + this.versionstring = versionRes.version || "unknown"; + this.activeConnections = connRes.length; this.fetchOk = true; } catch (e) { this.fetchOk = false; - console.log(e); } }, }, From 000b076ca033303535b84f8c0e3608ed41bd7ce4 Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Wed, 2 Jul 2025 14:11:34 +0200 Subject: [PATCH 08/10] fix version mobile hidden connection on mobile --- docs/customservices.md | 2 +- src/components/services/Sftpgo.vue | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/customservices.md b/docs/customservices.md index 90163f0..a6afb12 100644 --- a/docs/customservices.md +++ b/docs/customservices.md @@ -650,7 +650,7 @@ This service displays info about the total number of disk passed and failed S.M. ## SFTPGo This service displays a version string instead of a subtitle. -And this service display the number of active connections +And this service display the number of active connections is hidden on small screen. The indicator shows SFTPGo is online, offline. Example configuration: ```yaml diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue index d8bf8bb..d94957c 100644 --- a/src/components/services/Sftpgo.vue +++ b/src/components/services/Sftpgo.vue @@ -8,7 +8,7 @@ @@ -40,11 +40,17 @@ export default { status: function () { return this.fetchOk ? "online" : "offline"; }, + showUpdateAvailable: function () { + return this.isSmallScreenMethod(); + }, }, created() { this.fetchStatus(); }, methods: { + isSmallScreenMethod: function () { + return window.matchMedia("screen and (max-width: 1023px)").matches; + }, fetchStatus: async function () { let headers = {}; if (this.item.sftpgo_api_key) { From 278ce562e5052b54989555b9d3894797551b984e Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Wed, 2 Jul 2025 15:30:44 +0200 Subject: [PATCH 09/10] add dummy data service sftpgo --- dummy-data/sftpgo/api/v2/connections | 22 ++++++++++++++++++++++ dummy-data/sftpgo/api/v2/version | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 dummy-data/sftpgo/api/v2/connections create mode 100644 dummy-data/sftpgo/api/v2/version diff --git a/dummy-data/sftpgo/api/v2/connections b/dummy-data/sftpgo/api/v2/connections new file mode 100644 index 0000000..8c30f6a --- /dev/null +++ b/dummy-data/sftpgo/api/v2/connections @@ -0,0 +1,22 @@ +[ + { + "username": "test", + "connection_id": "SFTP_94f5b2b9f379173fa9cd0b8a836a7f40d860e4299e167793722d1e957a94e4d2_1", + "client_version": "SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.13", + "remote_address": "192.168.1.15:37616", + "connection_time": 1751462552179, + "last_activity": 1751462552179, + "current_time": 1751462680531, + "protocol": "SFTP" + }, + { + "username": "test", + "connection_id": "SFTP_f50a640bded5f2dda3f9861b0f73c1d9220fe65da1de1bbb5c549618221a6455_1", + "client_version": "SSH-2.0-OpenSSH_8.9p1 Ubuntu-3ubuntu0.13", + "remote_address": "192.168.1.15:37680", + "connection_time": 1751462590652, + "last_activity": 1751462590652, + "current_time": 1751462680531, + "protocol": "SFTP" + } +] diff --git a/dummy-data/sftpgo/api/v2/version b/dummy-data/sftpgo/api/v2/version new file mode 100644 index 0000000..6602f7a --- /dev/null +++ b/dummy-data/sftpgo/api/v2/version @@ -0,0 +1,17 @@ +{ + "version": "2.6.6", + "build_date": "2025-02-24T18:47:26Z", + "commit_hash": "6825db76", + "features": [ + "+metrics", + "+azblob", + "+gcs", + "+s3", + "+bolt", + "+mysql", + "+pgsql", + "+sqlite", + "+unixcrypt", + "+portable" + ] +} From 7db55c658083baf8e165e302c94d5d8ab821a570 Mon Sep 17 00:00:00 2001 From: 3thibaut1304 Date: Wed, 2 Jul 2025 16:43:54 +0200 Subject: [PATCH 10/10] fix catch ('e' is defined but never used) --- src/components/services/Sftpgo.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/services/Sftpgo.vue b/src/components/services/Sftpgo.vue index d94957c..5d142b3 100644 --- a/src/components/services/Sftpgo.vue +++ b/src/components/services/Sftpgo.vue @@ -67,6 +67,7 @@ export default { this.fetchOk = true; } catch (e) { + console.error(e); this.fetchOk = false; } },