From 3e0558c0e933690fdc5e4791a560b3518e20051b Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Mon, 7 Oct 2019 22:37:28 +0200 Subject: [PATCH] add web interface support to windows setup ... ... and other small improvements --- README.md | 4 +++- httpd/httpd.go | 7 ++++++- httpd/web.go | 17 +++++------------ sftpgo.iss | 25 +++++++++++++++---------- 4 files changed, 29 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index aecc871c..cc3c6061 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,9 @@ Full featured and highly configurable SFTP server - Automatically terminating idle connections. - Atomic uploads are configurable. - Optional SCP support. -- REST API for users and quota management and real time reports for the active connections with possibility of forcibly closing a connection. - Prometheus metrics are exposed. +- REST API for users and quota management and real time reports for the active connections with possibility of forcibly closing a connection. +- Web based interface to manage users and connections. - Configuration is a your choice: JSON, TOML, YAML, HCL, envfile are supported. - Log files are accurate and they are saved in the easily parsable JSON format. @@ -416,6 +417,7 @@ The logs can be divided into the following categories: - [cobra](https://github.com/spf13/cobra) - [xid](https://github.com/rs/xid) - [nathanaelle/password](https://github.com/nathanaelle/password) +- [SB Admin 2](https://github.com/BlackrockDigital/startbootstrap-sb-admin-2) Some code was initially taken from [Pterodactyl sftp server](https://github.com/pterodactyl/sftp-server) diff --git a/httpd/httpd.go b/httpd/httpd.go index 1f34b686..f1915572 100644 --- a/httpd/httpd.go +++ b/httpd/httpd.go @@ -18,12 +18,17 @@ import ( ) const ( - logSender = "api" + logSender = "httpd" activeConnectionsPath = "/api/v1/connection" quotaScanPath = "/api/v1/quota_scan" userPath = "/api/v1/user" versionPath = "/api/v1/version" metricsPath = "/metrics" + webBasePath = "/web" + webUsersPath = "/web/users" + webUserPath = "/web/user" + webConnectionsPath = "/web/connections" + staticFileWebPath = "/static" ) var ( diff --git a/httpd/web.go b/httpd/web.go index e6b59ad5..cea9a4b9 100644 --- a/httpd/web.go +++ b/httpd/web.go @@ -13,18 +13,11 @@ import ( ) const ( - templateBase = "base.html" - templateUsers = "users.html" - templateUser = "user.html" - templateConnections = "connections.html" - templateMessage = "message.html" - - webBasePath = "/web" - webUsersPath = "/web/users" - webUserPath = "/web/user" - webConnectionsPath = "/web/connections" - staticFileWebPath = "/static" - + templateBase = "base.html" + templateUsers = "users.html" + templateUser = "user.html" + templateConnections = "connections.html" + templateMessage = "message.html" pageUsersTitle = "Users" pageConnectionsTitle = "Connections" page400Title = "Bad request" diff --git a/sftpgo.iss b/sftpgo.iss index 6f30517f..c37765d2 100644 --- a/sftpgo.iss +++ b/sftpgo.iss @@ -2,9 +2,11 @@ ; You need to change the paths for the source files to match your environment #define MyAppName "SFTPGo" -#define MyAppVersion "0.9.2" +#define MyAppVersion "0.9.2-dev" #define MyAppURL "https://github.com/drakkan/sftpgo" #define MyAppExeName "sftpgo.exe" +#define MyAppDir "C:\Users\vbox\Desktop\sftpgo_setup" +#define MyOutputDir "C:\Users\vbox\Desktop" [Setup] ; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications. @@ -18,10 +20,10 @@ AppSupportURL={#MyAppURL} AppUpdatesURL={#MyAppURL} DefaultDirName={autopf}\{#MyAppName} DefaultGroupName={#MyAppName} -LicenseFile=C:\Users\vbox\Desktop\sftpgo_setup\LICENSE.txt +LicenseFile={#MyAppDir}\LICENSE.txt ; Uncomment the following line to run in non administrative install mode (install for current user only.) ;PrivilegesRequired=lowest -OutputDir=C:\Users\vbox\Desktop +OutputDir={#MyOutputDir} OutputBaseFilename=sftpgo_windows_x86_64 Compression=lzma SolidCompression=yes @@ -35,19 +37,22 @@ MinVersion=6.1 Name: "english"; MessagesFile: "compiler:Default.isl" [Files] -Source: "C:\Users\vbox\Desktop\sftpgo_setup\sftpgo.exe"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\Users\vbox\Desktop\sftpgo_setup\sftpgo.db"; DestDir: "{app}"; Flags: onlyifdoesntexist uninsneveruninstall -Source: "C:\Users\vbox\Desktop\sftpgo_setup\README.pdf"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\Users\vbox\Desktop\sftpgo_setup\LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion -Source: "C:\Users\vbox\Desktop\sftpgo_setup\sftpgo.json"; DestDir: "{app}"; Flags: onlyifdoesntexist uninsneveruninstall -Source: "C:\Users\vbox\Desktop\sftpgo_setup\scripts\*"; DestDir: "{app}\scripts"; Flags: ignoreversion recursesubdirs createallsubdirs -Source: "C:\Users\vbox\Desktop\sftpgo_setup\sql\*"; DestDir: "{app}\sql"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#MyAppDir}\sftpgo.exe"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#MyAppDir}\sftpgo.db"; DestDir: "{app}"; Flags: onlyifdoesntexist uninsneveruninstall +Source: "{#MyAppDir}\README.pdf"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#MyAppDir}\LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion +Source: "{#MyAppDir}\sftpgo.json"; DestDir: "{app}"; Flags: onlyifdoesntexist uninsneveruninstall +Source: "{#MyAppDir}\scripts\*"; DestDir: "{app}\scripts"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#MyAppDir}\sql\*"; DestDir: "{app}\sql"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#MyAppDir}\templates\*"; DestDir: "{app}\templates"; Flags: ignoreversion recursesubdirs createallsubdirs +Source: "{#MyAppDir}\static\*"; DestDir: "{app}\static"; Flags: ignoreversion recursesubdirs createallsubdirs ; NOTE: Don't use "Flags: ignoreversion" on any shared system files [Dirs] Name: "{app}\logs"; Permissions: everyone-full [Icons] +Name: "{group}\Web Admin"; Filename: "http://127.0.0.1:8080/web"; Name: "{group}\Service Control"; WorkingDir: "{app}"; Filename: "powershell.exe"; Parameters: "-Command ""Start-Process cmd \""/k cd {app} & {#MyAppName} service --help\"" -Verb RunAs"; Comment: "Install, start, stop, uninstall SFTPGo Service" Name: "{group}\REST API CLI"; WorkingDir: "{app}\scripts"; Filename: "{cmd}"; Parameters: "/k sftpgo_api_cli.exe --help"; Comment: "Manage users and connections" Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"