69 Commits

Author SHA1 Message Date
Christian Visintin
e61d04aa1b Merge pull request #236 from veeso/develop
0.13.0
2024-03-02 20:27:16 +01:00
veeso
c0c9f7c0dd fix: lint??? 2024-03-02 19:41:07 +01:00
veeso
905fe5fc9f fix: debian script 2024-03-02 19:36:01 +01:00
veeso
89ab53a71b fix: debian script 2024-03-02 19:35:18 +01:00
veeso
7dccac6105 fix: test 2024-03-02 19:31:36 +01:00
veeso
44051ec718 feat: termscp 0.13.0 2024-03-02 19:28:01 +01:00
Christian Visintin
c7469b8594 feat: WebDAV support (#235) 2024-03-02 19:23:27 +01:00
veeso
5dfee2cbd9 fix: AWS S3 wasn't working anymore due to rust-s3 outdate 2024-03-01 17:02:58 +01:00
Christian Visintin
679a829744 233 feature request subcommands (#234) 2024-03-01 10:01:25 +01:00
PIRADATA
2a51ab984c update linux installation command from termscp.veeso.dev/get-started.html (#223) 2023-12-15 18:53:45 +01:00
Jarod
2b2ebadd6a Fixed formatting (#207) 2023-12-15 09:33:55 +01:00
Christian Visintin
2b15a23fe8 Update README.md 2023-11-15 21:50:49 +01:00
veeso
d30c3dfadd force tuirealm 1.8 2023-10-06 22:03:08 +02:00
veeso
ef8dbb6305 0.12.3 2023-10-06 09:19:03 +02:00
veeso
623ba806e1 0.12.3 2023-10-06 09:17:38 +02:00
veeso
ea9dd03f55 Revert "feat: tui-realm 1.9"
This reverts commit cfbecc049d.
2023-10-06 09:13:57 +02:00
veeso
92d20f33fe new site 2023-10-01 16:20:35 +02:00
veeso
15caef83e6 0.12.2 2023-10-01 16:20:04 +02:00
veeso
19992402e2 fix: panic if the terminal screen is too small 2023-10-01 16:18:11 +02:00
veeso
182bbb94a2 0.12.2 2023-10-01 16:12:47 +02:00
Christian Visintin
20c3e22572 [BUG] - termscp not respecting port in ssh config (#216) 2023-10-01 16:12:43 +02:00
veeso
d3c2c084db fix: fmt 2023-08-23 10:11:13 +02:00
veeso
cfbecc049d feat: tui-realm 1.9 2023-08-23 09:18:09 +02:00
Christian Visintin
9de171fb83 added cfg smb-windows to be able to disable SMB on windows (#210)
* added cfg smb-windows to be able to disable SMB on windows

* lint
2023-08-20 10:24:34 +02:00
veeso
2f48c765e3 termscp 0.12.0 2023-07-06 16:17:33 +02:00
Christian Visintin
ca005cbecd save local file paths in bookmark (#204)
* fix: renamed Bookmark 'directory' to 'remote_path' (keep name in file)

* feat: local_path as file transfer parameter and in bookmark
2023-07-06 16:05:22 +02:00
Christian Visintin
ee28d34f29 fix: don't update path breadcrumb if enter/scan dir failed (#203) 2023-07-06 14:55:53 +02:00
veeso
295191b9eb Merge branch 'main' into develop 2023-07-06 11:49:06 +02:00
veeso
16b2aa8596 fix: rustup target 2023-07-06 11:38:38 +02:00
Christian Visintin
522ee0355e feat: build artifacts workflow (#202) 2023-07-06 11:26:14 +02:00
veeso
e5ca956897 fix: don't run CI on site/.md change 2023-07-06 11:07:22 +02:00
Christian Visintin
a071f3d420 feat: smb is now an optional feature (#200) 2023-07-06 11:02:53 +02:00
veeso
66888c418c fix: deps 2023-07-06 09:59:25 +02:00
veeso
b5f712fa04 fix: better main runner 2023-07-06 09:49:35 +02:00
529
1509401599 Add missing row in KeybindingsPopup (#193) 2023-07-06 09:17:55 +02:00
veeso
6506f4ae59 fixed theme 2023-07-05 13:22:56 +02:00
veeso
5a5fa52b57 fixed theme 2023-07-05 12:58:21 +02:00
veeso
b7d4c68ebe new termscp site 2023-07-05 12:33:17 +02:00
Renan Dorneles Schuquel
00a6c53178 Fix: Some URL typos on 'install.sh' and 'README.md'. (#197)
Co-authored-by: rschuquel <renan.schuquel@unimedvtrp.com.br>
2023-06-23 21:54:38 +02:00
Christian Visintin
67bc1a2a08 Ignore backlog issues 2023-05-23 09:20:11 +02:00
Christian Visintin
0bb3c9a26e Create stale.yml 2023-05-22 23:22:57 +02:00
veeso
4394941c71 fix: readme site links 2023-05-20 15:01:22 +02:00
veeso
175ea23bfc fix: sh compliant macos.sh build script 2023-05-18 11:53:21 +02:00
veeso
cef100e5d9 fix: install workflow 2023-05-18 11:42:24 +02:00
veeso
afba6c32c5 fix: release date 2023-05-16 15:52:50 +02:00
veeso
31f5bd095b fix: macos script 2023-05-16 14:38:16 +02:00
veeso
e1add0ed28 fix: pavao 0.2.3 2023-05-16 09:29:57 +02:00
veeso
79bc6a684b fix: pavao 0.2.2 2023-05-16 09:27:48 +02:00
veeso
bae4db8e27 fix: build 2023-05-15 14:23:13 +02:00
veeso
4cbba3f3cb fix: release date 2023-05-13 18:11:07 +02:00
veeso
e9fbb7f317 fix: specify ssh2 config params 2023-05-13 17:59:24 +02:00
Christian Visintin
044f2436f8 Don't prompt for password if a ssh key is set for that host (#186)
* feat: don't ask password if a ssh key is set for that host

* fix: User from ssh config was not used as it should

* fix: forgot a file
2023-05-13 16:09:37 +02:00
Christian Visintin
b7369162d2 SMB support (#184)
* feat: smb client

* fix: smb connection

* fix: smbclient deps

* feat: SMB mentions to user manual

* feat: changelog

* dlib macos

* fix: removed smb support from macos :(

* fix: restored libsmbclient build

* fix: strange lint message

* fix: macos build smb

* fix: macos build smb

* fix: macos tests

* fix: macos lint

* feat: SMB windows support

* fix: windows tests
2023-05-13 15:00:16 +02:00
Christian Visintin
a13663e5e9 Brew Linux support (#185)
* feat: brew linux and arm installation

* fix: updated website refs to termscp.veeso.dev

* feat: added brew installation to website
2023-05-12 17:06:27 +02:00
Christian Visintin
79dd9e2303 chmod popup (#183)
* feat: chmod popup

* fix: windows shall not allows chmod on localhost
2023-05-10 17:04:24 +02:00
Christian Visintin
b4fa50a666 feat: allow unknown fields in ssh2 configuration file (#181) 2023-05-10 09:27:54 +02:00
Christian Visintin
5a67fc7b0e fix: #153 show a loading message when loading directory's content (#180) 2023-05-09 17:43:37 +02:00
veeso
9dab34e7ee rustfmt.toml 2023-05-09 15:40:28 +02:00
veeso
c5eeae74b7 fmt 2023-05-09 15:40:21 +02:00
Christian Visintin
9009002b6e debug log belongs in cache directory not config directory (#179)
* log files are now written to cache dir instead of config dir

* lint

* fmt
2023-05-09 15:32:42 +02:00
veeso
9bf23b3f6b working on 0.12 2023-05-09 12:48:51 +02:00
veeso
3ec94c17bc 0.11.3 2023-04-19 11:07:42 +02:00
veeso
ed8ba628e5 feat: site improvements 2023-04-19 11:01:44 +02:00
veeso
7c638473d6 0.11.3 2023-04-19 10:17:59 +02:00
Christian Visintin
d37140ead6 fix: relative paths windows (#167) 2023-04-19 10:15:00 +02:00
veeso
fdb0d97a61 rtd 2023-04-18 18:10:40 +02:00
veeso
0c1e9c0d60 feat: site 0.11.2 2023-04-18 11:59:13 +02:00
veeso
e1a2255a58 feat: dependencies up-to-date 2023-04-18 11:58:10 +02:00
Christian Visintin
f6b2c814c0 bump remotefs-ssh to 0.1.5 (#164) 2023-04-18 11:44:49 +02:00
158 changed files with 6094 additions and 3058 deletions

42
.github/workflows/build-artifacts.yml vendored Normal file
View File

@@ -0,0 +1,42 @@
name: "Build artifacts"
on:
workflow_dispatch:
jobs:
build-binaries:
name: Build - ${{ matrix.platform.release_for }}
strategy:
matrix:
platform:
- release_for: MacOS-x86_64
os: macos-latest
target: x86_64-apple-darwin
script: macos.sh
- release_for: MacOS-M1
os: macos-latest
target: aarch64-apple-darwin
script: macos.sh
runs-on: ${{ matrix.platform.os }}
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: ${{ matrix.platform.target }}
- name: Build release
run: cargo build --release --target ${{ matrix.platform.target }}
- name: Prepare artifact files
run: |
mkdir -p .artifact
mv target/${{ matrix.platform.target }}/release/termscp .artifact/termscp
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
if-no-files-found: error
retention-days: 1
name: ${{ matrix.platform.release_for }}
path: .artifact/*

View File

@@ -1,6 +1,14 @@
name: Coverage
on: [push, pull_request]
on:
pull_request:
paths-ignore:
- "*.md"
- "./site/**/*"
push:
paths-ignore:
- "*.md"
- "./site/**/*"
env:
CARGO_TERM_COLOR: always
@@ -12,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt update && sudo apt install -y libdbus-1-dev libssh2-1-dev libssl-dev
run: sudo apt update && sudo apt install -y libdbus-1-dev libsmbclient-dev libsmbclient
- name: Setup nightly toolchain
uses: actions-rs/toolchain@v1
with:

View File

@@ -1,6 +1,10 @@
name: Install.sh
on: [push, pull_request]
on:
push:
branches: [main]
tags:
- "v*"
env:
CARGO_TERM_COLOR: always
@@ -12,8 +16,8 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt update && sudo apt install -y curl wget
run: sudo apt update && sudo apt install -y curl wget libsmbclient
- name: Install termscp from script
run: |
./install.sh -v=0.11.1 -f
./install.sh -v=0.12.3 -f
which termscp || exit 1

View File

@@ -1,6 +1,14 @@
name: Linux
on: [push, pull_request]
on:
pull_request:
paths-ignore:
- "*.md"
- "./site/**/*"
push:
paths-ignore:
- "*.md"
- "./site/**/*"
env:
CARGO_TERM_COLOR: always
@@ -12,7 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: sudo apt update && sudo apt install -y libdbus-1-dev
run: sudo apt update && sudo apt install -y libdbus-1-dev libsmbclient-dev
- uses: actions-rs/toolchain@v1
with:
toolchain: stable

View File

@@ -1,6 +1,14 @@
name: MacOS
on: [push, pull_request]
on:
pull_request:
paths-ignore:
- "*.md"
- "./site/**/*"
push:
paths-ignore:
- "*.md"
- "./site/**/*"
env:
CARGO_TERM_COLOR: always
@@ -8,7 +16,6 @@ env:
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1

23
.github/workflows/stale.yml vendored Normal file
View File

@@ -0,0 +1,23 @@
name: Close inactive issues
on:
schedule:
- cron: "30 1 * * *"
jobs:
close-issues:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v4.1.1
with:
days-before-issue-stale: 30
days-before-issue-close: 7
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 7 days since being marked as stale."
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
exempt-issue-labels: "backlog"

View File

@@ -5,6 +5,8 @@ on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
paths:
- "./site/**/*"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
@@ -35,7 +37,7 @@ jobs:
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './site/'
path: "./site/"
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1

View File

@@ -1,6 +1,14 @@
name: Windows
on: [push, pull_request]
on:
pull_request:
paths-ignore:
- "*.md"
- "./site/**/*"
push:
paths-ignore:
- "*.md"
- "./site/**/*"
env:
CARGO_TERM_COLOR: always

View File

@@ -1,6 +1,13 @@
# Changelog
- [Changelog](#changelog)
- [0.13.0](#0130)
- [0.12.3](#0123)
- [0.12.2](#0122)
- [0.12.1](#0121)
- [0.12.0](#0120)
- [0.11.3](#0113)
- [0.11.2](#0112)
- [0.11.1](#0111)
- [0.11.0](#0110)
- [0.10.0](#0100)
@@ -28,6 +35,71 @@
---
## 0.13.0
Released on 03/03/2024
- Added CLI subcommands
- Changed `-t` to `theme`
- Changed `-u` to `update`
- Changed `-c` to `config`
- Introduced support for [WebDAV](https://www.rfc-editor.org/rfc/rfc4918)
- It is now possible also to connect directly to WebDAV server with the syntax `http(s)://username:password@google.com`
- Bugfix:
- [Issue 232](https://github.com/veeso/termscp/issues/232): AWS S3 wasn't working anymore due to rust-s3 outdate
- Dependencies:
- Added `remotefs-webdav 0.1.1`
## 0.12.3
Released on 06/10/2023
- Dropped ratatui support, reverted to tui-realm 1.8
## 0.12.2
Released on 01/10/2023
- [Issue 205](https://github.com/veeso/termscp/issues/205): Allow windows build without SMB support
- [Issue 215](https://github.com/veeso/termscp/issues/215): termscp not respecting port in SSH config. The port specified for the host in the SSH configuration wasn't evaluated.
- [Issue 213](https://github.com/veeso/termscp/issues/215): termscp panicks if the terminal window is too small
## 0.12.1
Released on 06/07/2023
- [Issue 169](https://github.com/veeso/termscp/issues/169): Local working directory can now be specified in connection form and be saved into bookmarks.
- [Issue 188](https://github.com/veeso/termscp/issues/188): The breadcrumbs path is not fallbacked after a failed enter into the directory
- SMB support is now a feature (you can build rust without default features to disable smb).
- If SSH connection timeout is 0, the connection won't timeout.
## 0.12.0
Released on 16/05/2023
- **Change file permissions**: you can now change file permissions easily with the permissions popup pressing `Z` in the explorer.
- [Issue 172](https://github.com/veeso/termscp/issues/172)
- **SMB protocol**: Support for SMB protocol has been added thanks to the [remotefs-smb](https://github.com/veeso/remotefs-rs-smb) library and the [pavao](https://github.com/veeso/pavao) project. You may notice that the interface is quiet different between Windows and Linux/MacOs/BSD due to the fact that SMB is natively supported on Windows systems.
- [Issue 182](https://github.com/veeso/termscp/issues/182)
- [Issue 153](https://github.com/veeso/termscp/issues/153): show a loading message when loading directory's content
- [Issue 176](https://github.com/veeso/termscp/issues/176): debug log is now written to CACHE_DIR
- [Issue 173](https://github.com/veeso/termscp/issues/173): allow unknown fields in ssh2 configuration file
- [Issue 175](https://github.com/veeso/termscp/issues/175): don't prompt for password if a ssh key is set for that host
- Fixed an issue that didn't use the `User` specified in ssh2-config
## 0.11.3
Released on 19/04/2023
- [Issue 166](https://github.com/veeso/termscp/issues/166): fixed SCP relative paths on Windows
## 0.11.2
Released on 18/04/2023
- [Issue 154](https://github.com/veeso/termscp/issues/154): fixed SCP relative paths on Windows
## 0.11.1
Released on 07/03/2022

2039
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,22 @@
[package]
authors = ["Christian Visintin <christian.visintin1997@gmail.com>"]
authors = ["Christian Visintin <christian.visintin@veeso.dev>"]
categories = ["command-line-utilities"]
description = "termscp is a feature rich terminal file transfer and explorer with support for SCP/SFTP/FTP/S3"
edition = "2021"
homepage = "https://termscp.veeso.dev"
include = ["src/**/*", "LICENSE", "README.md", "CHANGELOG.md"]
keywords = ["scp-client", "sftp-client", "ftp-client", "winscp", "command-line-utility"]
keywords = [
"scp-client",
"sftp-client",
"ftp-client",
"winscp",
"command-line-utility",
]
license = "MIT"
name = "termscp"
readme = "README.md"
repository = "https://github.com/veeso/termscp"
version = "0.11.1"
version = "0.13.0"
[package.metadata.rpm]
package = "termscp"
@@ -22,8 +28,8 @@ buildflags = ["--release"]
termscp = { path = "/usr/bin/termscp" }
[package.metadata.deb]
maintainer = "Christian Visintin <christian.visintin1997@gmail.com>"
copyright = "2022, Christian Visintin <christian.visintin1997@gmail.com>"
maintainer = "Christian Visintin <christian.visintin@veeso.dev>"
copyright = "2022, Christian Visintin <christian.visintin@veeso.dev>"
extended-description-file = "docs/misc/README.deb.txt"
[[bin]]
@@ -32,58 +38,75 @@ path = "src/main.rs"
[dependencies]
argh = "^0.1"
bitflags = "^1.3"
bitflags = "^2.1"
bytesize = "^1.1"
chrono = "^0.4"
content_inspector = "^0.2"
dirs = "^4.0"
dirs = "^5.0"
edit = "^0.1"
filetime = "^0.2"
hostname = "^0.3"
keyring = { version = "^1.2", optional = true }
lazy-regex = "^2.4"
keyring = { version = "^2.0", optional = true }
lazy-regex = "^3.1"
lazy_static = "^1.4"
log = "^0.4"
magic-crypt = "^3.1"
notify = "^4.0"
notify-rust = { version = "^4.5", default-features = false, features = [ "d" ] }
open = "^3.0"
notify = "=4.0.17"
notify-rust = { version = "^4.5", default-features = false, features = ["d"] }
open = "^5.0"
rand = "^0.8.5"
remotefs = "^0.2.0"
remotefs-aws-s3 = { version = "^0.2.1", default-features = false, features = [ "find", "rustls" ] }
remotefs-aws-s3 = { version = "^0.2.4", default-features = false, features = [
"find",
"rustls",
] }
remotefs-webdav = "^0.1.1"
rpassword = "^7.0"
self_update = { version = "^0.35", default-features = false, features = [ "rustls", "archive-tar", "archive-zip", "compression-flate2", "compression-zip-deflate" ] }
serde = { version = "^1", features = [ "derive" ] }
self_update = { version = "^0.37", default-features = false, features = [
"rustls",
"archive-tar",
"archive-zip",
"compression-flate2",
"compression-zip-deflate",
] }
serde = { version = "^1", features = ["derive"] }
simplelog = "^0.12"
ssh2-config = "^0.1.6"
ssh2-config = "^0.2"
tempfile = "^3.4"
thiserror = "^1"
toml = "^0.7"
tui-realm-stdlib = "^1.2"
tuirealm = "^1.8.0"
toml = "^0.8"
tui-realm-stdlib = "^1.3.1"
tuirealm = "^1.9.1"
unicode-width = "^0.1"
version-compare = "^0.1"
whoami = "^1.2"
whoami = "^1.4"
wildmatch = "^2.1"
[dev-dependencies]
pretty_assertions = "^1.3"
serial_test = "^0.9"
serial_test = "^3"
[build-dependencies]
cfg_aliases = "0.2"
[features]
default = [ "with-keyring" ]
github-actions = [ ]
with-keyring = [ "keyring" ]
default = ["smb", "with-keyring"]
github-actions = []
with-keyring = ["keyring"]
smb = ["remotefs-smb"]
[target."cfg(not(target_os = \"macos\"))".dependencies]
remotefs-smb = { version = "^0.2", optional = true }
[target."cfg(target_family = \"windows\")"]
[target."cfg(target_family = \"windows\")".dependencies]
remotefs-ftp = { version = "^0.1.2", features = [ "native-tls" ] }
remotefs-ssh = "^0.1.3"
remotefs-ftp = { version = "^0.1.2", features = ["native-tls"] }
remotefs-ssh = "^0.2"
[target."cfg(target_family = \"unix\")"]
[target."cfg(target_family = \"unix\")".dependencies]
remotefs-ftp = { version = "^0.1.2", features = [ "vendored", "native-tls" ] }
remotefs-ssh = { version = "^0.1.3", features = [ "ssh2-vendored" ] }
remotefs-ftp = { version = "^0.1.2", features = ["vendored", "native-tls"] }
remotefs-ssh = { version = "^0.2", features = ["ssh2-vendored"] }
users = "0.11.0"
[profile.dev]

View File

@@ -1,16 +1,16 @@
# termscp
<p align="center">
<img src="/assets/images/termscp.svg" width="256" height="256" />
<img src="/assets/images/termscp.svg" alt="termscp logo" width="256" height="256" />
</p>
<p align="center">~ A feature rich terminal file transfer ~</p>
<p align="center">
<a href="https://veeso.github.io/termscp/" target="_blank">Website</a>
<a href="https://termscp.veeso.dev" target="_blank">Website</a>
·
<a href="https://veeso.github.io/termscp/#get-started" target="_blank">Installation</a>
<a href="https://termscp.veeso.dev/#get-started" target="_blank">Installation</a>
·
<a href="https://veeso.github.io/termscp/#user-manual" target="_blank">User manual</a>
<a href="https://termscp.veeso.dev/#user-manual" target="_blank">User manual</a>
</p>
<p align="center">
@@ -62,8 +62,8 @@
/></a>
</p>
<p align="center">Developed by <a href="https://veeso.github.io/" target="_blank">@veeso</a></p>
<p align="center">Current version: 0.11.1 (07/03/2023)</p>
<p align="center">Developed by <a href="https://veeso.dev/" target="_blank">@veeso</a></p>
<p align="center">Current version: 0.13.0 (03/03/2024)</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"
@@ -73,7 +73,7 @@
/></a>
<a href="https://github.com/veeso/termscp/stargazers"
><img
src="https://img.shields.io/github/stars/veeso/termscp.svg"
src="https://img.shields.io/github/stars/veeso/termscp?style=flat"
alt="Repo stars"
/></a>
<a href="https://crates.io/crates/termscp"
@@ -132,6 +132,8 @@ Termscp is a feature rich terminal file transfer and explorer, with support for
- **SCP**
- **FTP** and **FTPS**
- **S3**
- **SMB**
- **WebDAV**
- 🖥 Explore and operate on the remote and on the local machine file system with a handy UI
- Create, remove, rename, search, view and edit files
- ⭐ Connect to your favourite hosts through built-in bookmarks and recent connections
@@ -161,7 +163,7 @@ If you want to contribute to this project, don't forget to check out our [contri
If you are a Linux, a FreeBSD or a MacOS user this simple shell script will install termscp on your system with a single command:
```sh
curl -sSLf http://get-termscp.veeso.dev | sh
curl --proto '=https' --tlsv1.2 -sSLf "https://git.io/JBhDb" | sh
```
> ❗ MacOs installation requires [Homebrew](https://brew.sh/), otherwise the Rust compiler will be installed
@@ -178,7 +180,7 @@ NetBSD users can install termscp from the official repositories.
pkgin install termscp
```
For more information or other platforms, please visit [veeso.github.io](https://veeso.github.io/termscp/#get-started) to view all installation methods.
For more information or other platforms, please visit [termscp.veeso.dev](https://termscp.veeso.dev/#get-started) to view all installation methods.
⚠️ If you're looking on how to update termscp just run termscp from CLI with: `(sudo) termscp --update` ⚠️
@@ -187,9 +189,11 @@ For more information or other platforms, please visit [veeso.github.io](https://
- **Linux** users:
- libdbus-1
- pkg-config
- libsmbclient
- **FreeBSD** or, **NetBSD** users:
- dbus
- pkgconf
- libsmbclient
### Optional Requirements ✔️
@@ -217,13 +221,12 @@ You can make a donation with one of these platforms:
[![ko-fi](https://img.shields.io/badge/Ko--fi-F16061?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/veeso)
[![PayPal](https://img.shields.io/badge/PayPal-00457C?style=for-the-badge&logo=paypal&logoColor=white)](https://www.paypal.me/chrisintin)
[![bitcoin](https://img.shields.io/badge/Bitcoin-ff9416?style=for-the-badge&logo=bitcoin&logoColor=white)](https://btc.com/bc1qvlmykjn7htz0vuprmjrlkwtv9m9pan6kylsr8w)
---
## User manual 📚
The user manual can be found on the [termscp's website](https://veeso.github.io/termscp/#user-manual) or on [Github](docs/man.md).
The user manual can be found on the [termscp's website](https://termscp.veeso.dev/#user-manual) or on [Github](docs/man.md).
---
@@ -261,6 +264,7 @@ termscp is powered by these awesome projects:
- [edit](https://github.com/milkey-mouse/edit)
- [keyring-rs](https://github.com/hwchen/keyring-rs)
- [open-rs](https://github.com/Byron/open-rs)
- [pavao](https://github.com/veeso/pavao)
- [remotefs](https://github.com/veeso/remotefs-rs)
- [rpassword](https://github.com/conradkleinespel/rpassword)
- [self_update](https://github.com/jaemk/self_update)

16
build.rs Normal file
View File

@@ -0,0 +1,16 @@
use cfg_aliases::cfg_aliases;
fn main() {
// Setup cfg aliases
cfg_aliases! {
// Platforms
macos: { target_os = "macos" },
linux: { target_os = "linux" },
unix: { target_family = "unix" },
windows: { target_family = "windows" },
// exclusive features
smb: { all(feature = "smb", not( macos )) },
smb_unix: { all(unix, feature = "smb", not(macos)) },
smb_windows: { all(windows, feature = "smb") }
}
}

View File

@@ -9,6 +9,7 @@ RUN yum -y install \
gcc \
make \
dbus-devel \
libsmbclient-devel \
bash \
rpm-build
# Install rust

View File

@@ -1,4 +1,4 @@
FROM debian:stretch
FROM debian:buster
WORKDIR /usr/src/
# Install dependencies
@@ -8,6 +8,8 @@ RUN apt update && apt install -y \
pkg-config \
libdbus-1-dev \
build-essential \
libsmbclient-dev \
libsmbclient \
bash \
curl

View File

@@ -39,7 +39,7 @@ echo -e "desc: <<EOD\n\
A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3\n\
EOD\n\
arch: \"amd64\"\n\
www: \"https://veeso.github.io/termscp/\"\n\
www: \"https://termscp.veeso.dev/termscp/\"\n\
maintainer: \"christian.visintin1997@gmail.com\"\n\
prefix: \"/usr/local/bin\"\n\
deps: {\n\

View File

@@ -23,6 +23,8 @@ fi
ARM64_DEB_NAME="termscp-arm64_deb"
ARM64_RPM_NAME="termscp-arm64_rpm"
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
set -e # Don't fail
# Create pkgs directory
@@ -31,19 +33,20 @@ PKGS_DIR=$(pwd)/pkgs
cd -
mkdir -p ${PKGS_DIR}/
# Build aarch64_deb
cd aarch64_debian9/
cd aarch64_debian10/
docker buildx build --platform linux/arm64 $CACHE --build-arg branch=${BRANCH} --tag $ARM64_DEB_NAME .
cd -
mkdir -p ${PKGS_DIR}/deb/
mkdir -p ${PKGS_DIR}/aarch64-unknown-linux-gnu/
docker run --name "$ARM64_DEB_NAME" -d "$ARM64_DEB_NAME" || docker start "$ARM64_DEB_NAME"
docker exec -it "$ARM64_DEB_NAME" bash -c ". \$HOME/.cargo/env && git fetch origin && git checkout origin/$BRANCH && cargo build --release && cargo deb"
docker cp ${CONTAINER_NAME}:/usr/src/termscp/target/debian/termscp_${VERSION}_arm64.deb ${PKGS_DIR}/deb/
docker cp ${CONTAINER_NAME}:/usr/src/termscp/target/release/termscp ${PKGS_DIR}/aarch64-unknown-linux-gnu/
docker cp ${ARM64_DEB_NAME}:/usr/src/termscp/target/debian/termscp_${VERSION}-1_arm64.deb ${PKGS_DIR}/deb/termscp_${VERSION}_arm64.deb
docker cp ${ARM64_DEB_NAME}:/usr/src/termscp/target/release/termscp ${PKGS_DIR}/aarch64-unknown-linux-gnu/
docker stop "$ARM64_DEB_NAME"
# Make tar.gz
cd ${PKGS_DIR}/aarch64-unknown-linux-gnu/
tar cvzf termscp-v${VERSION}-aarch64-unknown-linux-gnu.tar.gz termscp
echo "Sha256 (homebrew aarch64): $(sha256sum termscp-v${VERSION}-aarch64-unknown-linux-gnu.tar.gz)"
rm termscp
cd -
# Build aarch64_centos7
@@ -52,7 +55,8 @@ docker buildx build --platform linux/arm64 $CACHE --build-arg branch=${BRANCH} -
cd -
mkdir -p ${PKGS_DIR}/rpm/
docker run --name "$ARM64_RPM_NAME" -d "$ARM64_RPM_NAME" || docker start "$ARM64_RPM_NAME"
docker exec -it "$ARM64_RPM_NAME" bash -c ". \$HOME/.cargo/env && git fetch origin && git checkout origin/$BRANCH && cargo rpm init && cargo rpm build"
docker cp ${CONTAINER_NAME}:/usr/src/termscp/target/release/rpmbuild/RPMS/aarch64/termscp-${VERSION}-1.el7.aarch64.rpm ${PKGS_DIR}/rpm/termscp-${VERSION}-1.aarch64.rpm
docker exec -it "$ARM64_RPM_NAME" bash -c ". \$HOME/.cargo/env && git fetch origin && git checkout origin/$BRANCH; cargo rpm init; cargo rpm build"
docker cp ${ARM64_RPM_NAME}:/usr/src/termscp/target/release/rpmbuild/RPMS/aarch64/termscp-${VERSION}-1.el7.aarch64.rpm ${PKGS_DIR}/rpm/termscp-${VERSION}-1.aarch64.rpm
docker stop "$ARM64_RPM_NAME"
exit $?

View File

@@ -31,19 +31,20 @@ PKGS_DIR=$(pwd)/pkgs
cd -
mkdir -p ${PKGS_DIR}/
# Build x86_64_deb
cd x86_64_debian9/
cd x86_64_debian10/
docker build $CACHE --build-arg branch=${BRANCH} --tag "$X86_64_DEB_NAME" .
cd -
mkdir -p ${PKGS_DIR}/deb/
mkdir -p ${PKGS_DIR}/x86_64-unknown-linux-gnu/
docker run --name "$X86_64_DEB_NAME" -d "$X86_64_DEB_NAME" || docker start "$X86_64_DEB_NAME"
docker exec -it "$X86_64_DEB_NAME" bash -c ". \$HOME/.cargo/env && git fetch origin && git checkout origin/$BRANCH && cargo build --release && cargo deb"
docker cp ${X86_64_DEB_NAME}:/usr/src/termscp/target/debian/termscp_${VERSION}_amd64.deb ${PKGS_DIR}/deb/
docker cp ${X86_64_DEB_NAME}:/usr/src/termscp/target/debian/termscp_${VERSION}-1_amd64.deb ${PKGS_DIR}/deb/termscp_${VERSION}_amd64.deb
docker cp ${X86_64_DEB_NAME}:/usr/src/termscp/target/release/termscp ${PKGS_DIR}/x86_64-unknown-linux-gnu/
docker stop "$X86_64_DEB_NAME"
# Make tar.gz
cd ${PKGS_DIR}/x86_64-unknown-linux-gnu/
tar cvzf termscp-v${VERSION}-x86_64-unknown-linux-gnu.tar.gz termscp
echo "Sha256 x86_64 (homebrew): $(sha256sum termscp-v${VERSION}-x86_64-unknown-linux-gnu.tar.gz)"
rm termscp
cd -
# Build x86_64_centos7
@@ -52,7 +53,7 @@ docker build $CACHE --build-arg branch=${BRANCH} --tag "$X86_64_RPM_NAME" .
cd -
mkdir -p ${PKGS_DIR}/rpm/
docker run --name "$X86_64_RPM_NAME" -d "$X86_64_RPM_NAME" || docker start "$X86_64_RPM_NAME"
docker exec -it "$X86_64_RPM_NAME" bash -c ". \$HOME/.cargo/env && git fetch origin && git checkout origin/$BRANCH && cargo rpm init && cargo rpm build"
docker exec -it "$X86_64_RPM_NAME" bash -c ". \$HOME/.cargo/env && git fetch origin && git checkout origin/$BRANCH; cargo rpm init; cargo rpm build"
docker cp ${X86_64_RPM_NAME}:/usr/src/termscp/target/release/rpmbuild/RPMS/x86_64/termscp-${VERSION}-1.el7.x86_64.rpm ${PKGS_DIR}/rpm/termscp-${VERSION}-1.x86_64.rpm
docker stop "$X86_64_RPM_NAME"

61
dist/build/macos.sh vendored
View File

@@ -18,11 +18,52 @@ make_pkg() {
echo "$HASH"
}
detect_platform() {
local platform
platform="$(uname -s | tr '[:upper:]' '[:lower:]')"
case "${platform}" in
linux) platform="linux" ;;
darwin) platform="macos" ;;
freebsd) platform="freebsd" ;;
esac
printf '%s' "${platform}"
}
detect_arch() {
local arch
arch="$(uname -m | tr '[:upper:]' '[:lower:]')"
case "${arch}" in
amd64) arch="x86_64" ;;
armv*) arch="arm" ;;
arm64) arch="aarch64" ;;
esac
# `uname -m` in some cases mis-reports 32-bit OS as 64-bit, so double check
if [ "${arch}" = "x86_64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
arch="i686"
elif [ "${arch}" = "aarch64" ] && [ "$(getconf LONG_BIT)" -eq 32 ]; then
arch="arm"
fi
printf '%s' "${arch}"
}
if [ -z "$1" ]; then
echo "Usage: macos.sh <version>"
exit 1
fi
PLATFORM="$(detect_platform)"
ARCH="$(detect_arch)"
if [ "$PLATFORM" != "macos" ]; then
echo "macos build is only available on MacOs systems"
exit 1
fi
VERSION=$1
export BUILD_ROOT
BUILD_ROOT="$(pwd)/../../"
@@ -38,16 +79,28 @@ if [ ! -f Cargo.toml ]; then
fi
# Build release (x86_64)
cargo build --release
X86_TARGET=""
X86_TARGET_DIR=""
if [ "$ARCH" = "aarch64" ]; then
X86_TARGET="--target x86_64-apple-darwin"
X86_TARGET_DIR="target/x86_64-apple-darwin/release/"
fi
cargo build --release $X86_TARGET
# Make pkg
X86_64_HASH=$(make_pkg "x86_64" "$VERSION")
X86_64_HASH=$(make_pkg "x86_64" "$VERSION" $X86_TARGET_DIR)
RET_X86_64=$?
ARM64_TARGET=""
ARM64_TARGET_DIR=""
if [ "$ARCH" = "aarch64" ]; then
ARM64_TARGET="--target aarch64-apple-darwin"
ARM64_TARGET_DIR="target/aarch64-apple-darwin/release/"
fi
cd "$BUILD_ROOT"
# Build ARM64 pkg
cargo build --release --target aarch64-apple-darwin
cargo build --release $ARM64_TARGET
# Make pkg
ARM64_HASH=$(make_pkg "arm64" "$VERSION" "target/aarch64-apple-darwin/release/")
ARM64_HASH=$(make_pkg "arm64" "$VERSION" $ARM64_TARGET_DIR)
RET_ARM64=$?
echo "x86_64 hash: $X86_64_HASH"

View File

@@ -9,6 +9,7 @@ RUN yum -y install \
gcc \
make \
dbus-devel \
libsmbclient-devel \
bash \
rpm-build
# Install rust

View File

@@ -1,4 +1,4 @@
FROM debian:stretch
FROM debian:buster
WORKDIR /usr/src/
# Install dependencies
@@ -8,6 +8,8 @@ RUN apt update && apt install -y \
pkg-config \
libdbus-1-dev \
build-essential \
libsmbclient-dev \
libsmbclient \
bash \
curl

View File

@@ -6,11 +6,11 @@
<p align="center">~ Eine funktionsreiche Terminal-Dateiübertragung ~</p>
<p align="center">
<a href="https://veeso.github.io/termscp/" target="_blank">Webseite</a>
<a href="https://termscp.veeso.dev" target="_blank">Webseite</a>
·
<a href="https://veeso.github.io/termscp/#get-started" target="_blank">Installation</a>
<a href="https://termscp.veeso.dev/#get-started" target="_blank">Installation</a>
·
<a href="https://veeso.github.io/termscp/#user-manual" target="_blank">Benutzerhandbuch</a>
<a href="https://termscp.veeso.dev/#user-manual" target="_blank">Benutzerhandbuch</a>
</p>
<p align="center">
@@ -62,8 +62,8 @@
/></a>
</p>
<p align="center">Entwickelt von <a href="https://veeso.github.io/" target="_blank">@veeso</a></p>
<p align="center">Aktuelle Version: 0.11.1 (07/03/2023)</p>
<p align="center">Entwickelt von <a href="https://veeso.dev/" target="_blank">@veeso</a></p>
<p align="center">Aktuelle Version: 0.13.0 (03/03/2024)</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"
@@ -137,6 +137,8 @@ Termscp ist ein funktionsreicher Terminal-Dateitransfer und Explorer mit Unterst
- **SCP**
- **FTP** und **FTPS**
- **S3**
- **SMB**
- **WebDAV**
- 🖥 Erkunden und bedienen Sie das Dateisystem der Fernbedienung und des lokalen Computers mit einer praktischen Benutzeroberfläche
- Erstellen, Entfernen, Umbenennen, Suchen, Anzeigen und Bearbeiten von Dateien
- ⭐ Verbinden Sie sich über integrierte Lesezeichen und aktuelle Verbindungen mit Ihren Lieblingshosts
@@ -175,7 +177,7 @@ Wenn Sie ein Windows-Benutzer sind, können Sie termscp mit [Chocolatey](https:/
choco install termscp
```
Für weitere Informationen oder andere Plattformen besuchen Sie bitte [veeso.github.io](https://veeso.github.io/termscp/#get-started), um alle Installationsmethoden anzuzeigen.
Für weitere Informationen oder andere Plattformen besuchen Sie bitte [termscp.veeso.dev](https://termscp.veeso.dev/termscp/#get-started), um alle Installationsmethoden anzuzeigen.
⚠️ Wenn Sie wissen möchten, wie Sie termscp aktualisieren können, führen Sie einfach termscp über die CLI aus mit: `(sudo) termscp --update` ⚠️
@@ -185,10 +187,12 @@ Für weitere Informationen oder andere Plattformen besuchen Sie bitte [veeso.git
- libssh
- libdbus-1
- pkg-config
- libsmbclient
- **FreeBSD** Benutzer:
- libssh
- dbus
- pkgconf
- libsmbclient
### Optionale Softwareanforderungen ✔️
@@ -221,7 +225,7 @@ Sie können mit einer dieser Plattformen spenden:
## User manual 📚
Das Benutzerhandbuch finden Sie auf der [termscp-Website](https://veeso.github.io/termscp/#user-manual) oder auf [Github](man.md).
Das Benutzerhandbuch finden Sie auf der [termscp-Website](https://termscp.veeso.dev/termscp/#user-manual) oder auf [Github](man.md).
---

View File

@@ -4,7 +4,11 @@
- [Usage ❓](#usage-)
- [Address argument 🌎](#address-argument-)
- [AWS S3 address argument](#aws-s3-address-argument)
- [SMB address argument](#smb-address-argument)
- [How Password can be provided 🔐](#how-password-can-be-provided-)
- [Subcommands](#subcommands)
- [Import a theme](#import-a-theme)
- [Install latest version](#install-latest-version)
- [S3 connection parameters](#s3-connection-parameters)
- [S3 credentials 🦊](#s3-credentials-)
- [File explorer 📂](#file-explorer-)
@@ -44,10 +48,7 @@ OR
- `-P, --password <password>` if address is provided, password will be this argument
- `-b, --address-as-bookmark` resolve address argument as a bookmark name
- `-c, --config` Open termscp starting from the configuration page
- `-q, --quiet` Disable logging
- `-t, --theme <path>` Import specified theme
- `-u, --update` Update termscp to latest version
- `-v, --version` Print version info
- `-h, --help` Print help page
@@ -105,6 +106,22 @@ e.g.
s3://buckethead@eu-central-1:default:/assets
```
#### SMB address argument
SMB has a different syntax for CLI address argument, which is different whether you're on Windows or other systems:
**Windows** syntax:
```txt
\\[username@]<server-name>\<share>[\path\...]
```
**Other systems** syntax:
```txt
smb://[username@]<server-name>[:port]/<share>[/path/.../]
```
#### How Password can be provided 🔐
You have probably noticed, that, when providing the address as argument, there's no way to provide the password.
@@ -114,6 +131,17 @@ Password can be basically provided through 3 ways when address argument is provi
- Via `sshpass`: you can provide password via `sshpass`, e.g. `sshpass -f ~/.ssh/topsecret.key termscp cvisintin@192.168.1.31`
- You will be prompted for it: if you don't use any of the previous methods, you will be prompted for the password, as happens with the more classics tools such as `scp`, `ssh`, etc.
### Subcommands
#### Import a theme
Run termscp as `termscp theme <theme-file>`
#### Install latest version
Run termscp as `termscp update`
---
## S3 connection parameters
@@ -214,6 +242,7 @@ In order to change panel you need to type `<LEFT>` to move the remote explorer p
| `<W>` | Open file with provided program | With |
| `<X>` | Execute a command | eXecute |
| `<Y>` | Toggle synchronized browsing | sYnc |
| `<Z>` | Change file mode | |
| `<CTRL+A>` | Select all files | |
| `<CTRL+C>` | Abort file transfer process | |
| `<CTRL+T>` | Show all synchronized paths | Track |
@@ -340,7 +369,7 @@ These parameters can be changed:
- **Local File formatter syntax**: syntax to display file info for each file in the local explorer. See [File explorer format](#file-explorer-format)
- **Enable notifications?**: If set to `Yes`, notifications will be displayed.
- **Notifications: minimum transfer size**: if transfer size is greater or equal than the specified value, notifications for transfer will be displayed. The accepted values are in format `{UNSIGNED} B/KB/MB/GB/TB/PB`
- **SSH configuration path**: Set SSH configuration file to use when connecting to a SCP/SFTP server. If unset (empty) no file will be used. You can specify a path starting with `~` to indicate the home path (e.g. `~/.ssh/config`)
- **SSH configuration path**: Set SSH configuration file to use when connecting to a SCP/SFTP server. If unset (empty) no file will be used. You can specify a path starting with `~` to indicate the home path (e.g. `~/.ssh/config`). The parameters supported by termscp are specified [HERE](https://github.com/veeso/ssh2-config#exposed-attributes).
### SSH Key Storage 🔐
@@ -482,9 +511,9 @@ Just a reminder: **you can edit only textual file**; binary files are not suppor
termscp writes a log file for each session, which is written at
- `$HOME/.config/termscp/termscp.log` on Linux/BSD
- `$HOME/Library/Application Support/termscp/termscp.log` on MacOs
- `FOLDERID_RoamingAppData\termscp\termscp.log` on Windows
- `$HOME/.cache/termscp/termscp.log` on Linux/BSD
- `$HOME/Library/Caches/termscp/termscp.log` on MacOs
- `FOLDERID_LocalAppData\termscp\termscp.log` on Windows
the log won't be rotated, but will just be truncated after each launch of termscp, so if you want to report an issue and you want to attach your log file, keep in mind to save the log file in a safe place before using termscp again.
The logging by default reports in *INFO* level, so it is not very verbose.

View File

@@ -6,11 +6,11 @@
<p align="center">~ Una transferencia de archivos de terminal rica en funciones ~</p>
<p align="center">
<a href="https://veeso.github.io/termscp/" target="_blank">Sitio Web</a>
<a href="https://termscp.veeso.dev" target="_blank">Sitio Web</a>
·
<a href="https://veeso.github.io/termscp/#get-started" target="_blank">Instalación</a>
<a href="https://termscp.veeso.dev/#get-started" target="_blank">Instalación</a>
·
<a href="https://veeso.github.io/termscp/#user-manual" target="_blank">Manual de usuario</a>
<a href="https://termscp.veeso.dev/#user-manual" target="_blank">Manual de usuario</a>
</p>
<p align="center">
@@ -62,8 +62,8 @@
/></a>
</p>
<p align="center">Desarrollado por <a href="https://veeso.github.io/" target="_blank">@veeso</a></p>
<p align="center">Versión actual: 0.11.1 (07/03/2023)</p>
<p align="center">Desarrollado por <a href="https://veeso.dev/" target="_blank">@veeso</a></p>
<p align="center">Versión actual: 0.13.0 (03/03/2024)</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"
@@ -137,6 +137,8 @@ Termscp es un explorador y transferencia de archivos de terminal rico en funcion
- **SCP**
- **FTP** y **FTPS**
- **S3**
- **SMB**
- **WebDAV**
- 🖥 Explore y opere en el sistema de archivos de la máquina local y remota con una interfaz de usuario práctica
- Cree, elimine, cambie el nombre, busque, vea y edite archivos
- ⭐ Conéctese a sus hosts favoritos y conexiones recientes
@@ -175,20 +177,20 @@ mientras que si eres un usuario de Windows, puedes instalar termscp con [Chocola
choco install termscp
```
Para obtener más información u otras plataformas, visite [veeso.github.io](https://veeso.github.io/termscp/#get-started) para ver todos los métodos de instalación.
Para obtener más información u otras plataformas, visite [termscp.veeso.dev](https://termscp.veeso.dev/termscp/#get-started) para ver todos los métodos de instalación.
⚠️ Si estás buscando cómo actualizar termscp, simplemente ejecute termscp desde CLI con:: `(sudo) termscp --update` ⚠️
### Requisitos ❗
- Usuarios **Linux**:
- libssh
- **Linux** users:
- libdbus-1
- pkg-config
- Usuarios **FreeBSD**:
- libssh
- libsmbclient
- **FreeBSD** or, **NetBSD** users:
- dbus
- pkgconf
- libsmbclient
### Requisitos opcionales ✔️
@@ -221,7 +223,7 @@ Puedes hacer una donación con una de estas plataformas:
## Manual de usuario y documentación 📚
El manual del usuario se puede encontrar en el [sitio web de termscp](https://veeso.github.io/termscp/#user-manual) o en [Github](man.md).
El manual del usuario se puede encontrar en el [sitio web de termscp](https://termscp.veeso.dev/termscp/#user-manual) o en [Github](man.md).
---

View File

@@ -4,6 +4,8 @@
- [Uso ❓](#uso-)
- [Argumento dirección 🌎](#argumento-dirección-)
- [Argumento dirección por AWS S3](#argumento-dirección-por-aws-s3)
- [Argumento de dirección de WebDAV](#argumento-de-dirección-de-webdav)
- [Argumento dirección por SMB](#argumento-dirección-por-smb)
- [Cómo se puede proporcionar la contraseña 🔐](#cómo-se-puede-proporcionar-la-contraseña-)
- [S3 parámetros de conexión](#s3-parámetros-de-conexión)
- [Credenciales de S3 🦊](#credenciales-de-s3-)
@@ -44,10 +46,7 @@ OR
- `-P, --password <password>` si se proporciona la dirección, la contraseña será este argumento
- `-b, --address-as-bookmark` resuelve el argumento de la dirección como un nombre de marcador
- `-c, --config` Abrir termscp comenzando desde la página de configuración
- `-q, --quiet` Deshabilitar el registro
- `-t, --theme <path>` Importar tema especificado
- `-u, --update` Actualizar termscp a la última versión
- `-v, --version` Imprimir información de la versión
- `-h, --help` Imprimir página de ayuda
@@ -105,6 +104,36 @@ por ejemplo
s3://buckethead@eu-central-1:default:/assets
```
#### Argumento de dirección de WebDAV
En caso de que quieras conectarte a WebDAV utiliza la siguiente sintaxis
```txt
http://<username>:<password>@<url></path>
```
o en caso de que quieras usar https
```txt
https://<username>:<password>@<url></path>
```
#### Argumento dirección por SMB
SMB tiene una sintaxis diferente para el argumento de la dirección CLI, que es diferente si está en Windows u otros sistemas:
**Windows** sintaxis:
```txt
\\[username@]<server-name>\<share>[\path\...]
```
**Other systems** sintaxis:
```txt
smb://[username@]<server-name>[:port]/<share>[/path/.../]
```
#### Cómo se puede proporcionar la contraseña 🔐
Probablemente haya notado que, al proporcionar la dirección como argumento, no hay forma de proporcionar la contraseña.
@@ -214,6 +243,7 @@ Para cambiar de panel, debe escribir `<LEFT>` para mover el panel del explorador
| `<W>` | Abrir archivo con el programa proporcionado | With |
| `<X>` | Ejecutar un comando | eXecute |
| `<Y>` | Alternar navegación sincronizada | sYnc |
| `<Z>` | Cambiar ppermisos de archivo | |
| `<CTRL+A>` | Seleccionar todos los archivos | |
| `<CTRL+C>` | Abortar el proceso de transferencia de archivos | |
| `<CTRL+T>` | Mostrar todas las rutas sincronizadas | Track |
@@ -339,7 +369,7 @@ Estos parámetros se pueden cambiar:
- **Local File formatter syntax**: sintaxis para mostrar información de archivo para cada archivo en el explorador local. Consulte [Formato del explorador de archivos](#formato-del-explorador-de-archivos).
- **Enable notifications?**: Si se establece en "Sí", se mostrarán las notificaciones.
- **Notifications: minimum transfer size**: si el tamaño de la transferencia es mayor o igual que el valor especificado, se mostrarán notificaciones de transferencia. Los valores aceptados están en formato `{UNSIGNED} B/KB/MB/GB/TB/PB`
- **SSH configuration path**: Configure el archivo de configuración SSH para usar al conectarse a un servidor SCP / SFTP. Si no se configura (está vacío), no se utilizará ningún archivo. Puede especificar una ruta que comience con `~` para indicar la ruta de inicio (por ejemplo, `~/.ssh/config`)
- **SSH configuration path**: Configure el archivo de configuración SSH para usar al conectarse a un servidor SCP / SFTP. Si no se configura (está vacío), no se utilizará ningún archivo. Puede especificar una ruta que comience con `~` para indicar la ruta de inicio (por ejemplo, `~/.ssh/config`). Se especifican los parámetros soportados [AQUI](https://github.com/veeso/ssh2-config#exposed-attributes).
### SSH Key Storage 🔐
@@ -481,9 +511,9 @@ En caso de que el archivo esté ubicado en un host remoto, el archivo se descarg
termscp escribe un archivo de registro para cada sesión, que se escribe en
- `$HOME/.config/termscp/termscp.log` en Linux/BSD
- `$HOME/Library/Application Support/termscp/termscp.log` en MacOs
- `FOLDERID_RoamingAppData\termscp\termscp.log` en Windows
- `$HOME/.cache/termscp/termscp.log` en Linux/BSD
- `$HOME/Library/Caches/termscp/termscp.log` en MacOs
- `FOLDERID_LocalAppData\termscp\termscp.log` en Windows
el registro no se rotará, sino que se truncará después de cada lanzamiento de termscp, por lo que si desea informar un problema y desea adjuntar su archivo de registro, recuerde guardar el archivo de registro en un lugar seguro antes de usar termscp de nuevo.
El registro por defecto informa en el nivel *INFO*, por lo que no es muy detallado.

View File

@@ -6,11 +6,11 @@
<p align="center">~ Un file transfer de terminal riche en fonctionnalités ~</p>
<p align="center">
<a href="https://veeso.github.io/termscp/" target="_blank">Site internet</a>
<a href="https://termscp.veeso.dev" target="_blank">Site internet</a>
·
<a href="https://veeso.github.io/termscp/#get-started" target="_blank">Installation</a>
<a href="https://termscp.veeso.dev/#get-started" target="_blank">Installation</a>
·
<a href="https://veeso.github.io/termscp/#user-manual" target="_blank">Manuel de l'Utilisateur</a>
<a href="https://termscp.veeso.dev/#user-manual" target="_blank">Manuel de l'Utilisateur</a>
</p>
<p align="center">
@@ -62,8 +62,8 @@
/></a>
</p>
<p align="center">Développé par <a href="https://veeso.github.io/" target="_blank">@veeso</a></p>
<p align="center">Version actuelle: 0.11.1 (07/03/2023)</p>
<p align="center">Développé par <a href="https://veeso.dev/" target="_blank">@veeso</a></p>
<p align="center">Version actuelle: 0.13.0 (03/03/2024)</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"
@@ -137,6 +137,8 @@ Termscp est un file transfer et explorateur de fichiers de terminal riche en fon
- **SCP**
- **FTP** et **FTPS**
- **S3**
- **SMB**
- **WebDAV**
- 🖥 Explorer et opérer sur le système de fichiers distant et local avec une interface utilisateur pratique.
- Créer, supprimer, renommer, rechercher, afficher et modifier des fichiers
- ⭐ Connectez-vous à vos hôtes préférés via des signets et des connexions récentes.
@@ -175,20 +177,20 @@ tandis que si tu es un utilisateur Windows, tu peux installer termscp avec [Choc
choco install termscp
```
Pour plus d'informations sur les autres méthodes d'installation, veuillez visiter [veeso.github.io](https://veeso.github.io/termscp/#get-started).
Pour plus d'informations sur les autres méthodes d'installation, veuillez visiter [termscp.veeso.dev](https://termscp.veeso.dev/termscp/#get-started).
⚠️ Si tu cherche comme de mettre à jour termscp, tu dois exécuter cette commande dans le terminal: `(sudo) termscp --update` ⚠️
### Requis ❗
- utilisateurs **Linux**:
- libssh
- **Linux** users:
- libdbus-1
- pkg-config
- utilisateurs **FreeBSD**:
- libssh
- libsmbclient
- **FreeBSD** or, **NetBSD** users:
- dbus
- pkgconf
- libsmbclient
### Requis facultatives ✔️
@@ -221,7 +223,7 @@ Tu peux faire un don avec l'une de ces plateformes:
## Manuel d'utilisateur et Documentation 📚
Le manuel d'utilisateur peut être trouvé sur le [site de termscp](https://veeso.github.io/termscp/#user-manual) ou sur [Github](man.md).
Le manuel d'utilisateur peut être trouvé sur le [site de termscp](https://termscp.veeso.dev/termscp/#user-manual) ou sur [Github](man.md).
La documentation peut être trouvé sur Rust Docs <https://docs.rs/termscp>

View File

@@ -4,6 +4,8 @@
- [Usage ❓](#usage-)
- [Argument d'adresse 🌎](#argument-dadresse-)
- [Argument d'adresse AWS S3](#argument-dadresse-aws-s3)
- [Argument d'adresse WebDAV](#argument-dadresse-webdav)
- [Argument d'adresse SMB](#argument-dadresse-smb)
- [Comment le mot de passe peut être fourni 🔐](#comment-le-mot-de-passe-peut-être-fourni-)
- [S3 paramètres de connexion](#s3-paramètres-de-connexion)
- [Identifiants S3 🦊](#identifiants-s3-)
@@ -42,10 +44,7 @@ ou
- `-P, --password <password>` si l'adresse est fournie, le mot de passe sera cet argument
- `-b, --address-as-bookmark` résoudre l'argument d'adresse en tant que nom de signet
- `-c, --config` Ouvrir termscp à partir de la page de configuration
- `-q, --quiet` Désactiver la journalisation
- `-t, --theme <path>` Importer le thème spécifié
- `-u, --update` Mettre à jour termscp vers la dernière version
- `-v, --version` Imprimer les informations sur la version
- `-h, --help` Imprimer la page d'aide
@@ -103,6 +102,37 @@ e.g.
s3://buckethead@eu-central-1:default:/assets
```
#### Argument d'adresse WebDAV
Dans le cas où vous souhaitez vous connecter à WebDAV, utilisez la syntaxe suivante
```txt
http://<username>:<password>@<url></path>
```
ou dans le cas où vous souhaitez utiliser https
```txt
https://<username>:<password>@<url></path>
```
#### Argument d'adresse SMB
SMB a une syntaxe différente pour l'argument d'adresse CLI, qui est différente que vous soyez sur Windows ou sur d'autres systèmes :
syntaxe **Windows**:
```txt
\\[username@]<server-name>\<share>[\path\...]
```
syntaxe **Other systems**:
```txt
smb://[username@]<server-name>[:port]/<share>[/path/.../]
```
#### Comment le mot de passe peut être fourni 🔐
Vous avez probablement remarqué que, lorsque vous fournissez l'adresse comme argument, il n'y a aucun moyen de fournir le mot de passe.
@@ -212,6 +242,7 @@ Pour changer de panneau, vous devez taper `<LEFT>` pour déplacer le panneau de
| `<W>` | Ouvrir le fichier avec le programme spécifié | With |
| `<X>` | Exécuter une commande | eXecute |
| `<Y>` | Basculer la navigation synchronisée | sYnc |
| `<Z>` | Changer permissions de fichier | |
| `<CTRL+A>` | Sélectionner tous les fichiers | |
| `<CTRL+C>` | Abandonner le processus de transfert de fichiers | |
| `<CTRL+T>` | Afficher tous les chemins synchronisés | Track |
@@ -337,7 +368,7 @@ Ces paramètres peuvent être modifiés :
- **Local File formatter syntax**: syntaxe pour afficher les informations de fichier pour chaque fichier dans l'explorateur local. Voir [File explorer format](#format-de-lexplorateur-de-fichiers)
- **Enable notifications?**: S'il est défini sur `Yes`, les notifications seront affichées.
- **Notifications: minimum transfer size**: si la taille du transfert est supérieure ou égale à la valeur spécifiée, les notifications de transfert seront affichées. Les valeurs acceptées sont au format `{UNSIGNED} B/KB/MB/GB/TB/PB`
- **SSH configuration path** : définissez le fichier de configuration SSH à utiliser lors de la connexion à un serveur SCP/SFTP. S'il n'est pas défini (vide), aucun fichier ne sera utilisé. Vous pouvez spécifier un chemin commençant par `~` pour indiquer le chemin d'accueil (par exemple `~/.ssh/config`)
- **SSH configuration path** : définissez le fichier de configuration SSH à utiliser lors de la connexion à un serveur SCP/SFTP. S'il n'est pas défini (vide), aucun fichier ne sera utilisé. Vous pouvez spécifier un chemin commençant par `~` pour indiquer le chemin d'accueil (par exemple `~/.ssh/config`). Les paramétrages disponibles pour la configuration sont listées [ICI](https://github.com/veeso/ssh2-config#exposed-attributes).
### SSH Key Storage 🔐
@@ -479,9 +510,9 @@ Si le fichier se trouve sur l'hôte distant, le fichier sera d'abord télécharg
termscp écrit un fichier journal pour chaque session, qui est écrit à
- `$HOME/.config/termscp/termscp.log` sous Linux/BSD
- `$HOME/Library/Application Support/termscp/termscp.log` sous MacOs
- `FOLDERID_RoamingAppData\termscp\termscp.log` sous Windows
- `$HOME/.cache/termscp/termscp.log` sous Linux/BSD
- `$HOME/Library/Caches/termscp/termscp.log` sous MacOs
- `FOLDERID_LocalAppData\termscp\termscp.log` sous Windows
le journal ne sera pas tourné, mais sera simplement tronqué après chaque lancement de termscp, donc si vous souhaitez signaler un problème et que vous souhaitez joindre votre fichier journal, n'oubliez pas de sauvegarder le fichier journal dans un endroit sûr avant de l'utiliser termescp à nouveau.

View File

@@ -6,11 +6,11 @@
<p align="center">~ Un file transfer ricco di funzionalità ~</p>
<p align="center">
<a href="https://veeso.github.io/termscp/" target="_blank">Sito</a>
<a href="https://termscp.veeso.dev" target="_blank">Sito</a>
·
<a href="https://veeso.github.io/termscp/#get-started" target="_blank">Installazione</a>
<a href="https://termscp.veeso.dev/#get-started" target="_blank">Installazione</a>
·
<a href="https://veeso.github.io/termscp/#user-manual" target="_blank">Manuale utente</a>
<a href="https://termscp.veeso.dev/#user-manual" target="_blank">Manuale utente</a>
</p>
<p align="center">
@@ -62,8 +62,8 @@
/></a>
</p>
<p align="center">Sviluppato da <a href="https://veeso.github.io/" target="_blank">@veeso</a></p>
<p align="center">Versione corrente: 0.11.1 (07/03/2023)</p>
<p align="center">Sviluppato da <a href="https://veeso.dev/" target="_blank">@veeso</a></p>
<p align="center">Versione corrente: 0.13.0 (03/03/2024)</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"
@@ -137,6 +137,8 @@ Termscp è un file transfer ed explorer ricco di funzionalità, con supporto a S
- **SCP**
- **FTP** and **FTPS**
- **S3**
- **SMB**
- **WebDAV**
- 🖥 Esplora e opera sia sul file system locale che su quello remoto con una UI di facile utilizzo.
- Crea, rimuove, rinomina, cerca, visualizza e modifica file
- ⭐ Connettiti ai tuoi host preferiti tramite la funzionalità integrata dei segnalibri e delle connessioni recenti.
@@ -175,20 +177,20 @@ mentre se sei un utente Windows, puoi installare termscp con [Chocolatey](https:
choco install termscp
```
Per ulteriori informazioni sui metodi di installazione su altre piattaforme, visita [veeso.github.io](https://veeso.github.io/termscp/#get-started).
Per ulteriori informazioni sui metodi di installazione su altre piattaforme, visita [termscp.veeso.dev](https://termscp.veeso.dev/termscp/#get-started).
⚠️ Se stavi cercando come aggiornare la tua versione di termscp, puoi semplicemente lanciare termscp con questi argomenti: `(sudo) termscp --update` ⚠️
### Requisiti ❗
- Utenti **Linux**:
- libssh
- **Linux** users:
- libdbus-1
- pkg-config
- Utenti **FreeBSD**:
- libssh
- libsmbclient
- **FreeBSD** or, **NetBSD** users:
- dbus
- pkgconf
- libsmbclient
### Requisiti opzionali ✔️
@@ -221,7 +223,7 @@ Puoi fare una donazione tramite una di queste piattaforme:
## Manuale utente 📚
Il manuale utente lo puoi trovare sul [sito di termscp](https://veeso.github.io/termscp/#user-manual) o su [Github](man.md).
Il manuale utente lo puoi trovare sul [sito di termscp](https://termscp.veeso.dev/termscp/#user-manual) o su [Github](man.md).
---

View File

@@ -4,6 +4,8 @@
- [Argomenti da linea di comando ❓](#argomenti-da-linea-di-comando-)
- [Argomento indirizzo 🌎](#argomento-indirizzo-)
- [Argomento indirizzo per AWS S3](#argomento-indirizzo-per-aws-s3)
- [Argomento indirizzo per WebDAV](#argomento-indirizzo-per-webdav)
- [Indirizzo SMB](#indirizzo-smb)
- [Come fornire la password 🔐](#come-fornire-la-password-)
- [Parametri di connessione S3](#parametri-di-connessione-s3)
- [Credenziali S3 🦊](#credenziali-s3-)
@@ -42,10 +44,7 @@ O
- `-P, --password <password>` Se viene fornito l'argomento indirizzo, questa sarà la password utilizzata per autenticarsi
- `-b, --address-as-bookmark` risolve l'argomento indirizzo come nome di un segnalibro
- `-c, --config` Apri la configurazione di termscp
- `-q, --quiet` Disabilita i log
- `-t, --theme <path>` Importa il tema al percorso fornito
- `-u, --update` Aggiorna termscp all'ultima versione
- `-v, --version` Mostra a video le informazioni sulla versione attualmente installata
- `-h, --help` Mostra la pagina di aiuto.
@@ -101,6 +100,37 @@ e.g.
s3://buckethead@eu-central-1:default:/assets
```
#### Argomento indirizzo per WebDAV
Nel caso in cui si desideri connettersi a WebDAV utilizzare la seguente sintassi
```txt
http://<username>:<password>@<url></path>
```
oppure nel caso in cui si desideri utilizzare https
```txt
https://<username>:<password>@<url></path>
```
#### Indirizzo SMB
SMB ha una sintassi differente rispetto agli altri protocolli e cambia in base al sistema operativo:
**Windows**:
```txt
\\[username@]<server-name>\<share>[\path\...]
```
**Altri sistemi**:
```txt
smb://[username@]<server-name>[:port]/<share>[/path/.../]
```
#### Come fornire la password 🔐
Quando si usa l'argomento indirizzo non è possibile fornire la password direttamente nell'argomento, esistono però altri metodi per farlo:
@@ -208,6 +238,7 @@ Per cambiare pannello ti puoi muovere con le frecce, `<LEFT>` per andare sul pan
| `<W>` | Apri il file con il programma specificato | With |
| `<X>` | Esegui comando shell | eXecute |
| `<Y>` | Abilita/disabilita Sync-Browsing | sYnc |
| `<Z>` | Modifica permessi file | |
| `<CTRL+A>` | Seleziona tutti i file | |
| `<CTRL+C>` | Annulla trasferimento file | |
| `<CTRL+T>` | Visualizza tutti i percorsi sincronizzati | Track |
@@ -335,7 +366,7 @@ Questi parametri possono essere impostati:
- **Local File formatter syntax**: La formattazione da usare per formattare i file sull'explorer locale. Vedi [File explorer format](#file-explorer-format)
- **Enable notifications?**: Se impostato a `yes`, le notifiche desktop saranno abilitate.
- **Notifications: minimum transfer size**: se la dimensione di un trasferimento supera o è uguale al valore impostato, al termine del trasferimento riceverai una notifica desktop (se queste sono abilitate). Il formato del valore dev'essere `{UNSIGNED} B/KB/MB/GB/TB/PB`
- **SSH configuration path**: Imposta il percorso del file di configurazione per SSH, per quando ci si connette ad un server SFTP/SCP. Se lasciato vuoto, nessun file verrà usato. Il percorso può anche iniziare con `~` per indicare il percorso della home dell'utente attuale (e.s. `~/.ssh/config`).
- **SSH configuration path**: Imposta il percorso del file di configurazione per SSH, per quando ci si connette ad un server SFTP/SCP. Se lasciato vuoto, nessun file verrà usato. Il percorso può anche iniziare con `~` per indicare il percorso della home dell'utente attuale (e.s. `~/.ssh/config`). I parametri supportati dalla configurazioni sono descritti [QUI](https://github.com/veeso/ssh2-config#exposed-attributes).
### SSH Key Storage 🔐
@@ -478,9 +509,9 @@ Nel caso il file si trovi su host remoto, il file verrà prima scaricato tempora
termscp scrive un file di log per ogni sessione, nel percorso seguente:
- `$HOME/.config/termscp/termscp.log` su Linux/BSD
- `$HOME/Library/Application Support/termscp/termscp.log` su MacOs
- `FOLDERID_RoamingAppData\termscp\termscp.log` su Windows
- `$HOME/.cache/termscp/termscp.log` su Linux/BSD
- `$HOME/Library/Caches/termscp/termscp.log` su MacOs
- `FOLDERID_LocalAppData\termscp\termscp.log` su Windows
Il log non viene ruotato, ma viene troncato ad ogni lancio di termscp, quindi se devi riportare un issue, non avviare termscp fino a che non avrai salvato il file di log.
I log sono di default riportati a livello *INFO*, quindi non sono particolarmente parlanti.

View File

@@ -4,7 +4,12 @@
- [Usage ❓](#usage-)
- [Address argument 🌎](#address-argument-)
- [AWS S3 address argument](#aws-s3-address-argument)
- [WebDAV address argument](#webdav-address-argument)
- [SMB address argument](#smb-address-argument)
- [How Password can be provided 🔐](#how-password-can-be-provided-)
- [Subcommands](#subcommands)
- [Import a theme](#import-a-theme)
- [Install latest version](#install-latest-version)
- [S3 connection parameters](#s3-connection-parameters)
- [S3 credentials 🦊](#s3-credentials-)
- [File explorer 📂](#file-explorer-)
@@ -42,10 +47,7 @@ OR
- `-P, --password <password>` if address is provided, password will be this argument
- `-b, --address-as-bookmark` resolve address argument as a bookmark name
- `-c, --config` Open termscp starting from the configuration page
- `-q, --quiet` Disable logging
- `-t, --theme <path>` Import specified theme
- `-u, --update` Update termscp to latest version
- `-v, --version` Print version info
- `-h, --help` Print help page
@@ -103,6 +105,36 @@ e.g.
s3://buckethead@eu-central-1:default:/assets
```
#### WebDAV address argument
In case you want to connect to webDAV use the following syntax
```txt
http://<username>:<password>@<url></path>
```
or in case you want to use https
```txt
https://<username>:<password>@<url></path>
```
#### SMB address argument
SMB has a different syntax for CLI address argument, which is different whether you're on Windows or other systems:
**Windows** syntax:
```txt
\\[username@]<server-name>\<share>[\path\...]
```
**Other systems** syntax:
```txt
smb://[username@]<server-name>[:port]/<share>[/path/.../]
```
#### How Password can be provided 🔐
You have probably noticed, that, when providing the address as argument, there's no way to provide the password.
@@ -112,6 +144,16 @@ Password can be basically provided through 3 ways when address argument is provi
- Via `sshpass`: you can provide password via `sshpass`, e.g. `sshpass -f ~/.ssh/topsecret.key termscp cvisintin@192.168.1.31`
- You will be prompted for it: if you don't use any of the previous methods, you will be prompted for the password, as happens with the more classics tools such as `scp`, `ssh`, etc.
### Subcommands
#### Import a theme
Run termscp as `termscp theme <theme-file>`
#### Install latest version
Run termscp as `termscp update`
---
## S3 connection parameters
@@ -190,28 +232,29 @@ In order to change panel you need to type `<LEFT>` to move the remote explorer p
| `<BACKTAB>` | Switch between log tab and explorer | |
| `<A>` | Toggle hidden files | All |
| `<B>` | Sort files by | Bubblesort? |
| `<C|F5>` | Copy file/directory | Copy |
| `<D|F7>` | Make directory | Directory |
| `<E|F8|DEL>` | Delete file | Erase |
| `<C\|F5>` | Copy file/directory | Copy |
| `<D\|F7>` | Make directory | Directory |
| `<E\|F8\|DEL>`| Delete file | Erase |
| `<F>` | Search for files (wild match is supported) | Find |
| `<G>` | Go to supplied path | Go to |
| `<H|F1>` | Show help | Help |
| `<H\|F1>` | Show help | Help |
| `<I>` | Show info about selected file or directory | Info |
| `<K>` | Create symlink pointing to the currently selected entry | symlinK |
| `<L>` | Reload current directory's content / Clear selection | List |
| `<M>` | Select a file | Mark |
| `<N>` | Create new file with provided name | New |
| `<O|F4>` | Edit file; see Text editor | Open |
| `<O\|F4>` | Edit file; see Text editor | Open |
| `<P>` | Open log panel | Panel |
| `<Q|F10>` | Quit termscp | Quit |
| `<R|F6>` | Rename file | Rename |
| `<S|F2>` | Save file as... | Save |
| `<Q\|F10>` | Quit termscp | Quit |
| `<R\|F6>` | Rename file | Rename |
| `<S\|F2>` | Save file as... | Save |
| `<T>` | Synchronize changes to selected path to remote | Track |
| `<U>` | Go to parent directory | Up |
| `<V|F3>` | Open file with default program for filetype | View |
| `<V\|F3>` | Open file with default program for filetype | View |
| `<W>` | Open file with provided program | With |
| `<X>` | Execute a command | eXecute |
| `<Y>` | Toggle synchronized browsing | sYnc |
| `<Z>` | Change file mode | |
| `<CTRL+A>` | Select all files | |
| `<CTRL+C>` | Abort file transfer process | |
| `<CTRL+T>` | Show all synchronized paths | Track |
@@ -338,7 +381,7 @@ These parameters can be changed:
- **Local File formatter syntax**: syntax to display file info for each file in the local explorer. See [File explorer format](#file-explorer-format)
- **Enable notifications?**: If set to `Yes`, notifications will be displayed.
- **Notifications: minimum transfer size**: if transfer size is greater or equal than the specified value, notifications for transfer will be displayed. The accepted values are in format `{UNSIGNED} B/KB/MB/GB/TB/PB`
- **SSH configuration path**: Set SSH configuration file to use when connecting to a SCP/SFTP server. If unset (empty) no file will be used. You can specify a path starting with `~` to indicate the home path (e.g. `~/.ssh/config`)
- **SSH configuration path**: Set SSH configuration file to use when connecting to a SCP/SFTP server. If unset (empty) no file will be used. You can specify a path starting with `~` to indicate the home path (e.g. `~/.ssh/config`). The parameters supported by termscp are specified [HERE](https://github.com/veeso/ssh2-config#exposed-attributes).
### SSH Key Storage 🔐
@@ -480,9 +523,9 @@ In case the file is located on remote host, the file will be first downloaded in
termscp writes a log file for each session, which is written at
- `$HOME/.config/termscp/termscp.log` on Linux/BSD
- `$HOME/Library/Application Support/termscp/termscp.log` on MacOs
- `FOLDERID_RoamingAppData\termscp\termscp.log` on Windows
- `$HOME/.cache/termscp/termscp.log` on Linux/BSD
- `$HOME/Library/Caches/termscp/termscp.log` on MacOs
- `FOLDERID_LocalAppData\termscp\termscp.log` on Windows
the log won't be rotated, but will just be truncated after each launch of termscp, so if you want to report an issue and you want to attach your log file, keep in mind to save the log file in a safe place before using termscp again.
The logging by default reports in *INFO* level, so it is not very verbose.

View File

@@ -6,11 +6,11 @@
<p align="center">~ 功能丰富的终端文件传输工具 ~</p>
<p align="center">
<a href="https://veeso.github.io/termscp/" target="_blank">网站</a>
<a href="https://termscp.veeso.dev" target="_blank">网站</a>
·
<a href="https://veeso.github.io/termscp/#get-started" target="_blank">安装</a>
<a href="https://termscp.veeso.dev/#get-started" target="_blank">安装</a>
·
<a href="https://veeso.github.io/termscp/#user-manual" target="_blank">用户手册</a>
<a href="https://termscp.veeso.dev/#user-manual" target="_blank">用户手册</a>
</p>
<p align="center">
@@ -62,8 +62,8 @@
/></a>
</p>
<p align="center"><a href="https://veeso.github.io/" target="_blank">@veeso</a> 开发</p>
<p align="center">当前版本: 0.11.1 (07/03/2023)</p>
<p align="center"><a href="https://veeso.dev/" target="_blank">@veeso</a> 开发</p>
<p align="center">当前版本: 0.13.0 (03/03/2024)</p>
<p align="center">
<a href="https://opensource.org/licenses/MIT"
@@ -139,6 +139,8 @@ termscp 是一个功能丰富的终端文件浏览和传输工具,支持 SCP/S
- **SCP**
- **FTP** and **FTPS**
- **S3**
- **SMB**
- **WebDAV**
- 🖥 使用便捷的 UI 在远程和本地文件系统上浏览和操作
- 创建、删除、重命名、搜索、查看和编辑文件
- ⭐ 通过“内置书签”和“最近连接”快速连接到您的主机
@@ -178,7 +180,7 @@ curl -sSLf http://get-termscp.veeso.dev | sh
choco install termscp
```
如需更多信息或其他的平台支持,请访问 [veeso.github.io](https://veeso.github.io/termscp/#get-started) 查看所有安装方法。
如需更多信息或其他的平台支持,请访问 [termscp.veeso.dev](https://termscp.veeso.dev/termscp/#get-started) 查看所有安装方法。
⚠️ 如果您正在寻找如何更新 termscp 只需从 CLI 运行 termscp `(sudo) termscp --update` ⚠️
@@ -188,10 +190,12 @@ choco install termscp
- libssh
- libdbus-1
- pkg-config
- libsmbclient
- **FreeBSD** 用户:
- libssh
- dbus
- pkgconf
- libsmbclient
### 可选项 ✔️
@@ -225,7 +229,7 @@ choco install termscp
## 用户手册和文档 📚
用户手册可以在[termscp的网站](https://veeso.github.io/termscp/#user-manual)或者在[Github](man.md)上找到。
用户手册可以在[termscp的网站](https://termscp.veeso.dev/termscp/#user-manual)或者在[Github](man.md)上找到。
---

View File

@@ -4,6 +4,8 @@
- [用法](#用法)
- [地址参数](#地址参数)
- [AWS S3 地址参数](#aws-s3-地址参数)
- [WebDAV 地址参数](#webdav-地址参数)
- [SMB 地址参数](#smb-地址参数)
- [如何输入密码](#如何输入密码)
- [S3 连接参数](#s3-连接参数)
- [Aws S3 凭证](#aws-s3-凭证)
@@ -42,9 +44,7 @@ termscp启动时可以使用以下选项:
- `-P, --password <password>` 登陆密码
- `-b, --address-as-bookmark` 将地址参数解析为书签名称
- `-c, --config` 打开termscp时打开配置页面
- `-q, --quiet` 禁用日志
- `-t, --theme <path>` 导入自定义主题
- `-v, --version` 打印版本信息
- `-h, --help` 打开帮助
@@ -102,6 +102,35 @@ s3://<bucket-name>@<region>[:profile][:/wrkdir]
s3://buckethead@eu-central-1:default:/assets
```
#### WebDAV 地址参数
如果您想要连接到 WebDAV请使用以下语法
```txt
http://<username>:<password>@<url></path>
或者如果您想要使用 https
```
```txt
https://<username>:<password>@<url></path>
```
#### SMB 地址参数
SMB 对 CLI 地址参数有不同的语法,无论您是在 Windows 还是其他系统上,这都是不同的:
**Windows** 句法:
```txt
\\[username@]<server-name>\<share>[\path\...]
```
**其他系统** 句法:
```txt
smb://[username@]<server-name>[:port]/<share>[/path/.../]
```
#### 如何输入密码
你可能已经注意到url参数中没有办法直接附加密码你可以通过以下三种方式提供密码
@@ -209,6 +238,7 @@ termscp中的文件资源管理器是指你与远程建立连接后可以看到
| `<W>` | 使用指定程序打开文件 | With |
| `<X>` | 运行命令 | eXecute |
| `<Y>` | 是否开启同步浏览 | sYnc |
| `<Z>` | 更改文件权限 | |
| `<CTRL+A>` | 选中所有文件 | |
| `<CTRL+C>` | 终止文件传输 | |
| `<CTRL+T>` | 显示所有同步路径 | Track |
@@ -330,7 +360,7 @@ termscp和书签一样只需要保证这些路径是可访问的
- **Local File formatter syntax**:在本地资源管理器中显示每个文件的文件信息的语法。参见[资源管理器格式](#资源管理器格式)
- **Enable notifications?**: 如果设置为 `Yes`,则会显示通知。
- **Notifications: minimum transfer size**: 如果传输大小大于或等于指定值,将显示传输通知。 接受的值格式为 `{UNSIGNED} B/KB/MB/GB/TB/PB`
- **SSH Configuration path**:设置连接到 SCP/SFTP 服务器时使用的 SSH 配置文件。 如果未设置(空),则不会使用任何文件。 你可以指定一个以 `~` 开头的路径来表示主路径(例如 `~/.ssh/config`
- **SSH Configuration path**:设置连接到 SCP/SFTP 服务器时使用的 SSH 配置文件。 如果未设置(空),则不会使用任何文件。 你可以指定一个以 `~` 开头的路径来表示主路径(例如 `~/.ssh/config`. 指定了 termscp 支持的参数 [HERE](https://github.com/veeso/ssh2-config#exposed-attributes).
### SSH Key Storage
@@ -472,9 +502,9 @@ Termscp有很多功能你可能已经注意到了其中之一就是可以
termscp会为每个会话创建一个日志文件该文件在
- `$HOME/.config/termscp/termscp.log` -- Linux/BSD
- `$HOME/Library/Application Support/termscp/termscp.log` -- MacOs
- `FOLDERID_RoamingAppData\termscp\termscp.log` -- Windows
- `$HOME/.cache/termscp/termscp.log` -- Linux/BSD
- `$HOME/Library/Caches/termscp/termscp.log` -- MacOs
- `FOLDERID_LocalAppData\termscp\termscp.log` -- Windows
日志不会被轮换,但只会在每次启动 termcp 后被截断,因此如果您想报告问题并希望附加您的日志文件,请记住在使用前将日志文件保存在安全的地方 再次termscp。
默认情况下,日志记录在 *INFO* 级别报告,因此它不是很详细。

View File

@@ -8,7 +8,7 @@
# -f, -y, --force, --yes
# Skip the confirmation prompt during installation
TERMSCP_VERSION="0.11.1"
TERMSCP_VERSION="0.12.3"
GITHUB_URL="https://github.com/veeso/termscp/releases/download/v${TERMSCP_VERSION}"
DEB_URL_AMD64="${GITHUB_URL}/termscp_${TERMSCP_VERSION}_amd64.deb"
DEB_URL_AARCH64="${GITHUB_URL}/termscp_${TERMSCP_VERSION}_arm64.deb"
@@ -209,6 +209,18 @@ install_on_arch_linux() {
$pkg -S termscp
}
install_with_brew() {
info "Installing termscp with brew"
if has termscp; then
info "Upgrading ${GREEN}termscp${NO_COLOR}"
# The OR is used since someone could have installed via cargo previously
brew update && brew upgrade termscp || brew install veeso/termscp/termscp
else
info "Installing ${GREEN}termscp${NO_COLOR}"
brew install veeso/termscp/termscp
fi
}
install_on_linux() {
local msg
local sudo
@@ -271,6 +283,8 @@ install_on_linux() {
info "$msg"
$sudo rpm -U "${archive}"
rm -f ${archive}
elif has brew; then
install_with_brew
else
try_with_cargo "No suitable installation method found for your Linux distribution; if you're running on Arch linux, please install an AUR package manager (such as yay). Currently only Arch, Debian based and Red Hat based distros are supported" "linux"
fi
@@ -278,23 +292,7 @@ install_on_linux() {
install_on_macos() {
if has brew; then
# get homebrew formula name
if [ "${ARCH}" == "x86_64" ]; then
FORMULA="termscp"
elif [ "$ARCH" == "aarch64" ]; then
FORMULA="termscp-m1"
else
error "unsupported arch: $ARCH"
exit 1
fi
if has termscp; then
info "Upgrading ${GREEN}termscp${NO_COLOR}"
# The OR is used since someone could have installed via cargo previously
brew update && brew upgrade ${FORMULA} || brew install veeso/termscp/${FORMULA}
else
info "Installing ${GREEN}termscp${NO_COLOR}"
brew install veeso/termscp/${FORMULA}
fi
install_with_brew
else
try_with_cargo "brew is missing on your system; please install it from <https://brew.sh/>" "macos"
fi
@@ -306,14 +304,14 @@ install_bsd_cargo_deps() {
set -e
confirm "${YELLOW}libssh, gcc${NO_COLOR} are required to install ${GREEN}termscp${NO_COLOR}; would you like to proceed?"
sudo="$(elevate_priv_ex /usr/local/bin)"
$sudo pkg install -y curl wget libssh gcc dbus pkgconf
$sudo pkg install -y curl wget libssh gcc dbus pkgconf libsmbclient
info "Dependencies installed successfully"
}
install_linux_cargo_deps() {
local debian_deps="gcc pkg-config libdbus-1-dev"
local rpm_deps="gcc openssl pkgconfig libdbus-devel openssl-devel"
local arch_deps="gcc openssl pkg-config dbus"
local debian_deps="gcc pkg-config libdbus-1-dev libsmbclient-dev"
local rpm_deps="gcc openssl pkgconfig libdbus-devel openssl-devel libsmbclient-devel"
local arch_deps="gcc openssl pkg-config dbus smbclient"
local deps_cmd=""
# Get pkg manager
if has apt; then
@@ -478,8 +476,8 @@ case $PLATFORM in
esac
completed "Congratulations! Termscp has successfully been installed on your system!"
info "If you're a new user, you might be interested in reading the user manual <https://veeso.github.io/termscp/#user-manual>"
info "While if you've just updated your termscp version, you can find the changelog at this link <https://veeso.github.io/termscp/#changelog>"
info "If you're a new user, you might be interested in reading the user manual <https://termscp.veeso.dev/#user-manual>"
info "While if you've just updated your termscp version, you can find the changelog at this link <https://termscp.veeso.dev/#changelog>"
info "Remember that if you encounter any issue, you can report them on Github <https://github.com/veeso/termscp/issues/new>"
info "Feel free to open an issue also if you have an idea which could improve the project"
info "If you want to support the project, please, consider a little donation <https://ko-fi.com/veeso>"

2
rustfmt.toml Normal file
View File

@@ -0,0 +1,2 @@
group_imports = "StdExternalCrate"
imports_granularity = "Module"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

After

Width:  |  Height:  |  Size: 77 KiB

74
site/changelog.html Normal file
View File

@@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en_US" class="dark">
<head>
<title>
termscp is a terminal file transfer and explorer for SCP/SFTP/FTP/S3/SMB/WebDAV | termscp
</title>
<meta property="og:description"
content="termscp is a feature rich terminal file transfer and explorer, with support for SCP/SFTP/FTP/S3. It is Linux, MacOS, FreeBSD, NetBSD and Windows compatible" />
<meta name="description"
content="termscp is a feature rich terminal file transfer and explorer, with support for SCP/SFTP/FTP/S3. It is Linux, MacOS, FreeBSD, NetBSD and Windows compatible" />
<meta property="og:title" content="termscp is a terminal file transfer and explorer for SCP/SFTP/FTP/S3 | termscp" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="index, follow" />
<meta property="og:image" content="https://termscp.veeso.dev/assets/images/og_preview.jpg" />
<meta property="og:image:type" content="image/jpg" />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="640" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="termscp" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="https://termscp.veeso.dev" />
<!-- Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.11.0/devicon.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/fontawesome.min.css"
integrity="sha512-OdEXQYCOldjqUEsuMKsZRj93Ht23QRlhIb8E/X0sbwZhme8eUw6g8q7AdxGJKakcBbv7+/PX0Gc2btf7Ru8cZA=="
crossorigin="anonymous" />
<!-- tailwind -->
<link href="output.css" rel="stylesheet" />
<!-- Favicons -->
<link rel="icon" type="image/png" sizes="96x96" href="assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png" />
</head>
<body>
<div id="layout" class="dark:bg-brand dark:text-gray-100">
<!-- Menu -->
<header id="menu"></header>
<main>
<div id="main" class="w-8/12 sm:w-full mx-auto pt-4 pb-8"></div>
</main>
<footer id="footer"></footer>
</div>
<!-- Scripts -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Showdown JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"
integrity="sha512-L03kznCrNOfVxOUovR6ESfCz9Gfny7gihUX/huVbQB9zjODtYpxaVtIaAkpetoiyV2eqWbvxMH9fiSv5enX7bw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Local -->
<script src="js/lang.min.js"></script>
<script src="js/core.js"></script>
<script src="js/events.js"></script>
<script src="js/resolvers.js"></script>
<!-- ko-fi -->
<script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script>
<script>
kofiWidgetOverlay.draw("veeso", {
type: "floating-chat",
"floating-chat.donateButton.text": "Support me",
"floating-chat.donateButton.background-color": "#31363b",
"floating-chat.donateButton.text-color": "#fff",
});
</script>
</body>
</html>

View File

@@ -1,45 +0,0 @@
.start h1 {
font-size: 2.5em;
}
.start h2 {
font-size: 2em;
}
.start h3 {
font-size: 1.6em;
}
.start h2 i,
h3 i {
color: #606060;
}
.start .sub-system {
padding: 0px 2em;
}
.start .sub-system .installation {
padding: 0px 2em;
width: 80%;
}
.start .installation {
padding: 2px 4em;
width: 80%;
}
.start .installation p {
font-size: 1.3em;
font-weight: 300;
}
.start .installation li {
font-size: 1.1em;
font-weight: 300;
}
.start .installation a {
text-decoration: none;
color: dodgerblue;
}

View File

@@ -1,121 +0,0 @@
/** Intro */
.intro {
text-align: center;
}
.intro .title {
font-size: 5em;
}
.intro .logo {
border-radius: 25%;
height: auto;
width: 256px;
}
.intro .caption {
font-size: 2em;
font-weight: 300;
width: 100%;
}
.intro .get-started {
background-color: #404040;
border-radius: 0.5em;
color: snow;
font-size: 1.5em;
}
.intro .get-started a {
color: snow;
text-decoration: none;
}
.intro .features {
align-content: stretch;
align-items: flex-start;
border-top: 1px solid #eee;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-top: 2.5rem;
padding: 1.2rem 0;
}
.intro .feature {
flex: auto;
}
@media (min-width: 600px) {
.intro .feature {
flex-grow: 1;
flex-basis: 30%;
max-width: 30%;
}
}
.intro .feature h3 {
color: #101010;
font-size: 1.5em;
font-weight: 400;
}
.intro .feature p {
color: #303030;
}
.intro .preview {
border-radius: 5px;
padding: 5% 10%;
width: 80%;
}
.intro .preview video {
height: auto;
width: 100%;
}
.intro .discover {
align-content: stretch;
align-items: flex-start;
border-top: 1px solid #eee;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin-left: 0;
margin-top: 2.5rem;
padding: 1.2rem 0;
width: 100%;
}
@media (min-width: 600px) {
.intro .discover {
margin-left: 20%;
width: 60%;
}
}
.intro .discover .hook {
flex-grow: 1;
flex-basis: 30%;
font-size: 1.5em;
max-width: 30%;
}
.intro .discover .hook a {
text-decoration: none;
color: #404040;
}
.intro .discover .hook a i {
font-size: 0.8em;
}
.intro .discover .hook a {
transition: all 0.4s ease-in;
}
.intro .discover .hook a:hover {
color: dodgerblue;
}

View File

@@ -1,179 +0,0 @@
html {
scroll-behavior: smooth;
}
body {
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen,
Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;
}
pre {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
color: #d0d0d0;
background-color: #222629;
border-radius: 3px;
word-wrap: normal;
border-radius: 0.5em;
}
pre .function {
color: #f08d49;
}
pre .string {
color: #7ec699;
}
h1,
h2,
h3,
h4,
h5 {
font-weight: 300;
}
header {
margin: 0 2em 0 0;
}
.img-circle {
border-radius: 50%;
}
.pull-left {
float: left;
}
.pull-right {
float: right;
}
section.page {
width: 100%;
height: auto;
border-top: 1px solid #aaa;
display: inline-block;
padding-bottom: 2em;
}
section.page hr {
margin: 1em 0 1em 0;
}
.container {
width: 90%;
height: auto;
margin-left: auto;
margin-right: auto;
overflow: auto;
}
.container header a {
color: inherit;
text-decoration: none;
border-bottom: dotted 1px #80808080;
cursor: text;
}
.container header a i {
color: #606060;
}
/** Footer */
footer {
text-align: center;
background-color: #eee;
padding: 1em;
}
footer .contacts {
list-style: none;
cursor: default;
margin-block-start: 0;
padding-inline-start: 0;
}
footer .contacts li {
display: inline-block;
}
footer .contacts a {
border: 0;
font-size: 3em;
color: #606060;
display: inline-block;
width: 2em;
height: 2em;
line-height: 2em;
text-align: center;
text-decoration: none;
}
footer .contacts a i {
transition: all 0.4s ease-in;
}
footer .contacts li a:hover i {
color: dodgerblue !important;
}
footer p.copyright {
color: #404040;
font-weight: 300;
text-align: center;
}
.alert {
border: 1px solid transparent;
border-radius: 0.25rem;
margin-top: 1rem;
margin-bottom: 1rem;
padding: 0.5rem;
position: relative;
}
.alert-center {
margin-left: auto;
margin-right: auto;
width: 50%;
}
.alert-warning {
background-color: #fff3cd;
border-color: #ffeeba;
color: #856404;
}
.alert-danger {
background-color: #f8d7da;
border-color: #f5c6cb;
color: #721c24;
}
.alert-success {
background-color: #d4edda;
border-color: #c3e6cb;
color: #155724;
}
.alert-primary {
background-color: #cce5ff;
border-color: #b8daff;
color: #004085;
}
/* ko-fi */
.floatingchat-container-wrap {
left: auto !important;
right: 16px !important;
}
.floating-chat-kofi-popup-iframe {
left: auto !important;
right: 16px !important;
}

View File

@@ -12,7 +12,6 @@
}
.markdown p {
color: #202020;
font-size: 1.1em;
}
@@ -46,16 +45,11 @@
.markdown blockquote {
border-left: 0.25em solid #ccc;
color: #606060;
font-size: 90%;
padding: 0.1em;
padding-left: 0.5em;
}
.markdown blockquote p {
color: #606060;
}
.markdown pre code {
background-color: inherit;
font-size: 100%;
@@ -68,6 +62,10 @@
padding: 0.2em 0.4em;
}
:is(.dark) .markdown code {
background-color: #404040;
}
.markdown table {
border-collapse: collapse;
border-spacing: 0;
@@ -82,14 +80,6 @@
border-top: 1px solid #c6cbd1;
}
.markdown table tr {
background-color: white;
}
.markdown table tr:nth-child(even) {
background-color: #dfe2e5;
}
.markdown table td,
.markdown table th {
border: 1px solid #c6cbd1;

View File

@@ -1,268 +0,0 @@
/** Menu */
#menu {
margin-left: -20vw; /* "#menu" width */
width: 20vw;
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: 1000; /* so the menu or its navicon stays above all content */
background: #f0f0f0;
overflow-y: auto;
}
/*
All anchors inside the menu should be styled like this.
*/
#menu a {
color: #606060;
border: none;
padding: 0.6em 0 0.6em 0.6em;
font-size: 1.4em;
}
/*
Remove all background/borders, since we are applying them to #menu.
*/
#menu .pure-menu,
#menu .pure-menu ul {
border: none;
background: transparent;
}
/*
Add that light border to separate items into groups.
*/
#menu .pure-menu ul,
#menu .pure-menu .menu-item-divided {
border-top: 1px solid #808080;
}
#menu .pure-menu i {
margin-right: 1ch;
}
#menu .pure-menu-item i {
font-size: 0.6em;
}
/*
Change color of the anchor links on hover/focus.
*/
#menu .pure-menu li a:hover,
#menu .pure-menu li a:focus {
background: #ccc;
}
/*
This styles the selected menu item `<li>`.
*/
#menu .pure-menu-selected {
background: #ddd;
}
#menu .pure-menu-selected i {
color: dodgerblue;
}
/*
This styles a link within a selected menu item `<li>`.
*/
#menu .pure-menu-selected a {
color: dodgerblue;
font-weight: 500;
}
/*
This styles the menu heading.
*/
#menu .pure-menu-heading {
color: #202020;
margin: 0;
margin: 10% 5% 10% 5%;
position: relative;
font-weight: 700;
}
#menu .pure-menu-heading .avatar {
width: 30%;
border-radius: 0.5em;
}
#menu .pure-menu-heading h1 {
font-size: 1.4em;
text-transform: none;
}
#menu .pure-menu-heading p {
color: #404040;
font-size: 1.1em;
font-weight: 300;
text-transform: none;
white-space: normal;
}
#menu .pure-menu-bottom {
bottom: 0;
display: none;
left: 0;
position: absolute;
text-align: center;
width: 100%;
}
@media (min-width: 640px) {
#menu .pure-menu-bottom {
display: block;
}
}
#menu .pure-menu-bottom a {
font-size: 1.5em;
color: #606060;
display: inline-block;
text-align: center;
border: 0;
text-decoration: none;
text-align: center;
white-space: normal;
}
#menu .pure-menu-bottom a:hover {
color: #404040;
}
#menu .pure-menu-bottom ul {
list-style: none;
cursor: default;
margin-block-start: 0;
padding-inline-start: 0;
}
#menu .pure-menu-bottom ul li {
display: inline-block;
text-align: center;
}
/* -- Dynamic Button For Responsive Menu -------------------------------------*/
/*
The button to open/close the Menu is custom-made and not part of Pure. Here's
how it works:
*/
/*
`.menu-link` represents the responsive menu toggle that shows/hides on
small screens.
*/
.menu-link {
position: fixed;
display: block; /* show this only on small screens */
top: 0;
left: 0; /* "#menu width" */
background: #eee;
background: rgba(0, 0, 0, 0.7);
font-size: 10px; /* change this value to increase/decrease button size */
z-index: 10;
width: 2em;
height: auto;
padding: 2.1em 1.6em;
}
.menu-link:hover,
.menu-link:focus {
background: #202020;
}
.menu-link span {
position: relative;
display: block;
}
.menu-link span,
.menu-link span:before,
.menu-link span:after {
background-color: #fff;
pointer-events: none;
width: 100%;
height: 0.2em;
}
.menu-link span:before,
.menu-link span:after {
position: absolute;
margin-top: -0.6em;
content: " ";
}
.menu-link span:after {
margin-top: 0.6em;
}
/* -- Responsive Styles (Media Queries) ------------------------------------- */
#layout,
#menu,
.menu-link {
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
-ms-transition: all 0.2s ease-out;
-o-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
}
#layout {
position: relative;
left: 0;
padding-left: 0;
}
#layout.active #menu {
left: 20vw;
width: 240px;
}
#layout.active .menu-link {
left: 240px;
}
/*
Hides the menu at `640px`, but modify this based on your app's needs.
*/
@media (min-width: 640px) {
.header {
padding-left: 2em;
padding-right: 2em;
}
#layout {
padding-left: 20vw; /* left col width "#menu" */
left: 0;
}
#menu {
left: 20vw;
}
.menu-link {
position: fixed;
left: 20vw;
display: none;
}
#layout.active .menu-link {
left: 20vw;
}
}
@media (max-width: 640px) {
/* Only apply this when the window is small. Otherwise, the following
case results in extra padding on the left:
* Make the window small.
* Tap the menu to trigger the active state.
* Make the window large again.
*/
#main.active {
position: relative;
left: 20vw;
}
}

View File

@@ -1,38 +0,0 @@
.updates h1 {
font-size: 2.5em;
}
.updates h2 {
font-size: 2em;
}
.updates h3 {
font-size: 1.6em;
}
.updates h2 i,
h3 i {
color: #606060;
}
.updates .desc {
font-size: 1.1em;
text-align: justify;
}
.updates ol {
font-size: 1.2em;
}
.wall-of-text {
color: #444;
line-height: 1.8em;
margin: 0 auto;
text-align: justify;
width: 90%;
}
.tl-dr {
font-size: 1.2em;
font-weight: bold;
}

75
site/get-started.html Normal file
View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en_US" class="dark">
<head>
<title>
get started with termscp | termscp
</title>
<meta property="og:description"
content="Install termscp within a couple of minutes with the shell script" />
<meta name="description"
content="Install termscp within a couple of minutes with the shell script" />
<meta property="og:title" content="get started with termscp | termscp" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="index, follow" />
<meta property="og:image" content="https://termscp.veeso.dev/assets/images/og_preview.jpg" />
<meta property="og:image:type" content="image/jpg" />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="640" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="termscp" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="https://termscp.veeso.dev" />
<!-- Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.11.0/devicon.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/fontawesome.min.css"
integrity="sha512-OdEXQYCOldjqUEsuMKsZRj93Ht23QRlhIb8E/X0sbwZhme8eUw6g8q7AdxGJKakcBbv7+/PX0Gc2btf7Ru8cZA=="
crossorigin="anonymous" />
<!-- tailwind -->
<link href="output.css" rel="stylesheet" />
<!-- Favicons -->
<link rel="icon" type="image/png" sizes="96x96" href="assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png" />
</head>
<body>
<div id="layout" class="dark:bg-brand dark:text-gray-100">
<!-- Menu -->
<header id="menu"></header>
<main>
<div id="main" class="w-8/12 sm:w-full mx-auto pt-4 pb-8"></div>
</main>
<footer id="footer"></footer>
</div>
<!-- Scripts -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Showdown JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"
integrity="sha512-L03kznCrNOfVxOUovR6ESfCz9Gfny7gihUX/huVbQB9zjODtYpxaVtIaAkpetoiyV2eqWbvxMH9fiSv5enX7bw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Local -->
<script src="js/lang.min.js"></script>
<script src="js/core.js"></script>
<script src="js/events.js"></script>
<script src="js/resolvers.js"></script>
<!-- ko-fi -->
<script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script>
<script>
kofiWidgetOverlay.draw("veeso", {
type: "floating-chat",
"floating-chat.donateButton.text": "Support me",
"floating-chat.donateButton.background-color": "#31363b",
"floating-chat.donateButton.text-color": "#fff",
});
</script>
</body>
</html>

View File

@@ -0,0 +1,38 @@
<!DOCTYPE html>
<div class="flex flex-col bg-brand text-gray-200 justify-around items-center gap-12 p-8 sm:pb-24">
<div class="flex flex-row justify-around items-center gap-16 w-3/6 sm:w-full">
<div>
<a href="https://github.com/veeso/termscp" class="text-3xl sm:text-xl no-underline" target="_blank"><i
class="devicon-github-original"></i></a>
</div>
<div>
<a href="https://crates.io/crates/termscp" class="text-3xl sm:text-xl no-underline" target="_blank"><i
class="devicon-rust-plain"></i></a>
</div>
<div>
<a href="https://community.chocolatey.org/packages/termscp" class="text-3xl sm:text-xl no-underline"
target="_blank"><i class="devicon-windows8-plain"></i></a>
</div>
<div>
<a href="https://ko-fi.com/veeso" target="_blank" class="text-3xl sm:text-xl no-underline"><i
class="fa fa-coffee"></i></a>
</div>
</div>
<div class="flex flex-col justify-around gap-1 items-center w-full">
<!-- vat number -->
<p class="text-sm font-thin">
<span>P.IVA IT03104140300 </span>
</p>
<p class="text-xs font-thin">
<span>Via Antonio Marangoni 33, 33100, Udine (UD)</span>
</p>
<!-- Copyright -->
<p class="text-xs font-thin">
<span>Christian Visintin © </span><span resolve-copyright></span>
<span>&nbsp;|&nbsp;</span>
<a class="text-xs font-thin" href="https://veeso.dev/en/privacy" target="_blank">Privacy policy</a>
<span>&nbsp;|&nbsp;</span>
<a class="text-xs font-thin" href="https://veeso.dev/en/cookie-policy" target="_blank">Cookie policy</a>
</p>
</div>
</div>

View File

@@ -0,0 +1,97 @@
<!DOCTYPE html>
<div
class="flex flex-row fixed bg-gray-100 dark:bg-brand text-brand dark:text-gray-100 border-b border-gray-400 dark:border-gray-800 items-center justify-between w-screen h-auto py-4 px-8">
<!-- Desktop menu-->
<div class="sm:hidden flex flex-row justify-start items-center gap-12 w-full">
<h2 class="lg:text-xl md:text-lg dark:text-gray-100">
<a href="/">
<img class="w-[32px] h-auto m-auto inline-block mr-2 hover:underline" alt="logo"
src="assets/images/termscp.webp" />&nbsp;termscp
</a>
</h2>
<h2 class="lg:text-xl md:text-lg dark:text-gray-100 hover:underline">
<a translate="menu.getStarted" href="/get-started.html"></a>
</h2>
<h2 class="lg:text-xl md:text-lg dark:text-gray-100 hover:underline">
<a translate="menu.updates" href="/updates.html"></a>
</h2>
<h2 class="lg:text-xl md:text-lg dark:text-gray-100 hover:underline">
<a translate="menu.manual" href="/user-manual.html"></a>
</h2>
<h2 class="lg:text-xl md:text-lg dark:text-gray-100 hover:underline">
<a translate="menu.changelog" href="/changelog.html"></a>
</h2>
<!-- End region -->
<div class="flex flex-row self-end justify-end items-center gap-8 flex-1">
<!-- Dark/light theme toggle -->
<button id="theme-toggle" type="button" onclick="toggleTheme()"
class="text-brand dark:text-gray-100 hover:bg-gray-100 dark:hover:bg-gray-700 focus:outline-none focus:ring-4 focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg lg:text-2xl md:text-lg p-2.5">
<svg id="theme-toggle-dark-icon" class="w-5 h-5 hidden" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path d="M17.293 13.293A8 8 0 016.707 2.707a8.001 8.001 0 1010.586 10.586z"></path>
</svg>
<svg id="theme-toggle-light-icon" class="w-5 h-5 hidden" fill="currentColor" viewBox="0 0 20 20"
xmlns="http://www.w3.org/2000/svg">
<path
d="M10 2a1 1 0 011 1v1a1 1 0 11-2 0V3a1 1 0 011-1zm4 8a4 4 0 11-8 0 4 4 0 018 0zm-.464 4.95l.707.707a1 1 0 001.414-1.414l-.707-.707a1 1 0 00-1.414 1.414zm2.12-10.607a1 1 0 010 1.414l-.706.707a1 1 0 11-1.414-1.414l.707-.707a1 1 0 011.414 0zM17 11a1 1 0 100-2h-1a1 1 0 100 2h1zm-7 4a1 1 0 011 1v1a1 1 0 11-2 0v-1a1 1 0 011-1zM5.05 6.464A1 1 0 106.465 5.05l-.708-.707a1 1 0 00-1.414 1.414l.707.707zm1.414 8.486l-.707.707a1 1 0 01-1.414-1.414l.707-.707a1 1 0 011.414 1.414zM4 11a1 1 0 100-2H3a1 1 0 000 2h1z"
fill-rule="evenodd" clip-rule="evenodd"></path>
</svg>
</button>
<!-- Socials -->
<div>
<a href="https://github.com/veeso/termscp" class="lg:text-2xl md:text-lg dark:text-gray-100" target="_blank"><i
class="devicon-github-original"></i></a>
</div>
<div>
<a href="https://crates.io/crates/termscp" class="lg:text-2xl md:text-lg dark:text-gray-100" target="_blank"><i
class="devicon-rust-plain"></i></a>
</div>
<div>
<a href="https://www.linkedin.com/in/christian-visintin/" class="lg:text-2xl md:text-lg dark:text-gray-100"
target="_blank"><i class="devicon-linkedin-plain"></i></a>
</div>
<div>
<a href="https://twitter.com/veeso_dev" target="_blank" class="lg:text-2xl md:text-lg dark:text-gray-100"><i
class="devicon-twitter-plain"></i></a>
</div>
</div>
</div>
<!-- Mobile topbar -->
<div class="sm:flex hidden flex-row justify-start items-center gap-8 w-full">
<h2 class="text-2xl dark:text-gray-100">
<a href="/">
<img class="w-[32px] h-auto m-auto inline-block mr-2" alt="logo"
src="assets/images/termscp.webp" />&nbsp;termscp
</a>
</h2>
<div id="menu-icon" class="justify-self-end flex-1 flex justify-end">
<i onclick="onToggleMenu()" class="fa fa-bars text-2xl cursor-pointer"></i>
</div>
</div>
</div>
<!-- Mobile menu -->
<div id="mobile-menu"
class="hidden transition-all fixed top-0 left-0 h-screen bg-brand text-white w-screen flex-col justify-start items-center p-8">
<div class="flex flex-row justify-end items-end w-full">
<div id="menu-icon" class="justify-self-end flex-1 flex justify-end">
<i onclick="onToggleMenu()" class="fa fa-bars text-2xl cursor-pointer"></i>
</div>
</div>
<div class="flex flex-col justify-start items-center w-full gap-4 hover:underline">
<h2 class="text-2xl text-white">
<a translate="menu.intro" href="/"></a>
</h2>
<h2 class="text-2xl text-white hover:underline">
<a translate="menu.getStarted" href="/get-started.html"></a>
</h2>
<h2 class="text-2xl text-white hover:underline">
<a translate="menu.updates" href="/updates.html"></a>
</h2>
<h2 class="text-2xl text-white hover:underline">
<a translate="menu.manual" href="/user-manual.html"></a>
</h2>
<h2 class="text-2xl text-white hover:underline">
<a translate="menu.changelog" href="/changelog.html"></a>
</h2>
</div>
</div>

View File

@@ -1,23 +1,17 @@
<head>
<link rel="stylesheet" href="css/get-started.css" />
</head>
<!DOCTYPE html>
<body>
<section id="start" class="container start">
<h1 translate="getStarted.title">Get started</h1>
<section>
<h2>
<i class="fa fa-rocket"></i>&nbsp;<span
translate="getStarted.quickSetup"
>Quick setup</span
>
<section id="start" class="flex flex-col mx-auto items-center justify-center w-full px-12 gap-8 dark:text-gray-100">
<h1 translate="getStarted.title" class="text-3xl font-thin">Get started</h1>
<section class="w-full">
<h2 class="text-2xl font-thin">
<i class="fa fa-rocket"></i>&nbsp;<span translate="getStarted.quickSetup">Quick setup</span>
</h2>
<div class="installation">
<div class="alert alert-primary">
<p>
<div class="p-4 my-4 text-sm text-blue-800 rounded-lg bg-blue-50">
<p class="text-lg">
<i class="fas fa-info-circle"></i>
<span translate="getStarted.suggested"
>We strongly suggest this method to install termscp</span
>
<span translate="getStarted.suggested">We strongly suggest this method to install termscp</span>
</p>
</div>
<p translate="getStarted.posixUsers">
@@ -27,175 +21,137 @@
<pre><span class="function">curl</span> --proto <span class="string">'=https'</span> --tlsv1.2 -sSLf <span class="string">"https://git.io/JBhDb"</span> | sh</pre>
</div>
</section>
<section>
<h2>
<i class="devicon-windows8-plain"></i>&nbsp;<span
translate="getStarted.windows.title"
>Windows users</span
>
<section class="w-full">
<h2 class="text-2xl font-thin">
<i class="devicon-windows8-plain"></i>&nbsp;<span translate="getStarted.windows.title">Windows users</span>
</h2>
<div class="installation">
<p>
<span translate="getStarted.windows.intro"
>You can install termscp on Windows via</span
>
<a
href="https://community.chocolatey.org/packages/termscp"
target="_blank"
>Chocolatey</a
>
<span translate="getStarted.windows.intro">You can install termscp on Windows via</span>
<a href="https://community.chocolatey.org/packages/termscp" target="_blank">Chocolatey</a>
</p>
<pre><span class="function">choco</span> install <span class="string">termscp</span></pre>
<p>
<span translate="getStarted.windows.moderation"
>Consider that Chocolatey moderation can take up to a few weeks
<span translate="getStarted.windows.moderation">Consider that Chocolatey moderation can take up to a few weeks
since last release, so if the latest version is not available yet,
you can install it downloading the ZIP file from</span
>
<a
href="https://github.com/veeso/termscp/releases/latest/download/termscp.0.11.1.nupkg"
target="_blank"
>Github</a
>
<span translate="getStarted.windows.then"
>and then, from the ZIP directory, install it via</span
>
you can install it downloading the ZIP file from</span>
<a href="https://github.com/veeso/termscp/releases/latest/download/termscp.0.13.0.nupkg"
target="_blank">Github</a>
<span translate="getStarted.windows.then">and then, from the ZIP directory, install it via</span>
</p>
<pre><span class="function">choco</span> install <span class="string">termscp</span> -s .</pre>
</div>
</section>
<section>
<h2>
<i class="devicon-linux-plain"></i>&nbsp;<span
translate="getStarted.linuxUsers"
>Linux users</span
>
<section class="w-full">
<h2 class="text-2xl font-thin">
<i class="devicon-linux-plain"></i>&nbsp;<span translate="getStarted.linuxUsers">Linux users</span>
</h2>
<div class="sub-system">
<div class="alert alert-warning">
<p>
<div class="p-4 my-4 text-sm text-yellow-800 rounded-lg bg-yellow-50">
<p class="text-lg">
<i class="fas fa-exclamation-triangle"></i>
<span translate="getStarted.notConfident"
>Opt for these methods instead if you don't feel confident using
the shell script</span
>
<span translate="getStarted.notConfident">Opt for these methods instead if you don't feel confident using
the shell script</span>
</p>
</div>
<h3>
<i class="devicon-linux-plain"></i>&nbsp;<span
translate="getStarted.arch.title"
>Arch derived users</span
>
<i class="devicon-linux-plain"></i>&nbsp;<span translate="getStarted.arch.title">Arch derived users</span>
</h3>
<div class="installation">
<p>
<span translate="getStarted.arch.intro"
>On Arch Linux based distros, you can install termscp using an AUR
package manager such as</span
>
<span translate="getStarted.arch.intro">On Arch Linux based distros, you can install termscp using an AUR
package manager such as</span>
<a href="https://github.com/Jguer/yay" target="_blank">yay</a>
<span translate="getStarted.arch.then">then run:</span>
</p>
<pre><span class="function">yay</span> -S <span class="string">termscp</span></pre>
</div>
<h3>
<i class="devicon-debian-plain"></i>&nbsp;<span
translate="getStarted.debian.title"
>Debian derived users</span
>
<i class="devicon-debian-plain"></i>&nbsp;<span translate="getStarted.debian.title">Debian derived
users</span>
</h3>
<div class="installation">
<p translate="getStarted.debian.body">
On Debian based distros, you can install termscp using the Deb
package via:
</p>
<pre><span class="function">wget</span> -O termscp.deb <span class="string">https://github.com/veeso/termscp/releases/latest/download/termscp_0.11.1_amd64.deb</span>
<pre><span class="function">wget</span> -O termscp.deb <span class="string">https://github.com/veeso/termscp/releases/latest/download/termscp_0.13.0_amd64.deb</span>
sudo <span class="function">dpkg</span> -i <span class="string">termscp.deb</span></pre>
</div>
<h3>
<i class="devicon-redhat-plain"></i>&nbsp;<span
translate="getStarted.redhat.title"
>Redhat derived users</span
>
<i class="devicon-redhat-plain"></i>&nbsp;<span translate="getStarted.redhat.title">Redhat derived
users</span>
</h3>
<div class="installation">
<p translate="getStarted.redhat.body">
On RedHat based distros, you can install termscp using the RPM
package via:
</p>
<pre><span class="function">wget</span> -O termscp.rpm <span class="string">https://github.com/veeso/termscp/releases/latest/download/termscp-0.11.1-1.x86_64.rpm</span>
<pre><span class="function">wget</span> -O termscp.rpm <span class="string">https://github.com/veeso/termscp/releases/latest/download/termscp-0.13.0-1.x86_64.rpm</span>
sudo <span class="function">rpm</span> -U <span class="string">termscp.rpm</span></pre>
</div>
<h3>
<span>Brew</span>
</h3>
<div class="installation">
<p>
<span translate="getStarted.macos.install">Install termscp via</span>&nbsp;
<a href="https://brew.sh/" target="_blank">Brew</a>
</p>
<pre><span class="function">brew</span> install <span class="string">veeso/termscp/termscp</span></pre>
</div>
</div>
</section>
<section>
<h2>
<i class="devicon-apple-plain"></i>&nbsp;<span
translate="getStarted.macos.title"
>MacOS users</span
>
<section class="w-full">
<h2 class="text-2xl font-thin">
<i class="devicon-apple-plain"></i>&nbsp;<span translate="getStarted.macos.title">MacOS users</span>
</h2>
<div class="installation">
<div class="alert alert-warning">
<p>
<div class="p-4 my-4 text-sm text-yellow-800 rounded-lg bg-yellow-50">
<p class="text-lg">
<i class="fas fa-exclamation-triangle"></i>
<span translate="getStarted.notConfident"
>Opt for this method instead if you don't feel confident using the
shell script</span
>
<span translate="getStarted.notConfident">Opt for these methods instead if you don't feel confident using
the shell script</span>
</p>
</div>
<p>
<span translate="getStarted.macos.install">Install termscp via</span
>&nbsp;
<span translate="getStarted.macos.install">Install termscp via</span>&nbsp;
<a href="https://brew.sh/" target="_blank">Brew</a>
</p>
<pre><span class="function">brew</span> install <span class="string">veeso/termscp/termscp</span></pre>
</div>
</section>
<section>
<h2>
<i class="devicon-rust-plain"></i>&nbsp;<span
translate="getStarted.cargo.title"
>Install with Cargo</span
>
<section class="w-full">
<h2 class="text-2xl font-thin">
<i class="devicon-rust-plain"></i>&nbsp;<span translate="getStarted.cargo.title">Install with Cargo</span>
</h2>
<div class="installation">
<div class="alert alert-warning">
<p>
<div class="p-4 my-4 text-sm text-yellow-800 rounded-lg bg-yellow-50">
<p class="text-lg">
<i class="fas fa-exclamation-triangle"></i>
<span translate="getStarted.noBinary"
>Opt for this method instead if binaries for your platform are not
available</span
>
<span translate="getStarted.noBinary">Opt for this method instead if binaries for your platform are not
available</span>
</p>
</div>
<p>
<span translate="getStarted.cargo.body"
>If a package is not available for your system, you can opt to
install termscp via</span
>&nbsp;
<a href="https://www.rust-lang.org/tools/install" target="_blank"
>Cargo</a
>.
<span translate="getStarted.cargo.requirements"
>To install termscp via Cargo, these requirements must be
satisfied:</span
>
<span translate="getStarted.cargo.body">If a package is not available for your system, you can opt to
install termscp via</span>&nbsp;
<a href="https://www.rust-lang.org/tools/install" target="_blank">Cargo</a>.
<span translate="getStarted.cargo.requirements">To install termscp via Cargo, these requirements must be
satisfied:</span>
</p>
<ul>
<ul class="list-disc px-8">
<li>
Linux:
<ul>
<ul class="list-disc px-12">
<li>pkg-config</li>
<li>libssh2</li>
<li>openssl-dev</li>
<li>libdbus-1</li>
<li>libsmbclient</li>
</ul>
</li>
<li>
FreeBSD:
<ul>
<li>libssh</li>
<ul class="list-disc px-12">
<li>dbus</li>
<li>pkg-conf</li>
<li>gcc</li>
@@ -204,12 +160,14 @@ sudo <span class="function">rpm</span> -U <span class="string">termscp.rpm</span
</ul>
<p translate="getStarted.cargo.install">Then you can install it via</p>
<pre><span class="function">cargo</span> install --locked <span class="string">termscp</span></pre>
<p translate="getStarted.cargo.noKeyring">
<p translate="getStarted.cargo.noKeyring" class="pt-4 pb-2">
Or if you don't want to have support for keyring or you're building on
*BSD:
</p>
<pre><span class="function">cargo</span> install --locked --no-default-features <span class="string">termscp</span></pre>
<pre><span class="function">cargo</span> install --locked --no-default-features --features smb <span class="string">termscp</span></pre>
<p translate="getStarted.cargo.noSMB" class="pt-4 pb-2"></p>
<pre><span class="function">cargo</span> install --locked --no-default-features --features with-keyring <span class="string">termscp</span></pre>
</div>
</section>
</section>
</body>
</body>

86
site/html/home.html Normal file
View File

@@ -0,0 +1,86 @@
<!DOCTYPE html>
<section id="intro"
class="flex flex-col mx-auto items-center justify-center w-full px-4 dark:bg-brand dark:text-gray-100">
<h1 class="text-3xl text-center font-thin">termscp</h1>
<img class="w-[256px] h-auto m-auto" alt="logo" src="assets/images/termscp.webp" />
<h2 class="text-xl font-thin text-center py-6" translate="intro.caption">
A feature rich terminal UI file transfer and explorer with support for
SCP/SFTP/FTP/S3/SMB/WebDAV
</h2>
<button class="bg-brand hover:bg-gray-800 text-white font-thin text-xl py-2 px-4 rounded-xl max-w-fit">
<a href="/get-started.html" class="no-underline" translate="intro.getStarted">Get started →</a>
</button>
<div class="p-4 my-4 text-sm text-green-800 rounded-lg bg-green-50">
<p class="text-lg">
<span translate="intro.versionAlert">termscp 0.13.0 is NOW out! Download it from</span>&nbsp;
<a href="/get-started.html" translate="intro.here">here!</a>
</p>
</div>
<div class="grid grid-cols-3 sm:grid-cols-1 gap-8 py-8 w-4/6 sm:w-full">
<div class="feature">
<h3 translate="intro.features.handy.title" class="text-center text-lg">Handy UI</h3>
<p translate="intro.features.handy.body" class="text-center">
Explore and operate on the remote and on the local machine file system
with a handy UI.
</p>
</div>
<div class="feature">
<h3 translate="intro.features.crossPlatform.title" class="text-center text-lg">Cross platform</h3>
<p translate="intro.features.crossPlatform.body" class="text-center">
Runs on Windows, MacOS, Linux and BSD
</p>
</div>
<div class="feature">
<h3 translate="intro.features.customizable.title" class="text-center text-lg">Customizable</h3>
<p translate="intro.features.customizable.body" class="text-center">
Customize the file explorer, the text editor to use and default
options
</p>
</div>
<div class="feature">
<h3 translate="intro.features.bookmarks.title" class="text-center text-lg">Bookmarks</h3>
<p translate="intro.features.bookmarks.body" class="text-center">
Connect to your favourite hosts through built-in bookmarks and recent
connections support
</p>
</div>
<div class="feature">
<h3 translate="intro.features.security.title" class="text-center text-lg">Security first</h3>
<p translate="intro.features.security.body" class="text-center">
Save your password into your operating system key vault
</p>
</div>
<div class="feature">
<h3 translate="intro.features.performance.title" class="text-center text-lg">Eye on performance</h3>
<p translate="intro.features.performance.body" class="text-center">
termscp has been developed keeping an eye on performance to prevent
cpu usage
</p>
</div>
</div>
<div class="w-4/6 sm:w-5/6">
<video autoplay muted loop>
<source src="assets/videos/explorer.mp4" type="video/mp4" resolve-video-fallback="assets/images/explorer.gif" />
</video>
</div>
<hr class="h-px my-8 bg-gray-800 border-0" />
<div class="flex flex-row sm:flex-col justify-around gap-12">
<div class="hook">
<h3 class="text-center text-gray-500 dark:text-gray-100 font-light text-xl">
<a href="/get-started.html" class="no-underline hover:underline" translate="intro.footer.getStarted">Get
started</a>
</h3>
</div>
<div class="hook">
<h3 class="text-center text-gray-500 dark:text-gray-100 font-light text-xl">
<a href="/user-manual.html" class="no-underline hover:underline" translate="intro.footer.manual">User manual</a>
</h3>
</div>
<div class="hook">
<h3 class="text-center text-gray-500 dark:text-gray-100 font-light text-xl">
<a href="/updates.html" class="no-underline hover:underline" translate="intro.footer.updates">Install
updates</a>
</h3>
</div>
</div>
</section>

View File

@@ -1,96 +0,0 @@
<head>
<link rel="stylesheet" href="css/intro.css" />
</head>
<body>
<section id="intro" class="container intro">
<h1 class="title">termscp</h1>
<img class="logo" alt="logo" src="assets/images/termscp.webp" />
<h2 class="caption" translate="intro.caption">
A feature rich terminal UI file transfer and explorer with support for
SCP/SFTP/FTP/S3
</h2>
<button class="pure-button get-started">
<a href="#get-started" translate="intro.getStarted">Get started →</a>
</button>
<div class="alert alert-center alert-success">
<p>
<span translate="intro.versionAlert"
>termscp 0.11.1 is NOW out! Download it from</span
>&nbsp;
<a href="#get-started" translate="intro.here">here!</a>
</p>
</div>
<div class="features">
<div class="feature">
<h3 translate="intro.features.handy.title">Handy UI</h3>
<p translate="intro.features.handy.body">
Explore and operate on the remote and on the local machine file system
with a handy UI.
</p>
</div>
<div class="feature">
<h3 translate="intro.features.crossPlatform.title">Cross platform</h3>
<p translate="intro.features.crossPlatform.body">
Runs on Windows, MacOS, Linux and BSD
</p>
</div>
<div class="feature">
<h3 translate="intro.features.customizable.title">Customizable</h3>
<p translate="intro.features.customizable.body">
Customize the file explorer, the text editor to use and default
options
</p>
</div>
<div class="feature">
<h3 translate="intro.features.bookmarks.title">Bookmarks</h3>
<p translate="intro.features.bookmarks.body">
Connect to your favourite hosts through built-in bookmarks and recent
connections support
</p>
</div>
<div class="feature">
<h3 translate="intro.features.security.title">Security first</h3>
<p translate="intro.features.security.body">
Save your password into your operating system key vault
</p>
</div>
<div class="feature">
<h3 translate="intro.features.performance.title">Eye on performance</h3>
<p translate="intro.features.performance.body">
termscp has been developed keeping an eye on performance to prevent
cpu usage
</p>
</div>
</div>
<div class="preview">
<video autoplay muted loop>
<source
src="assets/videos/explorer.mp4"
type="video/mp4"
resolve-video-fallback="assets/images/explorer.gif"
/>
</video>
</div>
<div class="discover">
<div class="hook">
<h3>
<a href="#get-started" translate="intro.footer.getStarted"
>Get started</a
>
</h3>
</div>
<div class="hook">
<h3>
<a href="#user-manual" translate="intro.footer.manual">User manual</a>
</h3>
</div>
<div class="hook">
<h3>
<a href="#updates" translate="intro.footer.updates"
>Install updates</a
>
</h3>
</div>
</div>
</section>
</body>

View File

@@ -2,29 +2,20 @@
<link rel="stylesheet" href="css/updates.css" />
</head>
<body>
<section id="updates" class="container updates">
<h1 translate="updates.title">Keeping termscp up to date</h1>
<div class="alert alert-warning">
<p>
<i class="fas fa-exclamation-triangle"></i>
<span translate="updates.disclaimer">
Updating termscp with this method is only available for 0.7.x versions
or higher. If you have an older version, you have to install updates
using the</span>&nbsp;<a href="#get-started">install.sh script</a>
</p>
</div>
<section id="updates" class="flex flex-col mx-auto items-center justify-center w-full px-12 gap-8 dark:text-gray-100">
<h1 translate="updates.title" class="text-3xl font-thin">Keeping termscp up to date</h1>
<!-- Reasons -->
<section>
<h2>
<h2 class="text-2xl font-thin">
<i class="fa fa-question-circle"></i>&nbsp;<span translate="updates.reasons.title">Why should you install
updates</span>
</h2>
<div class="wall-of-text">
<p translate="updates.reasons.wallOfText">
<p translate="updates.reasons.wallOfText" class="text-gray-700 dark:text-gray-300">
Termscp is an application that is still in its early stage of
development, the first version has been released in december in 2020
and practically there's only one
<a href="https://veeso.github.io/" target="_blank">guy</a> working on
<a href="https://termscp.veeso.dev/" target="_blank">guy</a> working on
it and there's still a lot of work to do in order to improve it and
make it fast and reliable. Along to this, you should also consider
that since it's an application which works with network protocols and
@@ -42,7 +33,7 @@
awesome features 🦄 you can't miss and the application is getting more
reliable and stable after each update 😄
</p>
<p class="tl-dr">
<p class="italic text-xl text-gray-700 dark:text-gray-300">
<span>TL;DR</span>
<span translate="updates.reasons.tldr"></span>
</p>
@@ -50,26 +41,26 @@
</section>
<!-- Gui method -->
<section>
<h2><i class="fa fa-desktop"></i>&nbsp;<span translate="updates.gui.title">GUI method</span></h2>
<h2 class="text-2xl font-thin"><i class="fa fa-desktop"></i>&nbsp;<span translate="updates.gui.title">GUI method</span></h2>
<div class="installation">
<p translate="updates.gui.body" class="description">
<p translate="updates.gui.body" class="text-gray-700 dark:text-gray-300">
The GUI method just consists in starting termscp with no options, you
then should be in front of the authentication form. If there's an
update available a message like "termscp x.y.z is OUT! Update and read
release notes with CTRL+R". All you have to do at this point to update
termscp, is:
</p>
<ol>
<ol class="list-decimal px-8 text-gray-700 dark:text-gray-300">
<li translate="updates.gui.steps.st">press CTRL+R. The release notes should now be displayed.</li>
<li translate="updates.gui.steps.nd">Select "YES" in the "Install update?" radio input</li>
<li translate="updates.gui.steps.rd">Press "ENTER"</li>
</ol>
<p translate="updates.gui.then" class="description">
<p translate="updates.gui.then" class="text-gray-700 dark:text-gray-300">
If everything worked correctly a green message "termscp x.y.z has been
installed!" will be displayed. Just restart termscp and enjoy the
update 😄
</p>
<div class="alert alert-warning">
<div class="p-4 my-4 text-sm text-yellow-800 rounded-lg bg-yellow-50">
<p>
<i class="fas fa-exclamation-triangle"></i>
<span translate="updates.gui.pex">
@@ -82,20 +73,20 @@
</section>
<!-- CLI method -->
<section>
<h2><i class="fa fa-glasses"></i>&nbsp;<span translate="updates.cli.title">CLI method</span></h2>
<h2 class="text-2xl font-thin"><i class="fa fa-glasses"></i>&nbsp;<span translate="updates.cli.title">CLI method</span></h2>
<div class="installation">
<p translate="updates.cli.body" class="description">
<p translate="updates.cli.body" class="text-gray-700 dark:text-gray-300">
If you prefer, you can install a new update just using the dedicated
CLI option:
</p>
<pre><span class="function">termscp</span> --update</pre>
<div class="alert alert-warning">
<div class="p-4 my-4 text-sm text-yellow-800 rounded-lg bg-yellow-50">
<p>
<i class="fas fa-exclamation-triangle"></i>
<span translate="updates.cli.pex">Run with sudo if necessary (Debian/FreeBSD/RedHat users)</span>
</p>
</div>
<p translate="updates.cli.then" class="description">
<p translate="updates.cli.then" class="text-gray-700 dark:text-gray-300">
Once started, you will be prompted whether to install or not the
update. Confirm the installation and ta-dah, the new version of
termscp should now be available on your machine

View File

@@ -1,221 +1,76 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width"
/>
<meta
property="og:image"
content="https://termscp.veeso.dev/assets/images/og_preview.jpg"
/>
<meta property="og:image:type" content="image/jpg" />
<meta property="og:image:width" content="1024" />
<meta property="og:image:height" content="820" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://termscp.veeso.dev" />
<meta property="og:title" content="termscp" />
<meta property="og:description" content="terminal UI file transfer" />
<!-- Pure.css -->
<link
rel="stylesheet"
href="https://unpkg.com/purecss@2.0.5/build/pure-min.css"
/>
<!-- Icons -->
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.11.0/devicon.min.css"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous"
/>
<link
rel="stylesheet"
href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/fontawesome.min.css"
integrity="sha512-OdEXQYCOldjqUEsuMKsZRj93Ht23QRlhIb8E/X0sbwZhme8eUw6g8q7AdxGJKakcBbv7+/PX0Gc2btf7Ru8cZA=="
crossorigin="anonymous"
/>
<!-- Main -->
<link rel="stylesheet" href="css/markdown.css" />
<link rel="stylesheet" href="css/menu.css" />
<link rel="stylesheet" href="css/main.css" />
<!-- Favicons -->
<link
rel="icon"
type="image/png"
sizes="96x96"
href="assets/images/favicon-96x96.png"
/>
<link
rel="icon"
type="image/png"
sizes="32x32"
href="assets/images/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="assets/images/favicon-16x16.png"
/>
<title>termscp: terminal UI file transfer</title>
</head>
<body>
<div id="layout">
<!-- Menu toggle -->
<a href="#menu" id="menu-burger" class="menu-link">
<!-- Hamburger icon -->
<span></span>
</a>
<!-- Menu -->
<header id="menu">
<div class="pure-menu">
<div class="pure-menu-heading">
<div class="pic-box">
<img class="avatar" alt="logo" src="assets/images/termscp.webp" />
</div>
<h1>termscp</h1>
<p translate="menu.desc">A feature rich terminal UI file transfer</p>
<a href="https://github.com/veeso/termscp/stargazers/">
<img
src="https://img.shields.io/github/stars/veeso/termscp.svg?style=social&label=Star&maxAge=2592000"
/>
</a>
</div>
<ul class="pure-menu-list">
<li class="pure-menu-item pure-menu-selected">
<a href="#intro" class="pure-menu-link" translate="menu.intro">Intro</a>
</li>
<li class="pure-menu-item">
<a href="#get-started" class="pure-menu-link" translate="menu.getStarted">Get started</a>
</li>
<li class="pure-menu-item">
<a href="#updates" class="pure-menu-link" translate="menu.updates">Install updates</a>
</li>
<li class="pure-menu-item">
<a href="#user-manual" class="pure-menu-link" translate="menu.manual">User manual</a>
</li>
<li class="pure-menu-item">
<a href="#changelog" class="pure-menu-link" translate="menu.changelog">Release history</a>
</li>
<li class="pure-menu-item">
<a
href="https://github.com/veeso/termscp"
class="pure-menu-link"
target="_blank"
>Github&nbsp;<i class="fas fa-external-link-alt"></i
></a>
</li>
<li class="pure-menu-item">
<a
href="https://veeso.dev/"
class="pure-menu-link"
target="_blank"
><span translate="menu.author">About the author</span>&nbsp;<i class="fas fa-external-link-alt"></i
></a>
</li>
<li class="pure-menu-item">
<a
href="https://ko-fi.com/veeso"
class="pure-menu-link"
target="_blank"
><span translate="menu.support">Support me</span>&nbsp;<i class="fas fa-external-link-alt"></i
></a>
</li>
</ul>
<div class="pure-menu-bottom">
<ul>
<li>
<a href="https://github.com/veeso/termscp" target="_blank"
><i class="devicon-github-original"></i
></a>
</li>
<li>
<a href="https://crates.io/crates/termscp" target="_blank"
><i class="devicon-rust-plain"></i
></a>
</li>
<li>
<a
href="https://community.chocolatey.org/packages/termscp"
target="_blank"
><i class="devicon-windows8-plain"></i
></a>
</li>
<li>
<a href="https://ko-fi.com/veeso" target="_blank"
><i class="fa fa-coffee"></i
></a>
</li>
</ul>
</div>
</div>
</header>
<main>
<div id="main"></div>
</main>
<footer>
<div class="container">
<ul class="contacts">
<li>
<a href="https://github.com/veeso/termscp" target="_blank"
><i class="devicon-github-original"></i
></a>
</li>
<li>
<a href="https://crates.io/crates/termscp" target="_blank"
><i class="devicon-rust-plain"></i
></a>
</li>
<li>
<a
href="https://community.chocolatey.org/packages/termscp"
target="_blank"
><i class="devicon-windows8-plain"></i
></a>
</li>
<li>
<a href="https://ko-fi.com/veeso" target="_blank"
><i class="fa fa-coffee"></i
></a>
</li>
</ul>
<!-- Copyright -->
<p class="copyright">
<span>Christian Visintin © All Rights Reserved | </span
><span resolve-copyright></span>
</p>
</div>
</footer>
</div>
<!-- Scripts -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Showdown JS-->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"
integrity="sha512-L03kznCrNOfVxOUovR6ESfCz9Gfny7gihUX/huVbQB9zjODtYpxaVtIaAkpetoiyV2eqWbvxMH9fiSv5enX7bw=="
crossorigin="anonymous"
referrerpolicy="no-referrer"
></script>
<!-- Local -->
<script src="js/lang.min.js"></script>
<script src="js/core.js"></script>
<script src="js/events.js"></script>
<script src="js/resolvers.js"></script>
<!-- ko-fi -->
<script src='https://storage.ko-fi.com/cdn/scripts/overlay-widget.js'></script>
<script>
kofiWidgetOverlay.draw('veeso', {
'type': 'floating-chat',
'floating-chat.donateButton.text': 'Support me',
'floating-chat.donateButton.background-color': '#323842',
'floating-chat.donateButton.text-color': '#fff'
});
</script>
</body>
</html>
<html lang="en_US" class="dark">
<head>
<title>
termscp is a terminal file transfer and explorer for SCP/SFTP/FTP/S3/SMB/WebDAV | termscp
</title>
<meta property="og:description"
content="a WinSCP alternative for Linux and MacOS with support for SCP/SFTP/FTP/S3/SMB/WebDAV. Command line file transfer with user interface compatible with all the operating systems." />
<meta name="description"
content="a WinSCP alternative for Linux and MacOS with support for SCP/SFTP/FTP/S3/SMB/WebDAV. Command line file transfer with user interface compatible with all the operating systems." />
<meta property="og:title"
content="termscp is a terminal file transfer and explorer for SCP/SFTP/FTP/S3/SMB/WebDAV | termscp" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="index, follow" />
<meta property="og:image" content="https://termscp.veeso.dev/assets/images/og_preview.jpg" />
<meta property="og:image:type" content="image/jpg" />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="640" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="termscp" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="https://termscp.veeso.dev" />
<!-- Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.11.0/devicon.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/fontawesome.min.css"
integrity="sha512-OdEXQYCOldjqUEsuMKsZRj93Ht23QRlhIb8E/X0sbwZhme8eUw6g8q7AdxGJKakcBbv7+/PX0Gc2btf7Ru8cZA=="
crossorigin="anonymous" />
<!-- tailwind -->
<link href="output.css" rel="stylesheet" />
<!-- Favicons -->
<link rel="icon" type="image/png" sizes="96x96" href="assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png" />
</head>
<body>
<div id="layout" class="dark:bg-brand dark:text-gray-100">
<!-- Menu -->
<header id="menu"></header>
<main>
<div id="main" class="w-8/12 sm:w-full mx-auto pt-4 pb-8"></div>
</main>
<footer id="footer"></footer>
</div>
<!-- Scripts -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Showdown JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"
integrity="sha512-L03kznCrNOfVxOUovR6ESfCz9Gfny7gihUX/huVbQB9zjODtYpxaVtIaAkpetoiyV2eqWbvxMH9fiSv5enX7bw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Local -->
<script src="js/lang.min.js"></script>
<script src="js/core.js"></script>
<script src="js/events.js"></script>
<script src="js/resolvers.js"></script>
<!-- ko-fi -->
<script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script>
<script>
kofiWidgetOverlay.draw("veeso", {
type: "floating-chat",
"floating-chat.donateButton.text": "Support me",
"floating-chat.donateButton.background-color": "#31363b",
"floating-chat.donateButton.text-color": "#fff",
});
</script>
</body>
</html>

132
site/input.css Normal file
View File

@@ -0,0 +1,132 @@
@import "css/markdown.css";
@tailwind base;
@tailwind components;
@tailwind utilities;
@font-face {
font-family: "Sora";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(https://fonts.gstatic.com/s/sora/v11/xMQ9uFFYT72X5wkB_18qmnndmSdSnx2BAfO5mnuyOo1l_iMwWa-xsaQ.woff2)
format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: "Sora";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url(https://fonts.gstatic.com/s/sora/v11/xMQ9uFFYT72X5wkB_18qmnndmSdSnx2BAfO5mnuyOo1l_iMwV6-x.woff2)
format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
/* latin-ext */
@font-face {
font-family: "Sora";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://fonts.gstatic.com/s/sora/v11/xMQ9uFFYT72X5wkB_18qmnndmSdSnx2BAfO5mnuyOo1l_iMwWa-xsaQ.woff2)
format("woff2");
unicode-range: U+0100-024F, U+0259, U+1E00-1EFF, U+2020, U+20A0-20AB,
U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
@font-face {
font-family: "Sora";
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(https://fonts.gstatic.com/s/sora/v11/xMQ9uFFYT72X5wkB_18qmnndmSdSnx2BAfO5mnuyOo1l_iMwV6-x.woff2)
format("woff2");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
U+FEFF, U+FFFD;
}
html {
scroll-behavior: smooth;
}
body {
font-family: "Sora", sans-serif;
margin: 0;
min-width: 100vw;
overflow-x: hidden;
padding: 0;
}
main {
padding-top: 5rem;
}
p {
font-weight: 300;
}
input {
font-family: "Sora", sans-serif;
font-size: 1em;
}
textarea {
font-family: "Sora", sans-serif;
}
h1,
h2,
h3,
h4,
h5,
h6 {
margin-top: 0;
margin-bottom: 0.5rem;
}
button {
box-sizing: border-box;
cursor: pointer;
}
button,
input {
margin: 0;
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
a {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
pre {
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
padding: 16px;
overflow: auto;
font-size: 85%;
line-height: 1.45;
color: #d0d0d0;
background-color: #222629;
border-radius: 3px;
word-wrap: normal;
border-radius: 0.5em;
}
pre .function {
color: #f08d49;
}
pre .string {
color: #7ec699;
}

View File

@@ -33,3 +33,99 @@ function languageSupported(lang) {
function setSiteLanguage(lang) {
setLanguage(lang);
}
const converter = new showdown.Converter({ tables: true });
/**
* @description load page associated to hash
* @param {string} hash
*/
function loadPage(path) {
switch (path) {
case "/":
case "/index.html":
loadHtml("home.html");
break;
case "/get-started.html":
loadHtml("get-started.html");
break;
case "/user-manual.html":
loadUserManual();
break;
case "/updates.html":
loadHtml("updates.html");
break;
case "/changelog.html":
loadMarkdown(
"https://raw.githubusercontent.com/veeso/termscp/main/CHANGELOG.md"
);
break;
}
}
function loadHtml(page) {
const url = "html/" + page;
$("#main").load(url, function () {
onPageLoaded();
});
}
function loadMenu() {
$("#menu").load("html/components/menu.html", function () {
onPageLoaded();
});
}
function loadFooter() {
$("#footer").load("html/components/footer.html", function () {
onPageLoaded();
});
}
function loadMarkdown(page) {
getMarkdown(page, function (md) {
const div = jQuery("<div/>", {
id: page,
class: "container markdown",
});
div.html(converter.makeHtml(md));
$("#main").empty();
$("#main").append(div);
onPageLoaded();
});
}
/**
* @description get markdown and pass result to onLoaded
* @param {string} url
* @param {function} onLoaded
*/
function getMarkdown(url, onLoaded) {
$.ajax({
url,
type: "GET",
dataType: "text",
success: onLoaded,
});
}
function loadUserManual() {
// Load language
const lang = getNavigatorLanguage();
if (lang === "en") {
loadMarkdown(
`https://raw.githubusercontent.com/veeso/termscp/main/docs/man.md`
);
} else {
loadMarkdown(
`https://raw.githubusercontent.com/veeso/termscp/main/docs/${lang}/man.md`
);
}
}
// startup
$(function () {
loadPage(window.location.pathname);
loadMenu();
loadFooter();
});

View File

@@ -1,133 +1,81 @@
const hashBlacklist = ["#menu"];
const converter = new showdown.Converter({ tables: true });
/**
* @description handle hash change
*/
function onHashChange() {
const hash = location.hash;
if (!hashBlacklist.includes(hash) && hash.length > 0) {
selectMenuEntry(location.hash);
loadPage(hash);
} else if (hash.length === 0 || hash === "#") {
loadPage("#intro");
}
}
/**
* @description select menu entry
* @param {*} hash
*/
function selectMenuEntry(hash) {
// Remove current entry
$(".pure-menu-selected").removeClass("pure-menu-selected");
$('a[href$="' + hash + '"]')
.parent()
.addClass("pure-menu-selected");
}
/**
* @description load page associated to hash
* @param {string} hash
*/
function loadPage(hash) {
switch (hash) {
case "#intro":
loadHtml("intro.html");
break;
case "#get-started":
loadHtml("get-started.html");
break;
case "#user-manual":
loadUserManual();
break;
case "#updates":
loadHtml("updates.html");
break;
case "#changelog":
loadMarkdown(
"https://raw.githubusercontent.com/veeso/termscp/main/CHANGELOG.md"
);
break;
}
window.scrollTo(0, 0);
}
function loadHtml(page) {
const url = "html/" + page;
$("#main").load(url, function () {
onPageLoaded();
});
}
function loadMarkdown(page) {
getMarkdown(page, function (md) {
const div = jQuery("<div/>", {
id: page,
class: "container markdown",
});
div.html(converter.makeHtml(md));
$("#main").empty();
$("#main").append(div);
onPageLoaded();
});
}
/**
* @description get markdown and pass result to onLoaded
* @param {string} url
* @param {function} onLoaded
*/
function getMarkdown(url, onLoaded) {
$.ajax({
url,
type: "GET",
dataType: "text",
success: onLoaded,
});
}
function onMenuBurgerClick() {
const active = $("#menu").hasClass("active");
if (active) {
$("#layout").removeClass("active");
$("#menu").removeClass("active");
} else {
$("#layout").addClass("active");
$("#menu").addClass("active");
}
}
function loadUserManual() {
// Load language
const lang = getNavigatorLanguage();
if (lang === "en") {
loadMarkdown(
`https://raw.githubusercontent.com/veeso/termscp/main/docs/man.md`
);
} else {
loadMarkdown(
`https://raw.githubusercontent.com/veeso/termscp/main/docs/${lang}/man.md`
);
}
}
function onPageLoaded() {
reloadTranslations();
setThemeToggle();
setTheme(getTheme());
}
// Register
window.onhashchange = onHashChange;
function onToggleMenu() {
const mobileMenu = $("#mobile-menu");
let wasVisible = false;
// if not visible set flex and slide in, otherwise slide out
if (!mobileMenu.is(":visible")) {
mobileMenu.css("display", "flex");
mobileMenu.addClass("animate__animated animate__slideInLeft");
} else {
mobileMenu.addClass("animate__animated animate__slideOutLeft");
wasVisible = true;
}
// on animation end remove animation, if visible set hidden
mobileMenu.on("animationend", () => {
mobileMenu.removeClass(
"animate__animated animate__slideOutLeft animate__slideInLeft"
);
if (wasVisible) {
mobileMenu.css("display", "none");
}
mobileMenu.off("animationend");
});
}
function getTheme() {
const theme = localStorage.getItem("theme");
if (!theme) {
return window.matchMedia("(prefers-color-scheme: dark)").matches
? "theme-dark"
: "theme-light";
}
return theme;
}
function setThemeToggle() {
if (getTheme() === "theme-dark") {
$("#theme-toggle-dark-icon").css("display", "block");
$("#theme-toggle-light-icon").css("display", "none");
} else {
$("#theme-toggle-dark-icon").css("display", "none");
$("#theme-toggle-light-icon").css("display", "block");
}
}
// function to set a given theme/color-scheme
function setTheme(themeName) {
localStorage.setItem("theme", themeName);
if (themeName === "theme-dark") {
document.documentElement.classList.add("dark");
} else {
document.documentElement.classList.remove("dark");
}
setThemeToggle();
}
// function to toggle between light and dark theme
function toggleTheme() {
console.log("theme", getTheme());
if (getTheme() === "theme-dark") {
setTheme("theme-light");
} else {
setTheme("theme-dark");
}
}
// Startup
$(function () {
onHashChange();
// Init language
setSiteLanguage(getNavigatorLanguage());
// Burger event listener
$("#menu-burger").on("click", onMenuBurgerClick);
$(".pure-menu-heading").on("click", function () {
location.hash = "#";
onHashChange();
});
// init theme
setTheme(getTheme());
});

View File

@@ -12,7 +12,7 @@
"intro": {
"caption": "A feature rich terminal UI file transfer and explorer with support for SCP/SFTP/FTP/S3",
"getStarted": "Get started →",
"versionAlert": "termscp 0.11.1 is NOW out! Download it from",
"versionAlert": "termscp 0.13.0 is NOW out! Download it from",
"here": "here",
"features": {
"handy": {
@@ -59,7 +59,7 @@
},
"linuxUsers": "Linux users",
"notConfident": "Opt for these methods instead if you don't feel confident using the shell script",
"noBinary": "Opt for this method instead if binaries for your platform are not available",
"noBinary": "Opt for this method instead if binaries for your platform are not available or you want to select features",
"arch": {
"title": "Arch derived users",
"intro": "On Arch Linux based distros, you can install termscp using an AUR package manager such as",
@@ -82,7 +82,8 @@
"body": "If a package is not available for your system, you can opt to install termscp via",
"requirements": "To install termscp via Cargo, these requirements must be satisfied",
"install": "Then you can install termscp via",
"noKeyring": "Or if you don't want to have support for keyring or you're building on *BSD:"
"noKeyring": "Or if you don't want to have support for keyring or you're building on *BSD:",
"noSMB": "Or if you want to disable SMB:"
}
},
"updates": {

View File

@@ -12,7 +12,7 @@
"intro": {
"caption": "Un explorador y transferencia de archivos de terminal rico en funciones, con apoyo para SCP/SFTP/FTP/S3",
"getStarted": "Para iniciar →",
"versionAlert": "termscp 0.11.1 ya está disponible! Descárgalo desde",
"versionAlert": "termscp 0.13.0 ya está disponible! Descárgalo desde",
"here": "aquì",
"features": {
"handy": {
@@ -82,7 +82,8 @@
"body": "Si un paquete no está disponible para su sistema, puede optar por instalar termscp a través de",
"requirements": "Para instalar termscp a través de Cargo, se deben cumplir estos requisitos",
"install": "Entonces puedes instalar termscp a través de",
"noKeyring": "O si no desea tener soporte para llavero o está construyendo sobre *BSD:"
"noKeyring": "O si no desea tener soporte para llavero o está construyendo sobre *BSD:",
"noSMB": "O si no desea tener soporte para SMB:"
}
},
"updates": {

View File

@@ -12,7 +12,7 @@
"intro": {
"caption": "Un file transfer et navigateur de terminal riche en fonctionnalités avec support pour SCP/SFTP/FTP/S3",
"getStarted": "Pour commencer →",
"versionAlert": "termscp 0.11.1 est maintenant sorti! Télécharge-le depuis",
"versionAlert": "termscp 0.13.0 est maintenant sorti! Télécharge-le depuis",
"here": "ici",
"features": {
"handy": {
@@ -82,7 +82,8 @@
"body": "Si un package n'est pas disponible pour votre système, vous pouvez choisir d'installer Termscp via",
"requirements": "Pour installer termscp via Cargo, ces conditions doivent être remplies",
"install": "Ensuite, vous pouvez installer termscp via",
"noKeyring": "Ou si vous ne voulez pas avoir de support pour le trousseau de clés ou si vous construisez sur *BSD :"
"noKeyring": "Ou si vous ne voulez pas avoir de support pour le trousseau de clés ou si vous construisez sur *BSD :",
"noSMB": "Ou si vous ne voulez pas avoir de support pour SMB:"
}
},
"updates": {

View File

@@ -12,7 +12,7 @@
"intro": {
"caption": "Un file transfer ed explorer ricco di funzionalità con supporto per SFTP/SCP/FTP/S3",
"getStarted": "Installa termscp →",
"versionAlert": "termscp 0.11.1 è ORA disponbile! Scaricalo da",
"versionAlert": "termscp 0.13.0 è ORA disponbile! Scaricalo da",
"here": "qui",
"features": {
"handy": {
@@ -82,7 +82,8 @@
"body": "Se un pacchetto non è disponibile per il tuo sistema, puoi installare termscp con cargo con",
"requirements": "Per installare con Cargo, questi requisiti di sistema devono essere soddisfatti",
"install": "Infine puoi installare termscp con",
"noKeyring": "O se non hai il supporto a DBUS o sei un utente *BSD:"
"noKeyring": "O se non hai il supporto a DBUS o sei un utente *BSD:",
"noSMB": "O se vuoi disabilitare il supporto per SMB:"
}
},
"updates": {

View File

@@ -12,7 +12,7 @@
"intro": {
"caption": "功能丰富的终端 UI 文件传输和浏览器,支持 SCP/SFTP/FTP/S3",
"getStarted": "开始 →",
"versionAlert": "termscp 0.11.1 现已发布! 从下载",
"versionAlert": "termscp 0.13.0 现已发布! 从下载",
"here": "这里",
"features": {
"handy": {
@@ -82,7 +82,8 @@
"body": "如果您的系统没有可用的软件包,您可以选择通过以下方式安装 termscp",
"requirements": "要通过 Cargo 安装termscp必须满足这些要求",
"install": "然后你可以通过安装termscp",
"noKeyring": "或者,如果您不想支持密钥环,或者您正在构建 *BSD"
"noKeyring": "或者,如果您不想支持密钥环,或者您正在构建 *BSD",
"noSMB": "或者如果你想禁用 SMB :"
}
},
"updates": {

3
site/output.css Normal file

File diff suppressed because one or more lines are too long

2
site/robots.txt Normal file
View File

@@ -0,0 +1,2 @@
User-Agent: *
Allow: /

29
site/sitemap.xml Normal file
View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://termscp.veeso.dev/</loc>
<lastmod>2023-07-05</lastmod>
<priority>1.00</priority>
</url>
<url>
<loc>https://termscp.veeso.dev/get-started.html</loc>
<lastmod>2023-07-05</lastmod>
<priority>0.95</priority>
</url>
<url>
<loc>https://termscp.veeso.dev/updates.html</loc>
<lastmod>2023-07-05</lastmod>
<priority>0.80</priority>
</url>
<url>
<loc>https://termscp.veeso.dev/user-manual.html</loc>
<lastmod>2023-07-05</lastmod>
<priority>0.90</priority>
</url>
<url>
<loc>https://termscp.veeso.dev/changelog.html</loc>
<lastmod>2023-07-05</lastmod>
<priority>0.50</priority>
</url>
</urlset>

75
site/updates.html Normal file
View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en_US" class="dark">
<head>
<title>
Install termscp updates | termscp
</title>
<meta property="og:description"
content="How to update termscp. Keep termscp up to date with the built-in command." />
<meta name="description"
content="How to update termscp. Keep termscp up to date with the built-in command." />
<meta property="og:title" content="Install termscp updates | termscp" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="index, follow" />
<meta property="og:image" content="https://termscp.veeso.dev/assets/images/og_preview.jpg" />
<meta property="og:image:type" content="image/jpg" />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="640" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="termscp" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="https://termscp.veeso.dev" />
<!-- Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.11.0/devicon.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/fontawesome.min.css"
integrity="sha512-OdEXQYCOldjqUEsuMKsZRj93Ht23QRlhIb8E/X0sbwZhme8eUw6g8q7AdxGJKakcBbv7+/PX0Gc2btf7Ru8cZA=="
crossorigin="anonymous" />
<!-- tailwind -->
<link href="output.css" rel="stylesheet" />
<!-- Favicons -->
<link rel="icon" type="image/png" sizes="96x96" href="assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png" />
</head>
<body>
<div id="layout" class="dark:bg-brand dark:text-gray-100">
<!-- Menu -->
<header id="menu"></header>
<main>
<div id="main" class="w-8/12 sm:w-full mx-auto pt-4 pb-8"></div>
</main>
<footer id="footer"></footer>
</div>
<!-- Scripts -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Showdown JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"
integrity="sha512-L03kznCrNOfVxOUovR6ESfCz9Gfny7gihUX/huVbQB9zjODtYpxaVtIaAkpetoiyV2eqWbvxMH9fiSv5enX7bw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Local -->
<script src="js/lang.min.js"></script>
<script src="js/core.js"></script>
<script src="js/events.js"></script>
<script src="js/resolvers.js"></script>
<!-- ko-fi -->
<script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script>
<script>
kofiWidgetOverlay.draw("veeso", {
type: "floating-chat",
"floating-chat.donateButton.text": "Support me",
"floating-chat.donateButton.background-color": "#31363b",
"floating-chat.donateButton.text-color": "#fff",
});
</script>
</body>
</html>

75
site/user-manual.html Normal file
View File

@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html lang="en_US" class="dark">
<head>
<title>
termscp user manual | termscp
</title>
<meta property="og:description"
content="How to use termscp. User manual for termscp. How to setup ssh keys in termscp? How to set color themes in termscp?" />
<meta name="description"
content="How to use termscp. User manual for termscp. How to setup ssh keys in termscp? How to set color themes in termscp?" />
<meta property="og:title" content="termscp user manual | termscp" />
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="robots" content="index, follow" />
<meta property="og:image" content="https://termscp.veeso.dev/assets/images/og_preview.jpg" />
<meta property="og:image:type" content="image/jpg" />
<meta property="og:image:width" content="1280" />
<meta property="og:image:height" content="640" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="termscp" />
<meta property="og:locale" content="en_US" />
<meta property="og:url" content="https://termscp.veeso.dev" />
<!-- Icons -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/devicons/devicon@v2.11.0/devicon.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"
integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w=="
crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/fontawesome.min.css"
integrity="sha512-OdEXQYCOldjqUEsuMKsZRj93Ht23QRlhIb8E/X0sbwZhme8eUw6g8q7AdxGJKakcBbv7+/PX0Gc2btf7Ru8cZA=="
crossorigin="anonymous" />
<!-- tailwind -->
<link href="output.css" rel="stylesheet" />
<!-- Favicons -->
<link rel="icon" type="image/png" sizes="96x96" href="assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="32x32" href="assets/images/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="assets/images/favicon-16x16.png" />
</head>
<body>
<div id="layout" class="dark:bg-brand dark:text-gray-100">
<!-- Menu -->
<header id="menu"></header>
<main>
<div id="main" class="w-8/12 sm:w-full mx-auto pt-4 pb-8"></div>
</main>
<footer id="footer"></footer>
</div>
<!-- Scripts -->
<!-- jQuery -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<!-- Showdown JS-->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/1.9.1/showdown.min.js"
integrity="sha512-L03kznCrNOfVxOUovR6ESfCz9Gfny7gihUX/huVbQB9zjODtYpxaVtIaAkpetoiyV2eqWbvxMH9fiSv5enX7bw=="
crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<!-- Local -->
<script src="js/lang.min.js"></script>
<script src="js/core.js"></script>
<script src="js/events.js"></script>
<script src="js/resolvers.js"></script>
<!-- ko-fi -->
<script src="https://storage.ko-fi.com/cdn/scripts/overlay-widget.js"></script>
<script>
kofiWidgetOverlay.draw("veeso", {
type: "floating-chat",
"floating-chat.donateButton.text": "Support me",
"floating-chat.donateButton.background-color": "#31363b",
"floating-chat.donateButton.text-color": "#fff",
});
</script>
</body>
</html>

View File

@@ -3,26 +3,26 @@
//! `activity_manager` is the module which provides run methods and handling for activities
// Deps
use crate::filetransfer::FileTransferParams;
// Namespaces
use std::path::PathBuf;
use std::time::Duration;
use remotefs_ssh::SshKeyStorage as SshKeyStorageTrait;
use crate::filetransfer::{FileTransferParams, FileTransferProtocol};
use crate::host::{HostError, Localhost};
use crate::system::bookmarks_client::BookmarksClient;
use crate::system::config_client::ConfigClient;
use crate::system::environment;
use crate::system::sshkey_storage::SshKeyStorage;
use crate::system::theme_provider::ThemeProvider;
use crate::ui::activities::{
auth::AuthActivity, filetransfer::FileTransferActivity, setup::SetupActivity, Activity,
ExitReason,
};
use crate::ui::activities::auth::AuthActivity;
use crate::ui::activities::filetransfer::FileTransferActivity;
use crate::ui::activities::setup::SetupActivity;
use crate::ui::activities::{Activity, ExitReason};
use crate::ui::context::Context;
use crate::utils::fmt;
use crate::utils::tty;
use crate::utils::{fmt, tty};
// Namespaces
use std::path::{Path, PathBuf};
use std::time::Duration;
/// ### NextActivity
///
/// NextActivity identifies the next identity to run once the current has ended
pub enum NextActivity {
Authentication,
@@ -30,18 +30,15 @@ pub enum NextActivity {
SetupActivity,
}
/// ### ActivityManager
///
/// The activity manager takes care of running activities and handling them until the application has ended
pub struct ActivityManager {
context: Option<Context>,
ticks: Duration,
local_dir: PathBuf,
}
impl ActivityManager {
/// Initializes a new Activity Manager
pub fn new(local_dir: &Path, ticks: Duration) -> Result<ActivityManager, HostError> {
pub fn new(ticks: Duration) -> Result<ActivityManager, HostError> {
// Prepare Context
// Initialize configuration client
let (config_client, error_config): (ConfigClient, Option<String>) =
@@ -61,7 +58,6 @@ impl ActivityManager {
let ctx: Context = Context::new(bookmarks_client, config_client, theme_provider, error);
Ok(ActivityManager {
context: Some(ctx),
local_dir: local_dir.to_path_buf(),
ticks,
})
}
@@ -76,18 +72,37 @@ impl ActivityManager {
if params.password_missing() {
if let Some(password) = password {
params.set_default_secret(password.to_string());
} else {
match tty::read_secret_from_tty("Password: ") {
Err(err) => return Err(format!("Could not read password: {err}")),
Ok(Some(secret)) => {
debug!(
"Read password from tty: {}",
fmt::shadow_password(secret.as_str())
);
params.set_default_secret(secret);
}
Ok(None) => {}
} else if matches!(
params.protocol,
FileTransferProtocol::Scp | FileTransferProtocol::Sftp,
) && params.params.generic_params().is_some()
{
// * if protocol is SCP or SFTP check whether a SSH key is registered for this remote, in case not ask password
let storage = SshKeyStorage::from(self.context.as_ref().unwrap().config());
let generic_params = params.params.generic_params().unwrap();
if storage
.resolve(
&generic_params.address,
&generic_params
.username
.clone()
.unwrap_or(whoami::username()),
)
.is_none()
{
debug!(
"storage could not find any suitable key for {}... prompting for password",
generic_params.address
);
self.prompt_password(&mut params)?;
} else {
debug!(
"a key is already set for {}; password is not required",
generic_params.address
);
}
} else {
self.prompt_password(&mut params)?;
}
}
// Put params into the context
@@ -95,6 +110,22 @@ impl ActivityManager {
Ok(())
}
/// Prompt user for password to set into params.
fn prompt_password(&self, params: &mut FileTransferParams) -> Result<(), String> {
match tty::read_secret_from_tty("Password: ") {
Err(err) => Err(format!("Could not read password: {err}")),
Ok(Some(secret)) => {
debug!(
"Read password from tty: {}",
fmt::shadow_password(secret.as_str())
);
params.set_default_secret(secret);
Ok(())
}
Ok(None) => Ok(()),
}
}
/// Resolve provided bookmark name and set it as file transfer params.
/// Returns error if bookmark is not found
pub fn resolve_bookmark_name(
@@ -210,8 +241,19 @@ impl ActivityManager {
return None;
}
};
// get local path:
// - if set in file transfer params, get it from there
// - otherwise is env current dir
// - otherwise is /
let local_wrkdir = ft_params
.local_path
.clone()
.or(std::env::current_dir().ok())
.unwrap_or(PathBuf::from("/"));
// Prepare activity
let host: Localhost = match Localhost::new(self.local_dir.clone()) {
let host: Localhost = match Localhost::new(local_wrkdir) {
Ok(host) => host,
Err(err) => {
// Set error in context

View File

@@ -2,15 +2,15 @@
//!
//! defines the types for main.rs types
use std::path::PathBuf;
use std::time::Duration;
use argh::FromArgs;
use crate::activity_manager::NextActivity;
use crate::filetransfer::FileTransferParams;
use crate::system::logging::LogLevel;
use std::path::PathBuf;
use std::time::Duration;
pub enum Task {
Activity(NextActivity),
ImportTheme(PathBuf),
@@ -28,40 +28,31 @@ Address syntax can be:
- `protocol://user@address:port:wrkdir` for protocols such as Sftp, Scp, Ftp
- `s3://bucket-name@region:profile:/wrkdir` for Aws S3 protocol
- `\\\\<server>[:port]\\<share>[\\path]` for SMB (on Windows)
- `smb://[user@]<server>[:port]</share>[/path]` for SMB (on other systems)
Please, report issues to <https://github.com/veeso/termscp>
Please, consider supporting the author <https://ko-fi.com/veeso>")]
pub struct Args {
#[argh(
switch,
short = 'b',
description = "resolve address argument as a bookmark name"
)]
#[argh(subcommand)]
pub nested: Option<ArgsSubcommands>,
/// resolve address argument as a bookmark name
#[argh(switch, short = 'b')]
pub address_as_bookmark: bool,
#[argh(switch, short = 'c', description = "open termscp configuration")]
pub config: bool,
#[argh(switch, short = 'D', description = "enable TRACE log level")]
/// enable TRACE log level
#[argh(switch, short = 'D')]
pub debug: bool,
#[argh(option, short = 'P', description = "provide password from CLI")]
/// provide password from CLI
#[argh(option, short = 'P')]
pub password: Option<String>,
#[argh(switch, short = 'q', description = "disable logging")]
/// disable logging
#[argh(switch, short = 'q')]
pub quiet: bool,
#[argh(option, short = 't', description = "import specified theme")]
pub theme: Option<String>,
#[argh(
switch,
short = 'u',
description = "update termscp to the latest version"
)]
pub update: bool,
#[argh(
option,
short = 'T',
default = "10",
description = "set UI ticks; default 10ms"
)]
/// set UI ticks; default 10ms
#[argh(option, short = 'T', default = "10")]
pub ticks: u64,
#[argh(switch, short = 'v', description = "print version")]
/// print version
#[argh(switch, short = 'v')]
pub version: bool,
// -- positional
#[argh(
@@ -71,6 +62,33 @@ pub struct Args {
pub positional: Vec<String>,
}
#[derive(FromArgs)]
#[argh(subcommand)]
pub enum ArgsSubcommands {
Config(ConfigArgs),
LoadTheme(LoadThemeArgs),
Update(UpdateArgs),
}
#[derive(FromArgs)]
/// open termscp configuration
#[argh(subcommand, name = "config")]
pub struct ConfigArgs {}
#[derive(FromArgs)]
/// import the specified theme
#[argh(subcommand, name = "update")]
pub struct UpdateArgs {}
#[derive(FromArgs)]
/// import the specified theme
#[argh(subcommand, name = "theme")]
pub struct LoadThemeArgs {
#[argh(positional)]
/// theme file
pub theme: PathBuf,
}
pub struct RunOpts {
pub remote: Remote,
pub ticks: Duration,
@@ -78,6 +96,29 @@ pub struct RunOpts {
pub task: Task,
}
impl RunOpts {
pub fn config() -> Self {
Self {
task: Task::Activity(NextActivity::SetupActivity),
..Default::default()
}
}
pub fn update() -> Self {
Self {
task: Task::InstallUpdate,
..Default::default()
}
}
pub fn import_theme(theme: PathBuf) -> Self {
Self {
task: Task::ImportTheme(theme),
..Default::default()
}
}
}
impl Default for RunOpts {
fn default() -> Self {
Self {

View File

@@ -2,14 +2,19 @@
//!
//! `bookmarks` is the module which provides data types and de/serializer for bookmarks
use crate::filetransfer::params::{AwsS3Params, GenericProtocolParams, ProtocolParams};
use crate::filetransfer::{FileTransferParams, FileTransferProtocol};
use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize, Serializer};
use std::collections::HashMap;
use std::path::PathBuf;
use std::str::FromStr;
use serde::de::Error as DeError;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use crate::filetransfer::params::{
AwsS3Params, GenericProtocolParams, ProtocolParams, SmbParams as TransferSmbParams,
WebDAVProtocolParams,
};
use crate::filetransfer::{FileTransferParams, FileTransferProtocol};
/// UserHosts contains all the hosts saved by the user in the data storage
/// It contains both `Bookmark`
#[derive(Deserialize, Serialize, Debug, Default)]
@@ -34,10 +39,15 @@ pub struct Bookmark {
pub username: Option<String>,
/// Password is optional; base64, aes-128 encrypted password
pub password: Option<String>,
/// Remote folder to connect to
pub directory: Option<PathBuf>,
/// Remote folder to connect to (serde rename for legacy reasons)
#[serde(rename = "directory")]
pub remote_path: Option<PathBuf>,
/// local folder to open at startup
pub local_path: Option<PathBuf>,
/// S3 params; optional. When used other fields are empty for sure
pub s3: Option<S3Params>,
/// SMB params; optional. Extra params required for SMB protocol
pub smb: Option<SmbParams>,
}
/// Connection parameters for Aws s3 protocol
@@ -53,12 +63,20 @@ pub struct S3Params {
pub new_path_style: Option<bool>,
}
/// Extra Connection parameters for SMB protocol
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
pub struct SmbParams {
pub share: String,
pub workgroup: Option<String>,
}
// -- impls
impl From<FileTransferParams> for Bookmark {
fn from(params: FileTransferParams) -> Self {
let protocol = params.protocol;
let directory = params.entry_directory;
let remote_path = params.remote_path;
let local_path = params.local_path;
// Create generic or others
match params.params {
ProtocolParams::Generic(params) => Self {
@@ -67,8 +85,10 @@ impl From<FileTransferParams> for Bookmark {
port: Some(params.port),
username: params.username,
password: params.password,
directory,
remote_path,
local_path,
s3: None,
smb: None,
},
ProtocolParams::AwsS3(params) => Self {
protocol,
@@ -76,8 +96,35 @@ impl From<FileTransferParams> for Bookmark {
port: None,
username: None,
password: None,
directory,
remote_path,
local_path,
s3: Some(S3Params::from(params)),
smb: None,
},
ProtocolParams::Smb(params) => Self {
smb: Some(SmbParams::from(params.clone())),
protocol,
address: Some(params.address),
#[cfg(unix)]
port: Some(params.port),
#[cfg(windows)]
port: None,
username: params.username,
password: params.password,
remote_path,
local_path,
s3: None,
},
ProtocolParams::WebDAV(parms) => Self {
protocol,
address: Some(parms.uri),
port: None,
username: Some(parms.username),
password: Some(parms.password),
remote_path,
local_path,
s3: None,
smb: None,
},
}
}
@@ -102,8 +149,41 @@ impl From<Bookmark> for FileTransferParams {
.password(bookmark.password);
Self::new(bookmark.protocol, ProtocolParams::Generic(params))
}
#[cfg(unix)]
FileTransferProtocol::Smb => {
let params = TransferSmbParams::new(
bookmark.address.unwrap_or_default(),
bookmark.smb.clone().map(|x| x.share).unwrap_or_default(),
)
.port(bookmark.port.unwrap_or(445))
.username(bookmark.username)
.password(bookmark.password)
.workgroup(bookmark.smb.and_then(|x| x.workgroup));
Self::new(bookmark.protocol, ProtocolParams::Smb(params))
}
#[cfg(windows)]
FileTransferProtocol::Smb => {
let params = TransferSmbParams::new(
bookmark.address.unwrap_or_default(),
bookmark.smb.clone().map(|x| x.share).unwrap_or_default(),
)
.username(bookmark.username)
.password(bookmark.password);
Self::new(bookmark.protocol, ProtocolParams::Smb(params))
}
FileTransferProtocol::WebDAV => Self::new(
FileTransferProtocol::WebDAV,
ProtocolParams::WebDAV(WebDAVProtocolParams {
uri: bookmark.address.unwrap_or_default(),
username: bookmark.username.unwrap_or_default(),
password: bookmark.password.unwrap_or_default(),
}),
),
}
.entry_directory(bookmark.directory) // Set entry directory
.remote_path(bookmark.remote_path) // Set entry remote_path
.local_path(bookmark.local_path) // Set entry local path
}
}
@@ -131,6 +211,26 @@ impl From<S3Params> for AwsS3Params {
}
}
#[cfg(unix)]
impl From<TransferSmbParams> for SmbParams {
fn from(params: TransferSmbParams) -> Self {
Self {
share: params.share,
workgroup: params.workgroup,
}
}
}
#[cfg(windows)]
impl From<TransferSmbParams> for SmbParams {
fn from(params: TransferSmbParams) -> Self {
Self {
share: params.share,
workgroup: None,
}
}
}
fn deserialize_protocol<'de, D>(deserializer: D) -> Result<FileTransferProtocol, D::Error>
where
D: Deserializer<'de>,
@@ -155,9 +255,10 @@ where
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_bookmarks_default() {
let bookmarks: UserHosts = UserHosts::default();
@@ -173,8 +274,10 @@ mod tests {
protocol: FileTransferProtocol::Sftp,
username: Some(String::from("root")),
password: Some(String::from("password")),
directory: Some(PathBuf::from("/tmp")),
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: None,
};
let recent: Bookmark = Bookmark {
address: Some(String::from("192.168.1.2")),
@@ -182,8 +285,10 @@ mod tests {
protocol: FileTransferProtocol::Scp,
username: Some(String::from("admin")),
password: Some(String::from("password")),
directory: Some(PathBuf::from("/home")),
remote_path: Some(PathBuf::from("/home")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: None,
};
let mut bookmarks: HashMap<String, Bookmark> = HashMap::with_capacity(1);
bookmarks.insert(String::from("test"), bookmark);
@@ -198,9 +303,13 @@ mod tests {
assert_eq!(bookmark.username.as_deref().unwrap(), "root");
assert_eq!(bookmark.password.as_deref().unwrap(), "password");
assert_eq!(
bookmark.directory.as_deref().unwrap(),
bookmark.remote_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
assert_eq!(
bookmark.local_path.as_deref().unwrap(),
std::path::Path::new("/usr")
);
let bookmark: &Bookmark = hosts
.recents
.get(&String::from("ISO20201218T181432"))
@@ -211,9 +320,13 @@ mod tests {
assert_eq!(bookmark.username.as_deref().unwrap(), "admin");
assert_eq!(bookmark.password.as_deref().unwrap(), "password");
assert_eq!(
bookmark.directory.as_deref().unwrap(),
bookmark.remote_path.as_deref().unwrap(),
std::path::Path::new("/home")
);
assert_eq!(
bookmark.local_path.as_deref().unwrap(),
std::path::Path::new("/usr")
);
}
#[test]
@@ -225,7 +338,8 @@ mod tests {
password: Some(String::from("omar")),
});
let params: FileTransferParams = FileTransferParams::new(FileTransferProtocol::Scp, params)
.entry_directory(Some(PathBuf::from("/home")));
.remote_path(Some(PathBuf::from("/home")))
.local_path(Some(PathBuf::from("/tmp")));
let bookmark = Bookmark::from(params);
assert_eq!(bookmark.protocol, FileTransferProtocol::Scp);
assert_eq!(bookmark.address.as_deref().unwrap(), "127.0.0.1");
@@ -233,9 +347,13 @@ mod tests {
assert_eq!(bookmark.username.as_deref().unwrap(), "root");
assert_eq!(bookmark.password.as_deref().unwrap(), "omar");
assert_eq!(
bookmark.directory.as_deref().unwrap(),
bookmark.remote_path.as_deref().unwrap(),
std::path::Path::new("/home")
);
assert_eq!(
bookmark.local_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
assert!(bookmark.s3.is_none());
}
@@ -270,15 +388,21 @@ mod tests {
protocol: FileTransferProtocol::Sftp,
username: Some(String::from("root")),
password: Some(String::from("password")),
directory: Some(PathBuf::from("/tmp")),
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: None,
};
let params = FileTransferParams::from(bookmark);
assert_eq!(params.protocol, FileTransferProtocol::Sftp);
assert_eq!(
params.entry_directory.as_deref().unwrap(),
params.remote_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
assert_eq!(
params.local_path.as_deref().unwrap(),
std::path::Path::new("/usr")
);
let gparams = params.params.generic_params().unwrap();
assert_eq!(gparams.address.as_str(), "192.168.1.1");
assert_eq!(gparams.port, 22);
@@ -286,6 +410,35 @@ mod tests {
assert_eq!(gparams.password.as_deref().unwrap(), "password");
}
#[test]
fn ftparams_from_webdav() {
let bookmark: Bookmark = Bookmark {
address: Some(String::from("192.168.1.1")),
port: None,
protocol: FileTransferProtocol::WebDAV,
username: Some(String::from("root")),
password: Some(String::from("password")),
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: None,
};
let params = FileTransferParams::from(bookmark);
assert_eq!(params.protocol, FileTransferProtocol::WebDAV);
assert_eq!(
params.remote_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
assert_eq!(
params.local_path.as_deref().unwrap(),
std::path::Path::new("/usr")
);
let gparams = params.params.webdav_params().unwrap();
assert_eq!(gparams.uri.as_str(), "192.168.1.1");
assert_eq!(gparams.username, "root");
assert_eq!(gparams.password, "password");
}
#[test]
fn ftparams_from_s3_bookmark() {
let bookmark: Bookmark = Bookmark {
@@ -294,7 +447,8 @@ mod tests {
port: None,
username: None,
password: None,
directory: Some(PathBuf::from("/tmp")),
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: Some(S3Params {
bucket: String::from("veeso"),
region: Some(String::from("eu-west-1")),
@@ -304,13 +458,18 @@ mod tests {
secret_access_key: Some(String::from("pluto")),
new_path_style: Some(true),
}),
smb: None,
};
let params = FileTransferParams::from(bookmark);
assert_eq!(params.protocol, FileTransferProtocol::AwsS3);
assert_eq!(
params.entry_directory.as_deref().unwrap(),
params.remote_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
assert_eq!(
params.local_path.as_deref().unwrap(),
std::path::Path::new("/usr")
);
let gparams = params.params.s3_params().unwrap();
assert_eq!(gparams.bucket_name.as_str(), "veeso");
assert_eq!(gparams.region.as_deref().unwrap(), "eu-west-1");
@@ -320,4 +479,74 @@ mod tests {
assert_eq!(gparams.secret_access_key.as_deref().unwrap(), "pluto");
assert_eq!(gparams.new_path_style, true);
}
#[test]
#[cfg(unix)]
fn should_get_ftparams_from_smb_bookmark() {
let bookmark: Bookmark = Bookmark {
protocol: FileTransferProtocol::Smb,
address: Some("localhost".to_string()),
port: Some(445),
username: Some("foo".to_string()),
password: Some("bar".to_string()),
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: Some(SmbParams {
share: "test".to_string(),
workgroup: Some("testone".to_string()),
}),
};
let params = FileTransferParams::from(bookmark);
assert_eq!(params.protocol, FileTransferProtocol::Smb);
assert_eq!(
params.remote_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
assert_eq!(
params.local_path.as_deref().unwrap(),
std::path::Path::new("/usr")
);
let smb_params = params.params.smb_params().unwrap();
assert_eq!(smb_params.address.as_str(), "localhost");
assert_eq!(smb_params.port, 445);
assert_eq!(smb_params.share.as_str(), "test");
assert_eq!(smb_params.password.as_deref().unwrap(), "bar");
assert_eq!(smb_params.username.as_deref().unwrap(), "foo");
assert_eq!(smb_params.workgroup.as_deref().unwrap(), "testone");
}
#[test]
#[cfg(windows)]
fn should_get_ftparams_from_smb_bookmark() {
let bookmark: Bookmark = Bookmark {
protocol: FileTransferProtocol::Smb,
address: Some("localhost".to_string()),
port: Some(445),
username: None,
password: None,
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: Some(SmbParams {
share: "test".to_string(),
workgroup: None,
}),
};
let params = FileTransferParams::from(bookmark);
assert_eq!(params.protocol, FileTransferProtocol::Smb);
assert_eq!(
params.remote_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
assert_eq!(
params.local_path.as_deref().unwrap(),
std::path::Path::new("/usr")
);
let smb_params = params.params.smb_params().unwrap();
assert_eq!(smb_params.address.as_str(), "localhost");
assert_eq!(smb_params.share.as_str(), "test");
}
}

View File

@@ -3,7 +3,6 @@
//! `config` is the module which provides access to all the termscp configurations
// export
pub use params::*;
pub mod bookmarks;
pub mod params;

View File

@@ -3,12 +3,13 @@
//! `config` is the module which provides access to termscp configuration
// Locals
use crate::filetransfer::FileTransferProtocol;
use std::collections::HashMap;
use std::path::PathBuf;
// Ext
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::path::PathBuf;
use crate::filetransfer::FileTransferProtocol;
pub const DEFAULT_NOTIFICATION_TRANSFER_THRESHOLD: u64 = 536870912; // 512MB
@@ -91,9 +92,10 @@ impl Default for UserInterfaceConfig {
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_config_mod_new() {
let mut keys: HashMap<String, PathBuf> = HashMap::with_capacity(1);

View File

@@ -2,8 +2,10 @@
//!
//! `serialization` provides serialization and deserialization for configurations
use serde::{de::DeserializeOwned, Serialize};
use std::io::{Read, Write};
use serde::de::DeserializeOwned;
use serde::Serialize;
use thiserror::Error;
/// Contains the error for serializer/deserializer
@@ -49,8 +51,6 @@ impl std::fmt::Display for SerializerError {
}
}
/// ### serialize
///
/// Serialize `UserHosts` into TOML and write content to writable
pub fn serialize<S>(serializable: &S, mut writable: Box<dyn Write>) -> Result<(), SerializerError>
where
@@ -77,8 +77,6 @@ where
}
}
/// ### deserialize
///
/// Read data from readable and deserialize its content as TOML
pub fn deserialize<S>(mut readable: Box<dyn Read>) -> Result<S, SerializerError>
where
@@ -109,20 +107,20 @@ where
#[cfg(test)]
mod tests {
use super::*;
use std::collections::HashMap;
use std::io::Seek;
use std::path::PathBuf;
use crate::config::bookmarks::{Bookmark, S3Params, UserHosts};
use pretty_assertions::assert_eq;
use tuirealm::tui::style::Color;
use super::*;
use crate::config::bookmarks::{Bookmark, S3Params, SmbParams, UserHosts};
use crate::config::params::UserConfig;
use crate::config::themes::Theme;
use crate::filetransfer::FileTransferProtocol;
use crate::utils::test_helpers::create_file_ioers;
use pretty_assertions::assert_eq;
use std::collections::HashMap;
use std::io::Seek;
use std::path::PathBuf;
use tuirealm::tui::style::Color;
#[test]
fn test_config_serialization_errors() {
let error: SerializerError = SerializerError::new(SerializerErrorKind::Syntax);
@@ -368,7 +366,7 @@ mod tests {
assert_eq!(host.username.as_deref().unwrap(), "root");
assert_eq!(host.password, None);
// Verify bookmarks
assert_eq!(hosts.bookmarks.len(), 4);
assert_eq!(hosts.bookmarks.len(), 5);
let host: &Bookmark = hosts.bookmarks.get("raspberrypi2").unwrap();
assert_eq!(host.address.as_deref().unwrap(), "192.168.1.31");
assert_eq!(host.port.unwrap(), 22);
@@ -382,7 +380,7 @@ mod tests {
assert_eq!(host.username.as_deref().unwrap(), "cvisintin");
assert_eq!(host.password.as_deref().unwrap(), "mysecret");
assert_eq!(
host.directory.as_deref().unwrap(),
host.remote_path.as_deref().unwrap(),
std::path::Path::new("/tmp")
);
let host: &Bookmark = hosts.bookmarks.get("aws-server-prod1").unwrap();
@@ -406,6 +404,20 @@ mod tests {
assert_eq!(s3.access_key.as_deref().unwrap(), "pippo");
assert_eq!(s3.secret_access_key.as_deref().unwrap(), "pluto");
assert_eq!(s3.new_path_style.unwrap(), true);
// smb
let host = hosts.bookmarks.get("smb").unwrap();
assert_eq!(host.address.as_deref().unwrap(), "localhost");
assert_eq!(host.port.unwrap(), 445);
#[cfg(unix)]
assert_eq!(host.username.as_deref().unwrap(), "test");
#[cfg(unix)]
assert_eq!(host.password.as_deref().unwrap(), "test");
let smb = host.smb.as_ref().unwrap();
assert_eq!(smb.share.as_str(), "temp");
#[cfg(unix)]
assert_eq!(smb.workgroup.as_deref().unwrap(), "test");
}
#[test]
@@ -429,8 +441,10 @@ mod tests {
protocol: FileTransferProtocol::Sftp,
username: Some(String::from("root")),
password: None,
directory: None,
remote_path: None,
local_path: None,
s3: None,
smb: None,
},
);
bookmarks.insert(
@@ -441,8 +455,10 @@ mod tests {
protocol: FileTransferProtocol::Sftp,
username: Some(String::from("cvisintin")),
password: Some(String::from("password")),
directory: Some(PathBuf::from("/tmp")),
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: None,
},
);
bookmarks.insert(
@@ -453,7 +469,8 @@ mod tests {
protocol: FileTransferProtocol::AwsS3,
username: None,
password: None,
directory: None,
remote_path: None,
local_path: None,
s3: Some(S3Params {
bucket: "veeso".to_string(),
region: Some("eu-west-1".to_string()),
@@ -463,6 +480,25 @@ mod tests {
secret_access_key: None,
new_path_style: None,
}),
smb: None,
},
);
let smb_params: Option<SmbParams> = Some(SmbParams {
share: "test".to_string(),
workgroup: None,
});
bookmarks.insert(
String::from("smb"),
Bookmark {
address: Some("localhost".to_string()),
port: Some(445),
protocol: FileTransferProtocol::Smb,
username: None,
password: None,
remote_path: None,
local_path: None,
s3: None,
smb: smb_params,
},
);
let mut recents: HashMap<String, Bookmark> = HashMap::with_capacity(1);
@@ -474,8 +510,10 @@ mod tests {
protocol: FileTransferProtocol::Scp,
username: Some(String::from("omar")),
password: Some(String::from("aaa")),
directory: Some(PathBuf::from("/tmp")),
remote_path: Some(PathBuf::from("/tmp")),
local_path: Some(PathBuf::from("/usr")),
s3: None,
smb: None,
},
);
let tmpfile: tempfile::NamedTempFile = tempfile::NamedTempFile::new().unwrap();
@@ -486,8 +524,10 @@ mod tests {
#[test]
fn test_config_serialization_theme_serialize() {
let mut theme: Theme = Theme::default();
theme.auth_address = Color::Rgb(240, 240, 240);
let theme: Theme = Theme {
auth_address: Color::Rgb(240, 240, 240),
..Default::default()
};
let tmpfile: tempfile::NamedTempFile = tempfile::NamedTempFile::new().unwrap();
let (reader, writer) = create_file_ioers(tmpfile.path());
assert!(serialize(&theme, Box::new(writer)).is_ok());
@@ -514,7 +554,7 @@ mod tests {
let file_content: &str = r#"
[bookmarks]
raspberrypi2 = { address = "192.168.1.31", port = 22, protocol = "SFTP", username = "root", password = "mypassword" }
msi-estrem = { address = "192.168.1.30", port = 22, protocol = "SFTP", username = "cvisintin", password = "mysecret", directory = "/tmp" }
msi-estrem = { address = "192.168.1.30", port = 22, protocol = "SFTP", username = "cvisintin", password = "mysecret", directory = "/tmp", local_path = "/usr" }
aws-server-prod1 = { address = "51.23.67.12", port = 21, protocol = "FTPS", username = "aws001" }
[bookmarks.my-bucket]
@@ -529,6 +569,17 @@ mod tests {
secret_access_key = "pluto"
new_path_style = true
[bookmarks.smb]
protocol = "SMB"
address = "localhost"
port = 445
username = "test"
password = "test"
[bookmarks.smb.smb]
share = "temp"
workgroup = "test"
[recents]
ISO20201215T094000Z = { address = "172.16.104.10", port = 22, protocol = "SCP", username = "root" }
"#;

View File

@@ -3,14 +3,14 @@
//! `themes` is the module which provides the themes configurations and the serializers
// locals
use crate::utils::fmt::fmt_color;
use crate::utils::parser::parse_color;
// ext
use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize, Serializer};
use serde::de::Error as DeError;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use tuirealm::tui::style::Color;
/// ### Theme
///
use crate::utils::fmt::fmt_color;
use crate::utils::parser::parse_color;
/// Theme contains all the colors lookup table for termscp
#[derive(Clone, Debug, Deserialize, PartialEq, Eq, Serialize)]
pub struct Theme {
@@ -213,10 +213,10 @@ where
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_config_themes_default() {
let theme: Theme = Theme::default();

View File

@@ -3,11 +3,12 @@
//! `builder` is the module which provides a builder for FileExplorer
// Locals
use super::formatter::Formatter;
use super::{ExplorerOpts, FileExplorer, FileSorting, GroupDirs};
// Ext
use std::collections::VecDeque;
use super::formatter::Formatter;
use super::{ExplorerOpts, FileExplorer, FileSorting, GroupDirs};
/// Struct used to create a `FileExplorer`
pub struct FileExplorerBuilder {
explorer: Option<FileExplorer>,
@@ -76,10 +77,10 @@ impl FileExplorerBuilder {
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_fs_explorer_builder_new_default() {
let explorer: FileExplorer = FileExplorerBuilder::new().build();

View File

@@ -3,18 +3,20 @@
//! `formatter` is the module which provides formatting utilities for `FileExplorer`
// Locals
use crate::utils::fmt::{fmt_path_elide, fmt_pex, fmt_time};
use crate::utils::path::diff_paths;
use crate::utils::string::secure_substring;
use std::path::PathBuf;
use std::time::UNIX_EPOCH;
// Ext
use bytesize::ByteSize;
use lazy_regex::{Lazy, Regex};
use remotefs::File;
use std::path::PathBuf;
use std::time::UNIX_EPOCH;
use unicode_width::UnicodeWidthStr;
#[cfg(target_family = "unix")]
#[cfg(unix)]
use users::{get_group_by_gid, get_user_by_uid};
use crate::utils::fmt::{fmt_path_elide, fmt_pex, fmt_time};
use crate::utils::path::diff_paths;
use crate::utils::string::secure_substring;
// Types
// FmtCallback: Formatter, fsentry: &File, cur_str, prefix, length, extra
type FmtCallback = fn(&Formatter, &File, &str, &str, Option<&usize>, Option<&String>) -> String;
@@ -209,7 +211,7 @@ impl Formatter {
_fmt_extra: Option<&String>,
) -> String {
// Get username
#[cfg(target_family = "unix")]
#[cfg(unix)]
let group: String = match fsentry.metadata().gid {
Some(gid) => match get_group_by_gid(gid) {
Some(user) => user.name().to_string_lossy().to_string(),
@@ -217,7 +219,7 @@ impl Formatter {
},
None => 0.to_string(),
};
#[cfg(target_os = "windows")]
#[cfg(windows)]
let group: String = match fsentry.metadata().gid {
Some(gid) => gid.to_string(),
None => 0.to_string(),
@@ -418,7 +420,7 @@ impl Formatter {
_fmt_extra: Option<&String>,
) -> String {
// Get username
#[cfg(target_family = "unix")]
#[cfg(unix)]
let username: String = match fsentry.metadata().uid {
Some(uid) => match get_user_by_uid(uid) {
Some(user) => user.name().to_string_lossy().to_string(),
@@ -426,7 +428,7 @@ impl Formatter {
},
None => 0.to_string(),
};
#[cfg(target_os = "windows")]
#[cfg(windows)]
let username: String = match fsentry.metadata().uid {
Some(uid) => uid.to_string(),
None => 0.to_string(),
@@ -521,12 +523,13 @@ impl Formatter {
#[cfg(test)]
mod tests {
use super::*;
use std::path::PathBuf;
use std::time::SystemTime;
use pretty_assertions::assert_eq;
use remotefs::fs::{File, FileType, Metadata, UnixPex};
use std::path::PathBuf;
use std::time::SystemTime;
use super::*;
#[test]
fn test_fs_explorer_formatter_callchain() {
@@ -589,7 +592,7 @@ mod tests {
mode: Some(UnixPex::from(0o644)),
},
};
#[cfg(target_family = "unix")]
#[cfg(unix)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -597,7 +600,7 @@ mod tests {
fmt_time(t, "%b %d %Y %H:%M")
)
);
#[cfg(target_os = "windows")]
#[cfg(windows)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -620,7 +623,7 @@ mod tests {
mode: Some(UnixPex::from(0o644)),
},
};
#[cfg(target_family = "unix")]
#[cfg(unix)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -628,7 +631,7 @@ mod tests {
fmt_time(t, "%b %d %Y %H:%M")
)
);
#[cfg(target_os = "windows")]
#[cfg(windows)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -651,7 +654,7 @@ mod tests {
mode: None,
},
};
#[cfg(target_family = "unix")]
#[cfg(unix)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -659,7 +662,7 @@ mod tests {
fmt_time(t, "%b %d %Y %H:%M")
)
);
#[cfg(target_os = "windows")]
#[cfg(windows)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -682,7 +685,7 @@ mod tests {
mode: None,
},
};
#[cfg(target_family = "unix")]
#[cfg(unix)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -690,7 +693,7 @@ mod tests {
fmt_time(t, "%b %d %Y %H:%M")
)
);
#[cfg(target_os = "windows")]
#[cfg(windows)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -720,7 +723,7 @@ mod tests {
mode: Some(UnixPex::from(0o755)),
},
};
#[cfg(target_family = "unix")]
#[cfg(unix)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -728,7 +731,7 @@ mod tests {
fmt_time(t, "%b %d %Y %H:%M")
)
);
#[cfg(target_os = "windows")]
#[cfg(windows)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -751,7 +754,7 @@ mod tests {
mode: None,
},
};
#[cfg(target_family = "unix")]
#[cfg(unix)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -759,7 +762,7 @@ mod tests {
fmt_time(t, "%b %d %Y %H:%M")
)
);
#[cfg(target_os = "windows")]
#[cfg(windows)]
assert_eq!(
formatter.fmt(&entry),
format!(
@@ -861,7 +864,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn should_fmt_path() {
let t: SystemTime = SystemTime::now();
let entry = File {
@@ -893,7 +896,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn should_fmt_utf8_path() {
let t: SystemTime = SystemTime::now();
let entry = File {

View File

@@ -6,19 +6,19 @@
pub(crate) mod builder;
mod formatter;
// Locals
use formatter::Formatter;
// Ext
use remotefs::fs::File;
use std::cmp::Reverse;
use std::collections::VecDeque;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::string::ToString;
use formatter::Formatter;
// Ext
use remotefs::fs::File;
bitflags! {
/// ## ExplorerOpts
///
/// ExplorerOpts are bit options which provides different behaviours to `FileExplorer`
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub(crate) struct ExplorerOpts: u32 {
const SHOW_HIDDEN_FILES = 0b00000001;
}
@@ -290,13 +290,14 @@ impl FromStr for GroupDirs {
#[cfg(test)]
mod tests {
use super::*;
use crate::utils::fmt::fmt_time;
use std::thread::sleep;
use std::time::{Duration, SystemTime};
use pretty_assertions::assert_eq;
use remotefs::fs::{File, FileType, Metadata, UnixPex};
use std::thread::sleep;
use std::time::{Duration, SystemTime};
use super::*;
use crate::utils::fmt::fmt_time;
#[test]
fn test_fs_explorer_new() {
@@ -314,8 +315,11 @@ mod tests {
#[test]
fn test_fs_explorer_stack() {
let mut explorer: FileExplorer = FileExplorer::default();
explorer.stack_size = 2;
let mut explorer = FileExplorer {
stack_size: 2,
dirstack: VecDeque::with_capacity(2),
..Default::default()
};
explorer.dirstack = VecDeque::with_capacity(2);
// Push dir
explorer.pushd(Path::new("/tmp"));
@@ -512,7 +516,7 @@ mod tests {
mode: Some(UnixPex::from(0o644)),
},
};
#[cfg(target_family = "unix")]
#[cfg(unix)]
assert_eq!(
explorer.fmt_file(&entry),
format!(
@@ -520,7 +524,7 @@ mod tests {
fmt_time(t, "%b %d %Y %H:%M")
)
);
#[cfg(target_os = "windows")]
#[cfg(windows)]
assert_eq!(
explorer.fmt_file(&entry),
format!(

View File

@@ -2,16 +2,27 @@
//!
//! Remotefs client builder
use super::params::{AwsS3Params, GenericProtocolParams};
use super::{FileTransferProtocol, ProtocolParams};
use crate::system::config_client::ConfigClient;
use crate::system::sshkey_storage::SshKeyStorage;
use std::path::PathBuf;
use remotefs::RemoteFs;
use remotefs_aws_s3::AwsS3Fs;
use remotefs_ftp::FtpFs;
use remotefs_ssh::{ScpFs, SftpFs, SshOpts};
use std::path::PathBuf;
#[cfg(smb_unix)]
use remotefs_smb::SmbOptions;
#[cfg(smb)]
use remotefs_smb::{SmbCredentials, SmbFs};
use remotefs_ssh::{ScpFs, SftpFs, SshConfigParseRule, SshOpts};
use remotefs_webdav::WebDAVFs;
use super::params::WebDAVProtocolParams;
#[cfg(not(smb))]
use super::params::{AwsS3Params, GenericProtocolParams};
#[cfg(smb)]
use super::params::{AwsS3Params, GenericProtocolParams, SmbParams};
use super::{FileTransferProtocol, ProtocolParams};
use crate::system::config_client::ConfigClient;
use crate::system::sshkey_storage::SshKeyStorage;
use crate::utils::ssh as ssh_utils;
/// Remotefs builder
pub struct Builder;
@@ -38,6 +49,13 @@ impl Builder {
(FileTransferProtocol::Sftp, ProtocolParams::Generic(params)) => {
Box::new(Self::sftp_client(params, config_client))
}
#[cfg(smb)]
(FileTransferProtocol::Smb, ProtocolParams::Smb(params)) => {
Box::new(Self::smb_client(params))
}
(FileTransferProtocol::WebDAV, ProtocolParams::WebDAV(params)) => {
Box::new(Self::webdav_client(params))
}
(protocol, params) => {
error!("Invalid params for protocol '{:?}'", protocol);
panic!("Invalid protocol '{protocol:?}' with parameters of type {params:?}")
@@ -97,19 +115,99 @@ impl Builder {
Self::build_ssh_opts(params, config_client).into()
}
#[cfg(smb_unix)]
fn smb_client(params: SmbParams) -> SmbFs {
let mut credentials = SmbCredentials::default()
.server(format!("smb://{}:{}", params.address, params.port))
.share(params.share);
if let Some(username) = params.username {
credentials = credentials.username(username);
}
if let Some(password) = params.password {
credentials = credentials.password(password);
}
if let Some(workgroup) = params.workgroup {
credentials = credentials.workgroup(workgroup);
}
match SmbFs::try_new(
credentials,
SmbOptions::default()
.one_share_per_server(true)
.case_sensitive(false),
) {
Ok(fs) => fs,
Err(e) => {
error!("Invalid params for protocol SMB: {e}");
panic!("Invalid params for protocol SMB: {e}")
}
}
}
#[cfg(smb_windows)]
fn smb_client(params: SmbParams) -> SmbFs {
let mut credentials = SmbCredentials::new(params.address, params.share);
if let Some(username) = params.username {
credentials = credentials.username(username);
}
if let Some(password) = params.password {
credentials = credentials.password(password);
}
SmbFs::new(credentials)
}
fn webdav_client(params: WebDAVProtocolParams) -> WebDAVFs {
WebDAVFs::new(&params.username, &params.password, &params.uri)
}
/// Build ssh options from generic protocol params and client configuration
fn build_ssh_opts(params: GenericProtocolParams, config_client: &ConfigClient) -> SshOpts {
let mut opts = SshOpts::new(params.address)
let mut opts = SshOpts::new(params.address.clone())
.key_storage(Box::new(Self::make_ssh_storage(config_client)))
.port(params.port);
// get ssh config
let ssh_config = config_client
.get_ssh_config()
.and_then(|path| {
debug!("reading ssh config at {}", path);
ssh_utils::parse_ssh2_config(path).ok()
})
.map(|config| config.query(&params.address));
//* override port
if let Some(port) = ssh_config.as_ref().and_then(|config| config.port) {
opts = opts.port(port);
}
//* get username. Case 1 provided in params
if let Some(username) = params.username {
opts = opts.username(username);
} else if let Some(ssh_config) = &ssh_config {
debug!("no username was provided, checking whether a user is set for this host");
if let Some(username) = &ssh_config.user {
debug!("found username from config: {username}");
opts = opts.username(username);
} else {
//* case 3: use system username; can't be None
debug!("no username was provided, using current username");
opts = opts.username(whoami::username());
}
} else {
//* case 3: use system username; can't be None
debug!("no username was provided, using current username");
opts = opts.username(whoami::username());
}
if let Some(password) = params.password {
opts = opts.password(password);
}
if let Some(config_path) = config_client.get_ssh_config() {
opts = opts.config_file(PathBuf::from(config_path));
opts = opts.config_file(
PathBuf::from(config_path),
SshConfigParseRule::ALLOW_UNKNOWN_FIELDS,
);
}
opts
}
@@ -123,11 +221,12 @@ impl Builder {
#[cfg(test)]
mod test {
use super::*;
use std::path::{Path, PathBuf};
use tempfile::TempDir;
use super::*;
#[test]
fn should_build_aws_s3_fs() {
let params = ProtocolParams::AwsS3(
@@ -182,6 +281,14 @@ mod test {
let _ = Builder::build(FileTransferProtocol::Sftp, params, &config_client);
}
#[test]
#[cfg(smb)]
fn should_build_smb_fs() {
let params = ProtocolParams::Smb(SmbParams::new("localhost", "share"));
let config_client = get_config_client();
let _ = Builder::build(FileTransferProtocol::Smb, params, &config_client);
}
#[test]
#[should_panic]
fn should_not_build_fs() {

View File

@@ -13,10 +13,12 @@ pub use params::{FileTransferParams, ProtocolParams};
#[derive(PartialEq, Eq, Debug, Clone, Copy)]
pub enum FileTransferProtocol {
Sftp,
Scp,
Ftp(bool), // Bool is for secure (true => ftps)
AwsS3,
Ftp(bool), // Bool is for secure (true => ftps)
Scp,
Sftp,
Smb,
WebDAV,
}
// Traits
@@ -24,13 +26,15 @@ pub enum FileTransferProtocol {
impl std::string::ToString for FileTransferProtocol {
fn to_string(&self) -> String {
String::from(match self {
FileTransferProtocol::AwsS3 => "S3",
FileTransferProtocol::Ftp(secure) => match secure {
true => "FTPS",
false => "FTP",
},
FileTransferProtocol::Scp => "SCP",
FileTransferProtocol::Sftp => "SFTP",
FileTransferProtocol::AwsS3 => "S3",
FileTransferProtocol::Smb => "SMB",
FileTransferProtocol::WebDAV => "WEBDAV",
})
}
}
@@ -41,9 +45,11 @@ impl std::str::FromStr for FileTransferProtocol {
match s.to_ascii_uppercase().as_str() {
"FTP" => Ok(FileTransferProtocol::Ftp(false)),
"FTPS" => Ok(FileTransferProtocol::Ftp(true)),
"S3" => Ok(FileTransferProtocol::AwsS3),
"SCP" => Ok(FileTransferProtocol::Scp),
"SFTP" => Ok(FileTransferProtocol::Sftp),
"S3" => Ok(FileTransferProtocol::AwsS3),
"SMB" => Ok(FileTransferProtocol::Smb),
"WEBDAV" | "HTTP" | "HTTPS" => Ok(FileTransferProtocol::WebDAV),
_ => Err(s.to_string()),
}
}
@@ -54,12 +60,13 @@ impl std::str::FromStr for FileTransferProtocol {
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use std::str::FromStr;
use std::string::ToString;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_filetransfer_mod_protocol() {
assert_eq!(
@@ -103,6 +110,14 @@ mod tests {
FileTransferProtocol::from_str("scp").ok().unwrap(),
FileTransferProtocol::Scp
);
assert_eq!(
FileTransferProtocol::from_str("SMB").ok().unwrap(),
FileTransferProtocol::Smb
);
assert_eq!(
FileTransferProtocol::from_str("smb").ok().unwrap(),
FileTransferProtocol::Smb
);
assert_eq!(
FileTransferProtocol::from_str("S3").ok().unwrap(),
FileTransferProtocol::AwsS3
@@ -122,8 +137,17 @@ mod tests {
FileTransferProtocol::Ftp(false).to_string(),
String::from("FTP")
);
assert_eq!(
FileTransferProtocol::WebDAV.to_string(),
String::from("WEBDAV")
);
assert_eq!(FileTransferProtocol::Scp.to_string(), String::from("SCP"));
assert_eq!(FileTransferProtocol::Sftp.to_string(), String::from("SFTP"));
assert_eq!(FileTransferProtocol::AwsS3.to_string(), String::from("S3"));
assert_eq!(FileTransferProtocol::Smb.to_string(), String::from("SMB"));
assert_eq!(
FileTransferProtocol::WebDAV.to_string(),
String::from("WEBDAV")
);
}
}

View File

@@ -2,18 +2,17 @@
//!
//! file transfer parameters
use super::FileTransferProtocol;
use std::path::{Path, PathBuf};
/// ### FileTransferParams
///
use super::FileTransferProtocol;
/// Holds connection parameters for file transfers
#[derive(Debug, Clone)]
pub struct FileTransferParams {
pub protocol: FileTransferProtocol,
pub params: ProtocolParams,
pub entry_directory: Option<PathBuf>,
pub remote_path: Option<PathBuf>,
pub local_path: Option<PathBuf>,
}
/// Container for protocol params
@@ -21,6 +20,8 @@ pub struct FileTransferParams {
pub enum ProtocolParams {
Generic(GenericProtocolParams),
AwsS3(AwsS3Params),
Smb(SmbParams),
WebDAV(WebDAVProtocolParams),
}
/// Protocol params used by most common protocols
@@ -46,19 +47,39 @@ pub struct AwsS3Params {
pub new_path_style: bool,
}
/// Connection parameters for SMB protocol
#[derive(Debug, Clone)]
pub struct SmbParams {
pub address: String,
#[cfg(unix)]
pub port: u16,
pub share: String,
pub username: Option<String>,
pub password: Option<String>,
#[cfg(unix)]
pub workgroup: Option<String>,
}
impl FileTransferParams {
/// Instantiates a new `FileTransferParams`
pub fn new(protocol: FileTransferProtocol, params: ProtocolParams) -> Self {
Self {
protocol,
params,
entry_directory: None,
remote_path: None,
local_path: None,
}
}
/// Set entry directory
pub fn entry_directory<P: AsRef<Path>>(mut self, dir: Option<P>) -> Self {
self.entry_directory = dir.map(|x| x.as_ref().to_path_buf());
/// Set remote directory
pub fn remote_path<P: AsRef<Path>>(mut self, dir: Option<P>) -> Self {
self.remote_path = dir.map(|x| x.as_ref().to_path_buf());
self
}
/// Set local directory
pub fn local_path<P: AsRef<Path>>(mut self, dir: Option<P>) -> Self {
self.local_path = dir.map(|x| x.as_ref().to_path_buf());
self
}
@@ -68,6 +89,8 @@ impl FileTransferParams {
match &self.params {
ProtocolParams::AwsS3(params) => params.password_missing(),
ProtocolParams::Generic(params) => params.password_missing(),
ProtocolParams::Smb(params) => params.password_missing(),
ProtocolParams::WebDAV(params) => params.password_missing(),
}
}
@@ -76,10 +99,30 @@ impl FileTransferParams {
match &mut self.params {
ProtocolParams::AwsS3(params) => params.set_default_secret(secret),
ProtocolParams::Generic(params) => params.set_default_secret(secret),
ProtocolParams::Smb(params) => params.set_default_secret(secret),
ProtocolParams::WebDAV(params) => params.set_default_secret(secret),
}
}
}
/// Protocol params used by WebDAV
#[derive(Debug, Clone)]
pub struct WebDAVProtocolParams {
pub uri: String,
pub username: String,
pub password: String,
}
impl WebDAVProtocolParams {
fn set_default_secret(&mut self, secret: String) {
self.password = secret;
}
fn password_missing(&self) -> bool {
self.password.is_empty()
}
}
impl Default for FileTransferParams {
fn default() -> Self {
Self::new(FileTransferProtocol::Sftp, ProtocolParams::default())
@@ -93,7 +136,6 @@ impl Default for ProtocolParams {
}
impl ProtocolParams {
#[cfg(test)]
/// Retrieve generic parameters from protocol params if any
pub fn generic_params(&self) -> Option<&GenericProtocolParams> {
match self {
@@ -119,6 +161,24 @@ impl ProtocolParams {
_ => None,
}
}
#[cfg(test)]
/// Retrieve SMB parameters if any
pub fn smb_params(&self) -> Option<&SmbParams> {
match self {
ProtocolParams::Smb(params) => Some(params),
_ => None,
}
}
#[cfg(test)]
/// Retrieve WebDAV parameters if any
pub fn webdav_params(&self) -> Option<&WebDAVProtocolParams> {
match self {
ProtocolParams::WebDAV(params) => Some(params),
_ => None,
}
}
}
// -- Generic protocol params
@@ -237,26 +297,81 @@ impl AwsS3Params {
}
}
// -- SMB params
impl SmbParams {
/// Instantiates a new `AwsS3Params` struct
pub fn new<S: AsRef<str>>(address: S, share: S) -> Self {
Self {
address: address.as_ref().to_string(),
#[cfg(unix)]
port: 445,
share: share.as_ref().to_string(),
username: None,
password: None,
#[cfg(unix)]
workgroup: None,
}
}
#[cfg(unix)]
pub fn port(mut self, port: u16) -> Self {
self.port = port;
self
}
pub fn username(mut self, username: Option<impl ToString>) -> Self {
self.username = username.map(|x| x.to_string());
self
}
pub fn password(mut self, password: Option<impl ToString>) -> Self {
self.password = password.map(|x| x.to_string());
self
}
#[cfg(unix)]
pub fn workgroup(mut self, workgroup: Option<impl ToString>) -> Self {
self.workgroup = workgroup.map(|x| x.to_string());
self
}
/// Returns whether a password is supposed to be required for this protocol params.
/// The result true is returned ONLY if the supposed secret is MISSING!!!
pub fn password_missing(&self) -> bool {
self.password.is_none()
}
/// Set password
#[cfg(unix)]
pub fn set_default_secret(&mut self, secret: String) {
self.password = Some(secret);
}
#[cfg(windows)]
pub fn set_default_secret(&mut self, _secret: String) {}
}
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_filetransfer_params() {
let params: FileTransferParams =
FileTransferParams::new(FileTransferProtocol::Scp, ProtocolParams::default())
.entry_directory(Some(&Path::new("/tmp")));
.remote_path(Some(&Path::new("/tmp")))
.local_path(Some(&Path::new("/usr")));
assert_eq!(
params.params.generic_params().unwrap().address.as_str(),
"localhost"
);
assert_eq!(params.protocol, FileTransferProtocol::Scp);
assert_eq!(
params.entry_directory.as_deref().unwrap(),
Path::new("/tmp")
);
assert_eq!(params.remote_path.as_deref().unwrap(), Path::new("/tmp"));
assert_eq!(params.local_path.as_deref().unwrap(), Path::new("/usr"));
}
#[test]
@@ -305,6 +420,53 @@ mod test {
assert_eq!(params.new_path_style, true);
}
#[test]
fn should_init_smb_params() {
let params = SmbParams::new("localhost", "temp");
assert_eq!(&params.address, "localhost");
#[cfg(unix)]
assert_eq!(params.port, 445);
assert_eq!(&params.share, "temp");
#[cfg(unix)]
assert!(params.username.is_none());
#[cfg(unix)]
assert!(params.password.is_none());
#[cfg(unix)]
assert!(params.workgroup.is_none());
}
#[test]
#[cfg(unix)]
fn should_init_smb_params_with_optionals() {
let params = SmbParams::new("localhost", "temp")
.port(3456)
.username(Some("foo"))
.password(Some("bar"))
.workgroup(Some("baz"));
assert_eq!(&params.address, "localhost");
assert_eq!(params.port, 3456);
assert_eq!(&params.share, "temp");
assert_eq!(params.username.as_deref().unwrap(), "foo");
assert_eq!(params.password.as_deref().unwrap(), "bar");
assert_eq!(params.workgroup.as_deref().unwrap(), "baz");
}
#[test]
#[cfg(windows)]
fn should_init_smb_params_with_optionals() {
let params = SmbParams::new("localhost", "temp")
.username(Some("foo"))
.password(Some("bar"));
assert_eq!(&params.address, "localhost");
assert_eq!(&params.share, "temp");
assert_eq!(params.username.as_deref().unwrap(), "foo");
assert_eq!(params.password.as_deref().unwrap(), "bar");
}
#[test]
fn references() {
let mut params =
@@ -380,6 +542,40 @@ mod test {
);
}
#[test]
#[cfg(unix)]
fn set_default_secret_smb() {
let mut params = FileTransferParams::new(
FileTransferProtocol::Scp,
ProtocolParams::Smb(SmbParams::new("localhost", "temp")),
);
params.set_default_secret(String::from("secret"));
assert_eq!(
params
.params
.smb_params()
.unwrap()
.password
.as_deref()
.unwrap(),
"secret"
);
}
#[test]
fn set_default_secret_webdav() {
let mut params = FileTransferParams::new(
FileTransferProtocol::Scp,
ProtocolParams::WebDAV(WebDAVProtocolParams {
uri: "http://localhost".to_string(),
username: "user".to_string(),
password: "pass".to_string(),
}),
);
params.set_default_secret(String::from("secret"));
assert_eq!(params.params.webdav_params().unwrap().password, "secret");
}
#[test]
fn set_default_secret_generic() {
let mut params =

View File

@@ -3,19 +3,20 @@
//! `host` is the module which provides functionalities to host file system
// ext
// Metadata ext
#[cfg(unix)]
use std::fs::set_permissions;
use std::fs::{self, File as StdFile, OpenOptions};
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
use std::path::{Path, PathBuf};
use filetime::{self, FileTime};
#[cfg(target_family = "unix")]
#[cfg(unix)]
use remotefs::fs::UnixPex;
use remotefs::fs::{File, FileType, Metadata};
use std::fs::{self, File as StdFile, OpenOptions};
use std::path::{Path, PathBuf};
use thiserror::Error;
use wildmatch::WildMatch;
// Metadata ext
#[cfg(target_family = "unix")]
use std::fs::set_permissions;
#[cfg(target_family = "unix")]
use std::os::unix::fs::PermissionsExt;
// Locals
use crate::utils::path;
@@ -41,8 +42,6 @@ pub enum HostErrorType {
DeleteFailed,
}
/// ### HostError
///
/// HostError is a wrapper for the error type and the exact io error
#[derive(Debug)]
pub struct HostError {
@@ -421,7 +420,7 @@ impl Localhost {
filetime::set_file_atime(path, atime)
.map_err(|e| HostError::new(HostErrorType::FileNotAccessible, Some(e), path))?;
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
if let Some(mode) = metadata.mode {
self.chmod(path, mode)?;
}
@@ -455,7 +454,7 @@ impl Localhost {
}
/// Change file mode to file, according to UNIX permissions
#[cfg(target_family = "unix")]
#[cfg(unix)]
pub fn chmod(&self, path: &Path, pex: UnixPex) -> Result<(), HostError> {
let path: PathBuf = self.to_path(path);
// Get metadta
@@ -587,7 +586,7 @@ impl Localhost {
}
/// Create a symlink at path pointing at target
#[cfg(target_family = "unix")]
#[cfg(unix)]
pub fn symlink(&self, path: &Path, target: &Path) -> Result<(), HostError> {
let path = self.to_path(path);
std::os::unix::fs::symlink(target, path.as_path()).map_err(|e| {
@@ -645,21 +644,21 @@ impl Localhost {
#[cfg(test)]
mod tests {
use super::*;
#[cfg(target_family = "unix")]
use crate::utils::test_helpers::make_fsentry;
use crate::utils::test_helpers::{create_sample_file, make_dir_at, make_file_at};
#[cfg(unix)]
use std::fs::File as StdFile;
#[cfg(unix)]
use std::io::Write;
use std::ops::AddAssign;
#[cfg(unix)]
use std::os::unix::fs::{symlink, PermissionsExt};
use std::time::{Duration, SystemTime};
use pretty_assertions::assert_eq;
#[cfg(target_family = "unix")]
use std::fs::File as StdFile;
#[cfg(target_family = "unix")]
use std::io::Write;
#[cfg(target_family = "unix")]
use std::os::unix::fs::{symlink, PermissionsExt};
use std::time::SystemTime;
use std::{ops::AddAssign, time::Duration};
use super::*;
#[cfg(unix)]
use crate::utils::test_helpers::make_fsentry;
use crate::utils::test_helpers::{create_sample_file, make_dir_at, make_file_at};
#[test]
fn test_host_error_new() {
@@ -670,7 +669,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_new() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
assert_eq!(host.wrkdir, PathBuf::from("/dev"));
@@ -684,7 +683,7 @@ mod tests {
}
#[test]
#[cfg(target_os = "windows")]
#[cfg(windows)]
fn test_host_localhost_new() {
let host: Localhost = Localhost::new(PathBuf::from("C:\\users")).ok().unwrap();
assert_eq!(host.wrkdir, PathBuf::from("C:\\users"));
@@ -706,14 +705,14 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_pwd() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
assert_eq!(host.pwd(), PathBuf::from("/dev"));
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_list_files() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
// Scan dir
@@ -726,7 +725,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_change_dir() {
let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
let new_dir: PathBuf = PathBuf::from("/dev");
@@ -742,7 +741,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[should_panic]
fn test_host_localhost_change_dir_failed() {
let mut host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
@@ -751,7 +750,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_open_read() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
// Create temp file
@@ -760,7 +759,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[should_panic]
fn test_host_localhost_open_read_err_no_such_file() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
@@ -781,7 +780,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_open_write() {
let host: Localhost = Localhost::new(PathBuf::from("/dev")).ok().unwrap();
// Create temp file
@@ -800,7 +799,7 @@ mod tests {
assert!(host.open_file_write(file.path()).is_err());
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[test]
fn test_host_localhost_symlinks() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
@@ -838,7 +837,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_mkdir() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
let mut host: Localhost = Localhost::new(PathBuf::from(tmpdir.path())).ok().unwrap();
@@ -863,7 +862,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_remove() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
// Create sample file
@@ -892,7 +891,7 @@ mod tests {
}
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn test_host_localhost_rename() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
// Create sample file
@@ -945,7 +944,7 @@ mod tests {
assert_eq!(new_metadata.metadata().modified, Some(new_mtime));
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[test]
fn test_host_chmod() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
@@ -964,7 +963,7 @@ mod tests {
.is_err());
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[test]
fn test_host_copy_file_absolute() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
@@ -994,7 +993,7 @@ mod tests {
.is_err());
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[test]
fn test_host_copy_file_relative() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
@@ -1016,7 +1015,7 @@ mod tests {
assert_eq!(host.files.len(), 2);
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[test]
fn test_host_copy_directory_absolute() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
@@ -1047,7 +1046,7 @@ mod tests {
assert!(host.stat(test_file_path.as_path()).is_ok());
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[test]
fn test_host_copy_directory_relative() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
@@ -1082,10 +1081,7 @@ mod tests {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();
let host: Localhost = Localhost::new(PathBuf::from(tmpdir.path())).ok().unwrap();
// Execute
#[cfg(target_family = "unix")]
assert_eq!(host.exec("echo 5").ok().unwrap().as_str(), "5\n");
#[cfg(target_os = "windows")]
assert_eq!(host.exec("echo 5").ok().unwrap().as_str(), "5\r\n");
assert!(host.exec("echo 5").ok().unwrap().as_str().contains("5"));
}
#[test]
@@ -1121,7 +1117,7 @@ mod tests {
assert_eq!(result[1].name(), "examples.csv");
}
#[cfg(target_family = "unix")]
#[cfg(unix)]
#[test]
fn should_create_symlink() {
let tmpdir: tempfile::TempDir = tempfile::TempDir::new().unwrap();

View File

@@ -15,7 +15,7 @@ extern crate magic_crypt;
// External libs
use std::env;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::time::Duration;
// Include
@@ -32,7 +32,7 @@ mod utils;
// namespaces
use activity_manager::{ActivityManager, NextActivity};
use cli_opts::{Args, BookmarkParams, HostParams, Remote, RunOpts, Task};
use cli_opts::{Args, ArgsSubcommands, BookmarkParams, HostParams, Remote, RunOpts, Task};
use filetransfer::FileTransferParams;
use system::logging::{self, LogLevel};
@@ -63,59 +63,57 @@ fn main() {
/// In case of success returns `RunOpts`
/// in case something is wrong returns the error message
fn parse_args(args: Args) -> Result<RunOpts, String> {
let mut run_opts: RunOpts = RunOpts::default();
// Version
if args.version {
return Err(format!(
"termscp - {TERMSCP_VERSION} - Developed by {TERMSCP_AUTHORS}",
));
}
// Setup activity?
if args.config {
run_opts.task = Task::Activity(NextActivity::SetupActivity);
}
// Logging
if args.debug {
run_opts.log_level = LogLevel::Trace;
} else if args.quiet {
run_opts.log_level = LogLevel::Off;
}
// Match ticks
run_opts.ticks = Duration::from_millis(args.ticks);
// @! extra modes
if let Some(theme) = args.theme.as_deref() {
run_opts.task = Task::ImportTheme(PathBuf::from(theme));
}
if args.update {
run_opts.task = Task::InstallUpdate;
}
// @! Ordinary mode
// Remote argument
match parse_address_arg(&args) {
Err(err) => return Err(err),
Ok(Remote::None) => {}
Ok(remote) => {
// Set params
run_opts.remote = remote;
// In this case the first activity will be FileTransfer
run_opts.task = Task::Activity(NextActivity::FileTransfer);
}
}
let run_opts = match args.nested {
Some(ArgsSubcommands::Update(_)) => RunOpts::update(),
Some(ArgsSubcommands::LoadTheme(args)) => RunOpts::import_theme(args.theme),
Some(ArgsSubcommands::Config(_)) => RunOpts::config(),
None => {
let mut run_opts: RunOpts = RunOpts::default();
// Version
if args.version {
return Err(format!(
"termscp - {TERMSCP_VERSION} - Developed by {TERMSCP_AUTHORS}",
));
}
// Logging
if args.debug {
run_opts.log_level = LogLevel::Trace;
} else if args.quiet {
run_opts.log_level = LogLevel::Off;
}
// Match ticks
run_opts.ticks = Duration::from_millis(args.ticks);
// Remote argument
match parse_address_arg(&args) {
Err(err) => return Err(err),
Ok(Remote::None) => {}
Ok(remote) => {
// Set params
run_opts.remote = remote;
// In this case the first activity will be FileTransfer
run_opts.task = Task::Activity(NextActivity::FileTransfer);
}
}
// Local directory
if let Some(localdir) = args.positional.get(1) {
// Change working directory if local dir is set
let localdir: PathBuf = PathBuf::from(localdir);
if let Err(err) = env::set_current_dir(localdir.as_path()) {
return Err(format!("Bad working directory argument: {err}"));
// Local directory
if let Some(localdir) = args.positional.get(1) {
// Change working directory if local dir is set
let localdir: PathBuf = PathBuf::from(localdir);
if let Err(err) = env::set_current_dir(localdir.as_path()) {
return Err(format!("Bad working directory argument: {err}"));
}
}
run_opts
}
}
};
Ok(run_opts)
}
/// Parse address argument from cli args
fn parse_address_arg(args: &Args) -> Result<Remote, String> {
if let Some(remote) = args.positional.get(0) {
if let Some(remote) = args.positional.first() {
if args.address_as_bookmark {
Ok(Remote::Bookmark(BookmarkParams::new(
remote,
@@ -136,64 +134,67 @@ fn parse_remote_address(remote: &str) -> Result<FileTransferParams, String> {
utils::parser::parse_remote_opt(remote).map_err(|e| format!("Bad address option: {e}"))
}
/// ### run
///
/// Run task and return rc
fn run(run_opts: RunOpts) -> i32 {
match run_opts.task {
Task::ImportTheme(theme) => match support::import_theme(theme.as_path()) {
Ok(_) => {
println!("Theme has been successfully imported!");
0
}
Err(err) => {
eprintln!("{err}");
1
}
},
Task::InstallUpdate => match support::install_update() {
Ok(msg) => {
println!("{msg}");
0
}
Err(err) => {
eprintln!("Could not install update: {err}");
1
}
},
Task::Activity(activity) => {
// Get working directory
let wrkdir: PathBuf = match env::current_dir() {
Ok(dir) => dir,
Err(_) => PathBuf::from("/"),
};
// Create activity manager (and context too)
let mut manager: ActivityManager =
match ActivityManager::new(wrkdir.as_path(), run_opts.ticks) {
Ok(m) => m,
Err(err) => {
eprintln!("Could not start activity manager: {err}");
return 1;
}
};
// Set file transfer params if set
match run_opts.remote {
Remote::Bookmark(BookmarkParams { name, password }) => {
if let Err(err) = manager.resolve_bookmark_name(&name, password.as_deref()) {
eprintln!("{err}");
return 1;
}
}
Remote::Host(HostParams { params, password }) => {
if let Err(err) = manager.set_filetransfer_params(params, password.as_deref()) {
eprintln!("{err}");
return 1;
}
}
Remote::None => {}
}
manager.run(activity);
Task::ImportTheme(theme) => run_import_theme(&theme),
Task::InstallUpdate => run_install_update(),
Task::Activity(activity) => run_activity(activity, run_opts.ticks, run_opts.remote),
}
}
fn run_import_theme(theme: &Path) -> i32 {
match support::import_theme(theme) {
Ok(_) => {
println!("Theme has been successfully imported!");
0
}
Err(err) => {
eprintln!("{err}");
1
}
}
}
fn run_install_update() -> i32 {
match support::install_update() {
Ok(msg) => {
println!("{msg}");
0
}
Err(err) => {
eprintln!("Could not install update: {err}");
1
}
}
}
fn run_activity(activity: NextActivity, ticks: Duration, remote: Remote) -> i32 {
// Create activity manager (and context too)
let mut manager: ActivityManager = match ActivityManager::new(ticks) {
Ok(m) => m,
Err(err) => {
eprintln!("Could not start activity manager: {err}");
return 1;
}
};
// Set file transfer params if set
match remote {
Remote::Bookmark(BookmarkParams { name, password }) => {
if let Err(err) = manager.resolve_bookmark_name(&name, password.as_deref()) {
eprintln!("{err}");
return 1;
}
}
Remote::Host(HostParams { params, password }) => {
if let Err(err) = manager.set_filetransfer_params(params, password.as_deref()) {
eprintln!("{err}");
return 1;
}
}
Remote::None => {}
}
manager.run(activity);
0
}

View File

@@ -3,18 +3,15 @@
//! this module exposes some extra run modes for termscp, meant to be used for "support", such as installing themes
// mod
use crate::system::{
auto_update::{Update, UpdateStatus},
config_client::ConfigClient,
environment,
notifications::Notification,
theme_provider::ThemeProvider,
};
use std::fs;
use std::path::{Path, PathBuf};
/// ### import_theme
///
use crate::system::auto_update::{Update, UpdateStatus};
use crate::system::config_client::ConfigClient;
use crate::system::environment;
use crate::system::notifications::Notification;
use crate::system::theme_provider::ThemeProvider;
/// Import theme at provided path into termscp
pub fn import_theme(p: &Path) -> Result<(), String> {
if !p.exists() {
@@ -34,8 +31,6 @@ pub fn import_theme(p: &Path) -> Result<(), String> {
.map_err(|e| format!("Could not import theme: {e}"))
}
/// ### install_update
///
/// Install latest version of termscp if an update is available
pub fn install_update() -> Result<String, String> {
match Update::default()
@@ -65,8 +60,6 @@ pub fn install_update() -> Result<String, String> {
}
}
/// ### get_config_dir
///
/// Get configuration directory
fn get_config_dir() -> Result<PathBuf, String> {
match environment::init_config_dir() {
@@ -80,8 +73,6 @@ fn get_config_dir() -> Result<PathBuf, String> {
}
}
/// ### get_config_client
///
/// Get configuration client
fn get_config_client() -> Option<ConfigClient> {
match get_config_dir() {

View File

@@ -2,16 +2,13 @@
//!
//! Automatic update module. This module is used to upgrade the current version of termscp to the latest available on Github
use self_update::backends::github::Update as GithubUpdater;
pub use self_update::errors::Error as UpdateError;
use self_update::update::Release as UpdRelease;
use self_update::{cargo_crate_version, Status};
use crate::utils::parser::parse_semver;
pub use self_update::errors::Error as UpdateError;
use self_update::{
backends::github::Update as GithubUpdater, cargo_crate_version, update::Release as UpdRelease,
Status,
};
/// ### UpdateStatus
///
/// The status of the update in case of success
#[derive(Debug, Eq, PartialEq)]
pub enum UpdateStatus {
@@ -133,10 +130,10 @@ impl From<UpdRelease> for Release {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn auto_update_default() {
let upd: Update = Update::default();

View File

@@ -3,9 +3,16 @@
//! `bookmarks_client` is the module which provides an API between the Bookmarks module and the system
// Crate
// Ext
use std::fs::OpenOptions;
use std::path::{Path, PathBuf};
use std::string::ToString;
use std::time::SystemTime;
use super::keys::filestorage::FileStorage;
#[cfg(feature = "with-keyring")]
use super::keys::keyringstorage::KeyringStorage;
use super::keys::{filestorage::FileStorage, KeyStorage, KeyStorageError};
use super::keys::{KeyStorage, KeyStorageError};
// Local
use crate::config::{
bookmarks::{Bookmark, UserHosts},
@@ -15,11 +22,6 @@ use crate::filetransfer::FileTransferParams;
use crate::utils::crypto;
use crate::utils::fmt::fmt_time;
use crate::utils::random::random_alphanumeric_with_len;
// Ext
use std::fs::OpenOptions;
use std::path::{Path, PathBuf};
use std::string::ToString;
use std::time::SystemTime;
/// BookmarksClient provides a layer between the host system and the bookmarks module
pub struct BookmarksClient {
@@ -370,15 +372,16 @@ impl BookmarksClient {
#[cfg(not(target_os = "macos"))] // CI/CD blocks
mod tests {
use std::thread::sleep;
use std::time::Duration;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
use super::*;
use crate::filetransfer::params::{AwsS3Params, GenericProtocolParams};
use crate::filetransfer::{FileTransferProtocol, ProtocolParams};
use pretty_assertions::assert_eq;
use std::thread::sleep;
use std::time::Duration;
use tempfile::TempDir;
#[test]
fn test_system_bookmarks_new() {
@@ -395,28 +398,6 @@ mod tests {
assert_eq!(client.recents_size, 16);
}
#[test]
#[cfg(any(
target_os = "linux",
target_os = "freebsd",
target_os = "netbsd",
target_os = "openbsd"
))]
fn test_system_bookmarks_new_err() {
assert!(BookmarksClient::new(
Path::new("/tmp/oifoif/omar"),
Path::new("/tmp/efnnu/omar"),
16
)
.is_err());
let tmp_dir: tempfile::TempDir = TempDir::new().ok().unwrap();
let (cfg_path, _): (PathBuf, PathBuf) = get_paths(tmp_dir.path());
assert!(
BookmarksClient::new(cfg_path.as_path(), Path::new("/tmp/efnnu/omar"), 16).is_err()
);
}
#[test]
fn test_system_bookmarks_new_from_existing() {
@@ -730,7 +711,7 @@ mod tests {
// Limit is 2
assert_eq!(client.iter_recents().count(), 2);
// Check that 192.168.1.1 has been removed
let key: String = client.iter_recents().nth(0).unwrap().to_string();
let key: String = client.iter_recents().next().unwrap().to_string();
assert!(matches!(
client
.hosts

View File

@@ -3,12 +3,6 @@
//! `config_client` is the module which provides an API between the Config module and the system
// Locals
use crate::config::{
params::{UserConfig, DEFAULT_NOTIFICATION_TRANSFER_THRESHOLD},
serialization::{deserialize, serialize, SerializerError, SerializerErrorKind},
};
use crate::explorer::GroupDirs;
use crate::filetransfer::FileTransferProtocol;
// Ext
use std::fs::{create_dir, remove_file, File, OpenOptions};
use std::io::Write;
@@ -16,6 +10,11 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;
use std::string::ToString;
use crate::config::params::{UserConfig, DEFAULT_NOTIFICATION_TRANSFER_THRESHOLD};
use crate::config::serialization::{deserialize, serialize, SerializerError, SerializerErrorKind};
use crate::explorer::GroupDirs;
use crate::filetransfer::FileTransferProtocol;
// Types
pub type SshHost = (String, String, PathBuf); // 0: host, 1: username, 2: RSA key path
@@ -414,14 +413,15 @@ impl ConfigClient {
#[cfg(test)]
mod tests {
use super::*;
use crate::config::UserConfig;
use crate::utils::random::random_alphanumeric_with_len;
use std::io::Read;
use pretty_assertions::assert_eq;
use std::io::Read;
use tempfile::TempDir;
use super::*;
use crate::config::params::UserConfig;
use crate::utils::random::random_alphanumeric_with_len;
#[test]
fn test_system_config_new() {
let tmp_dir: TempDir = TempDir::new().ok().unwrap();

View File

@@ -5,10 +5,8 @@
// Ext
use std::path::{Path, PathBuf};
/// ### get_config_dir
///
/// Get termscp configuration directory path.
/// Returns None, if it's not possible to get it
/// Get termscp config directory path and initialize it.
/// Returns None if it's not possible to initialize it
pub fn init_config_dir() -> Result<Option<PathBuf>, String> {
// Get file
#[cfg(not(test))]
@@ -19,27 +17,51 @@ pub fn init_config_dir() -> Result<Option<PathBuf>, String> {
lazy_static! {
static ref CONF_DIR: Option<PathBuf> = Some(std::env::temp_dir());
}
if CONF_DIR.is_some() {
// Get path of bookmarks
let mut p: PathBuf = CONF_DIR.as_ref().unwrap().clone();
// Append termscp dir
p.push("termscp/");
// If directory doesn't exist, create it
if p.exists() {
return Ok(Some(p));
}
// directory doesn't exist; create dir recursively
match std::fs::create_dir_all(p.as_path()) {
Ok(_) => Ok(Some(p)),
Err(err) => Err(err.to_string()),
}
if let Some(dir) = CONF_DIR.as_deref() {
init_dir(dir).map(Option::Some)
} else {
Ok(None)
}
}
/// ### get_bookmarks_paths
///
/// Get termscp cache directory path and initialize it.
/// Returns None if it's not possible to initialize it
pub fn init_cache_dir() -> Result<Option<PathBuf>, String> {
// Get file
#[cfg(not(test))]
lazy_static! {
static ref CACHE_DIR: Option<PathBuf> = dirs::cache_dir();
}
#[cfg(test)]
lazy_static! {
static ref CACHE_DIR: Option<PathBuf> = Some(std::env::temp_dir());
}
if let Some(dir) = CACHE_DIR.as_deref() {
init_dir(dir).map(Option::Some)
} else {
Ok(None)
}
}
/// Init a termscp env dir
fn init_dir(p: &Path) -> Result<PathBuf, String> {
// Get path of bookmarks
let mut p: PathBuf = p.to_path_buf();
// Append termscp dir
p.push("termscp/");
// If directory doesn't exist, create it
if p.exists() {
return Ok(p);
}
// directory doesn't exist; create dir recursively
match std::fs::create_dir_all(p.as_path()) {
Ok(_) => Ok(p),
Err(err) => Err(err.to_string()),
}
}
/// Get paths for bookmarks client
/// Returns: path of bookmarks.toml
pub fn get_bookmarks_paths(config_dir: &Path) -> PathBuf {
@@ -49,8 +71,6 @@ pub fn get_bookmarks_paths(config_dir: &Path) -> PathBuf {
bookmarks_file
}
/// ### get_config_paths
///
/// Returns paths for config client
/// Returns: path of config.toml and path for ssh keys
pub fn get_config_paths(config_dir: &Path) -> (PathBuf, PathBuf) {
@@ -62,17 +82,13 @@ pub fn get_config_paths(config_dir: &Path) -> (PathBuf, PathBuf) {
(bookmarks_file, keys_dir)
}
/// ### get_log_paths
///
/// Returns the path for the supposed log file
pub fn get_log_paths(config_dir: &Path) -> PathBuf {
let mut log_file: PathBuf = PathBuf::from(config_dir);
pub fn get_log_paths(cache_dir: &Path) -> PathBuf {
let mut log_file: PathBuf = PathBuf::from(cache_dir);
log_file.push("termscp.log");
log_file
}
/// ### get_theme_path
///
/// Get paths for theme provider
/// Returns: path of theme.toml
pub fn get_theme_path(config_dir: &Path) -> PathBuf {
@@ -85,12 +101,13 @@ pub fn get_theme_path(config_dir: &Path) -> PathBuf {
#[cfg(test)]
mod tests {
use super::*;
use std::fs::{File, OpenOptions};
use std::io::Write;
use pretty_assertions::assert_eq;
use serial_test::serial;
use std::fs::{File, OpenOptions};
use std::io::Write;
use super::*;
#[test]
#[serial]
@@ -101,6 +118,15 @@ mod tests {
assert!(std::fs::remove_dir_all(conf_dir.as_path()).is_ok());
}
#[test]
#[serial]
fn should_get_cache_dir() {
// Create and get cache_dir
let cache_dir: PathBuf = init_cache_dir().ok().unwrap().unwrap();
// Remove dir
assert!(std::fs::remove_dir_all(cache_dir.as_path()).is_ok());
}
#[test]
#[serial]
fn test_system_environment_get_config_dir_err() {
@@ -148,8 +174,8 @@ mod tests {
#[serial]
fn test_system_environment_get_log_paths() {
assert_eq!(
get_log_paths(Path::new("/home/omar/.config/termscp/")),
PathBuf::from("/home/omar/.config/termscp/termscp.log"),
get_log_paths(Path::new("/home/omar/.cache/termscp/")),
PathBuf::from("/home/omar/.cache/termscp/termscp.log"),
);
}

View File

@@ -3,12 +3,13 @@
//! `filestorage` provides an implementation of the `KeyStorage` trait using a file
// Local
use super::{KeyStorage, KeyStorageError};
// Ext
use std::fs::{OpenOptions, Permissions};
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use super::{KeyStorage, KeyStorageError};
/// File storage is an implementation o the `KeyStorage` which uses a file to store the key
pub struct FileStorage {
dir_path: PathBuf,
@@ -90,10 +91,10 @@ impl KeyStorage for FileStorage {
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_system_keys_filestorage_make_dir() {
let storage: FileStorage = FileStorage::new(Path::new("/tmp/"));
@@ -113,10 +114,7 @@ mod tests {
let app_name: &str = "termscp";
let secret: &str = "Th15-15/My-Супер-Секрет";
// Secret should not exist
assert_eq!(
storage.get_key(app_name).err().unwrap(),
KeyStorageError::NoSuchKey
);
assert!(storage.get_key(app_name).is_err());
// Write secret
assert!(storage.set_key(app_name, secret).is_ok());
// Get secret

View File

@@ -3,10 +3,11 @@
//! `keyringstorage` provides an implementation of the `KeyStorage` trait using the OS keyring
// Local
use super::{KeyStorage, KeyStorageError};
// Ext
use keyring::{Entry as Keyring, Error as KeyringError};
use super::{KeyStorage, KeyStorageError};
/// provides a `KeyStorage` implementation using the keyring crate
pub struct KeyringStorage {
username: String,
@@ -26,24 +27,26 @@ impl KeyStorage for KeyringStorage {
/// The key might be acccess through an identifier, which identifies
/// the key in the storage
fn get_key(&self, storage_id: &str) -> Result<String, KeyStorageError> {
let storage: Keyring = Keyring::new(storage_id, self.username.as_str());
let storage: Keyring = Keyring::new(storage_id, self.username.as_str())?;
match storage.get_password() {
Ok(s) => Ok(s),
Err(e) => match e {
KeyringError::NoEntry => Err(KeyStorageError::NoSuchKey),
KeyringError::PlatformFailure(_)
| KeyringError::NoStorageAccess(_)
| KeyringError::WrongCredentialPlatform => Err(KeyStorageError::ProviderError),
| KeyringError::Invalid(_, _)
| KeyringError::Ambiguous(_) => Err(KeyStorageError::ProviderError),
KeyringError::BadEncoding(_) | KeyringError::TooLong(_, _) => {
Err(KeyStorageError::BadSytax)
}
_ => Err(KeyStorageError::ProviderError),
},
}
}
/// Set the key into the key storage
fn set_key(&self, storage_id: &str, key: &str) -> Result<(), KeyStorageError> {
let storage: Keyring = Keyring::new(storage_id, self.username.as_str());
let storage: Keyring = Keyring::new(storage_id, self.username.as_str())?;
match storage.set_password(key) {
Ok(_) => Ok(()),
Err(_) => Err(KeyStorageError::ProviderError),
@@ -55,7 +58,13 @@ impl KeyStorage for KeyringStorage {
/// Returns whether the key storage is supported on the host system
fn is_supported(&self) -> bool {
let dummy: String = String::from("dummy-service");
let storage: Keyring = Keyring::new(dummy.as_str(), self.username.as_str());
let storage: Keyring = match Keyring::new(dummy.as_str(), self.username.as_str()) {
Ok(s) => s,
Err(e) => {
error!("could not instantiate keyring {e}");
return false;
}
};
// Check what kind of error is returned
match storage.get_password() {
Ok(_) => true,
@@ -67,11 +76,11 @@ impl KeyStorage for KeyringStorage {
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use whoami::username;
use super::*;
#[test]
fn test_system_keys_keyringstorage() {
let username: String = username();
@@ -79,21 +88,18 @@ mod tests {
assert!(storage.is_supported());
let app_name: &str = "termscp-test2";
let secret: &str = "Th15-15/My-Супер-Секрет";
let kring: Keyring = Keyring::new(app_name, username.as_str());
let kring: Keyring = Keyring::new(app_name, username.as_str()).unwrap();
let _ = kring.delete_password();
drop(kring);
// Secret should not exist
assert_eq!(
storage.get_key(app_name).err().unwrap(),
KeyStorageError::NoSuchKey
);
assert!(storage.get_key(app_name).is_err());
// Write secret
assert!(storage.set_key(app_name, secret).is_ok());
// Get secret
assert_eq!(storage.get_key(app_name).ok().unwrap().as_str(), secret);
// Delete the key manually...
let kring: Keyring = Keyring::new(app_name, username.as_str());
let kring: Keyring = Keyring::new(app_name, username.as_str()).unwrap();
assert!(kring.delete_password().is_ok());
}
}

View File

@@ -7,10 +7,12 @@ pub mod filestorage;
#[cfg(feature = "with-keyring")]
pub mod keyringstorage;
// ext
#[cfg(feature = "with-keyring")]
use keyring::Error as KeyringError;
use thiserror::Error;
/// defines the error type for the `KeyStorage`
#[derive(Debug, Error, PartialEq, Eq)]
#[derive(Debug, Error)]
pub enum KeyStorageError {
#[cfg(feature = "with-keyring")]
#[error("Key has a bad syntax")]
@@ -19,6 +21,16 @@ pub enum KeyStorageError {
ProviderError,
#[error("No such key")]
NoSuchKey,
#[cfg(feature = "with-keyring")]
#[error("keyring error: {0}")]
KeyringError(KeyringError),
}
#[cfg(feature = "with-keyring")]
impl From<KeyringError> for KeyStorageError {
fn from(e: KeyringError) -> Self {
Self::KeyringError(e)
}
}
/// this traits provides the methods to communicate and interact with the key storage.
@@ -40,10 +52,10 @@ pub trait KeyStorage {
#[cfg(test)]
mod tests {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn test_system_keys_mod_errors() {
#[cfg(feature = "with-keyring")]

View File

@@ -2,32 +2,27 @@
//!
//! `logging` is the module which initializes the logging system for termscp
// locals
use crate::system::environment::{get_log_paths, init_config_dir};
use crate::utils::file::open_file;
// ext
pub use simplelog::LevelFilter as LogLevel;
use simplelog::{ConfigBuilder, WriteLogger};
use std::fs::File;
use std::path::PathBuf;
/// ### init
///
use super::environment::{get_log_paths, init_cache_dir};
use crate::utils::file::open_file;
/// Initialize logger
pub fn init(level: LogLevel) -> Result<(), String> {
// Init config dir
let config_dir: PathBuf = match init_config_dir() {
// Init cache dir
let cache_dir = match init_cache_dir() {
Ok(Some(p)) => p,
Ok(None) => {
return Err(String::from(
"This system doesn't seem to support CONFIG_DIR",
"This system doesn't seem to support CACHE_DIR",
))
}
Err(err) => return Err(err),
};
let log_file_path: PathBuf = get_log_paths(config_dir.as_path());
let log_file_path = get_log_paths(cache_dir.as_path());
// Open log file
let file: File = open_file(log_file_path.as_path(), true, true, false)
let file = open_file(log_file_path.as_path(), true, true, false)
.map_err(|e| format!("Failed to open file {}: {}", log_file_path.display(), e))?;
// Prepare log config
let config = ConfigBuilder::new().set_time_format_rfc3339().build();

View File

@@ -7,7 +7,7 @@ pub mod auto_update;
pub mod bookmarks_client;
pub mod config_client;
pub mod environment;
pub(self) mod keys;
mod keys;
pub mod logging;
pub mod notifications;
pub mod sshkey_storage;

View File

@@ -3,12 +3,15 @@
//! `SshKeyStorage` is the module which behaves a storage for ssh keys
// Locals
use super::config_client::ConfigClient;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
// Ext
use remotefs_ssh::SshKeyStorage as SshKeyStorageTrait;
use ssh2_config::SshConfig;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use super::config_client::ConfigClient;
use crate::utils::ssh as ssh_utils;
#[derive(Default)]
pub struct SshKeyStorage {
@@ -32,19 +35,6 @@ impl SshKeyStorage {
self.hosts.insert(key, p);
}
/// Parse ssh2 config
fn parse_ssh2_config(path: &str) -> Result<SshConfig, String> {
use std::fs::File;
use std::io::BufReader;
let mut reader = File::open(path)
.map_err(|e| format!("failed to open {path}: {e}"))
.map(BufReader::new)?;
SshConfig::default()
.parse(&mut reader)
.map_err(|e| format!("Failed to parse ssh2 config: {e}"))
}
/// Resolve host via termscp ssh keys storage
fn resolve_host_in_termscp_storage(&self, host: &str, username: &str) -> Option<&Path> {
let key: String = Self::make_mapkey(host, username);
@@ -58,7 +48,7 @@ impl SshKeyStorage {
.query(host)
.identity_file
.as_ref()
.and_then(|x| x.get(0).cloned());
.and_then(|x| x.first().cloned());
key
})
@@ -87,7 +77,7 @@ impl From<&ConfigClient> for SshKeyStorage {
// read ssh2 config
let ssh_config = cfg_client.get_ssh_config().and_then(|x| {
debug!("reading ssh config at {}", x);
Self::parse_ssh2_config(x).ok()
ssh_utils::parse_ssh2_config(x).ok()
});
let mut hosts: HashMap<String, PathBuf> =
HashMap::with_capacity(cfg_client.iter_ssh_keys().count());
@@ -117,13 +107,14 @@ impl From<&ConfigClient> for SshKeyStorage {
#[cfg(test)]
mod tests {
use std::path::Path;
use pretty_assertions::assert_eq;
use super::*;
use crate::system::config_client::ConfigClient;
use crate::utils::test_helpers;
use pretty_assertions::assert_eq;
use std::path::Path;
#[test]
fn test_system_sshkey_storage_new() {
let tmp_dir: tempfile::TempDir = tempfile::TempDir::new().ok().unwrap();

View File

@@ -3,15 +3,14 @@
//! `theme_provider` is the module which provides an API between the theme configuration and the system
// Locals
use crate::config::{
serialization::{deserialize, serialize, SerializerError, SerializerErrorKind},
themes::Theme,
};
// Ext
use std::fs::OpenOptions;
use std::path::{Path, PathBuf};
use std::string::ToString;
use crate::config::serialization::{deserialize, serialize, SerializerError, SerializerErrorKind};
use crate::config::themes::Theme;
/// ThemeProvider provides a high level API to communicate with the termscp theme
pub struct ThemeProvider {
theme: Theme, // Theme loaded
@@ -142,12 +141,12 @@ impl ThemeProvider {
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
use tuirealm::tui::style::Color;
use super::*;
#[test]
fn test_system_theme_provider_new() {
let tmp_dir: tempfile::TempDir = TempDir::new().ok().unwrap();

View File

@@ -2,10 +2,10 @@
//!
//! this module exposes the types to describe a change to sync on the remote file system
use crate::utils::path as path_utils;
use std::path::{Path, PathBuf};
use crate::utils::path as path_utils;
/// Describes an operation on the remote file system to sync
#[derive(Debug, PartialEq, Eq, Clone)]
pub enum FsChange {
@@ -190,10 +190,10 @@ fn remote_relative_path(
#[cfg(test)]
mod test {
use super::*;
use pretty_assertions::assert_eq;
use super::*;
#[test]
fn should_get_remote_relative_path_from_subdir() {
assert_eq!(

View File

@@ -5,19 +5,19 @@
mod change;
// -- export
pub use change::FsChange;
use crate::utils::path as path_utils;
use notify::{
watcher, DebouncedEvent, Error as WatcherError, RecommendedWatcher, RecursiveMode, Watcher,
};
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use std::sync::mpsc::{channel, Receiver, RecvTimeoutError};
use std::time::Duration;
pub use change::FsChange;
use notify::{
watcher, DebouncedEvent, Error as WatcherError, RecommendedWatcher, RecursiveMode, Watcher,
};
use thiserror::Error;
use crate::utils::path as path_utils;
type FsWatcherResult<T> = Result<T, FsWatcherError>;
/// Describes an error returned by the `FsWatcher`
@@ -172,14 +172,13 @@ impl FsWatcher {
#[cfg(test)]
mod test {
use super::*;
#[cfg(target_os = "macos")]
use crate::utils::test_helpers;
use pretty_assertions::assert_eq;
use tempfile::TempDir;
use super::*;
#[cfg(target_os = "macos")]
use crate::utils::test_helpers;
#[test]
fn should_init_fswatcher() {
let watcher = FsWatcher::init(Duration::from_secs(5)).unwrap();
@@ -330,7 +329,7 @@ mod test {
/*
#[test]
#[cfg(target_family = "unix")]
#[cfg(unix)]
fn should_poll_file_moved() {
let mut watcher = FsWatcher::init(Duration::from_millis(100)).unwrap();
let tempdir = TempDir::new().unwrap();

View File

@@ -4,7 +4,9 @@
// Locals
use super::{AuthActivity, FileTransferParams};
use crate::filetransfer::params::{AwsS3Params, GenericProtocolParams, ProtocolParams};
use crate::filetransfer::params::{
AwsS3Params, GenericProtocolParams, ProtocolParams, SmbParams, WebDAVProtocolParams,
};
impl AuthActivity {
/// Delete bookmark
@@ -150,13 +152,21 @@ impl AuthActivity {
self.mount_protocol(bookmark.protocol);
self.mount_remote_directory(
bookmark
.entry_directory
.remote_path
.map(|x| x.to_string_lossy().to_string())
.unwrap_or_default(),
);
self.mount_local_directory(
bookmark
.local_path
.map(|x| x.to_string_lossy().to_string())
.unwrap_or_default(),
);
match bookmark.params {
ProtocolParams::AwsS3(params) => self.load_bookmark_s3_into_gui(params),
ProtocolParams::Generic(params) => self.load_bookmark_generic_into_gui(params),
ProtocolParams::Smb(params) => self.load_bookmark_smb_into_gui(params),
ProtocolParams::WebDAV(params) => self.load_bookmark_webdav_into_gui(params),
}
}
@@ -178,4 +188,21 @@ impl AuthActivity {
self.mount_s3_session_token(params.session_token.as_deref().unwrap_or(""));
self.mount_s3_new_path_style(params.new_path_style);
}
fn load_bookmark_smb_into_gui(&mut self, params: SmbParams) {
self.mount_address(params.address.as_str());
#[cfg(unix)]
self.mount_port(params.port);
self.mount_username(params.username.as_deref().unwrap_or(""));
self.mount_password(params.password.as_deref().unwrap_or(""));
self.mount_smb_share(&params.share);
#[cfg(unix)]
self.mount_smb_workgroup(params.workgroup.as_deref().unwrap_or(""));
}
fn load_bookmark_webdav_into_gui(&mut self, params: WebDAVProtocolParams) {
self.mount_webdav_uri(&params.uri);
self.mount_username(&params.username);
self.mount_password(&params.password);
}
}

View File

@@ -2,14 +2,14 @@
//!
//! auth activity bookmarks components
use super::{FormMsg, Msg, UiMsg};
use tui_realm_stdlib::{Input, List, Radio};
use tuirealm::command::{Cmd, CmdResult, Direction, Position};
use tuirealm::event::{Key, KeyEvent, KeyModifiers};
use tuirealm::props::{Alignment, BorderSides, BorderType, Borders, Color, InputType, TextSpan};
use tuirealm::{Component, Event, MockComponent, NoUserEvent, State, StateValue};
use super::{FormMsg, Msg, UiMsg};
// -- bookmark list
#[derive(MockComponent)]

View File

@@ -2,14 +2,18 @@
//!
//! auth activity components for file transfer params form
use super::{FileTransferProtocol, FormMsg, Msg, UiMsg};
use tui_realm_stdlib::{Input, Radio};
use tuirealm::command::{Cmd, CmdResult, Direction, Position};
use tuirealm::event::{Key, KeyEvent, KeyModifiers};
use tuirealm::props::{Alignment, BorderType, Borders, Color, InputType, Style};
use tuirealm::{Component, Event, MockComponent, NoUserEvent, State, StateValue};
use super::{FileTransferProtocol, FormMsg, Msg, UiMsg};
use crate::ui::activities::auth::{
RADIO_PROTOCOL_FTP, RADIO_PROTOCOL_FTPS, RADIO_PROTOCOL_S3, RADIO_PROTOCOL_SCP,
RADIO_PROTOCOL_SFTP, RADIO_PROTOCOL_SMB, RADIO_PROTOCOL_WEBDAV,
};
// -- protocol
#[derive(MockComponent)]
@@ -26,7 +30,11 @@ impl ProtocolRadio {
.color(color)
.modifiers(BorderType::Rounded),
)
.choices(&["SFTP", "SCP", "FTP", "FTPS", "S3"])
.choices(if cfg!(smb) {
&["SFTP", "SCP", "FTP", "FTPS", "S3", "WebDAV", "SMB"]
} else {
&["SFTP", "SCP", "FTP", "FTPS", "S3", "WebDAV"]
})
.foreground(color)
.rewind(true)
.title("Protocol", Alignment::Left)
@@ -37,10 +45,12 @@ impl ProtocolRadio {
/// Convert radio index for protocol into a `FileTransferProtocol`
fn protocol_opt_to_enum(protocol: usize) -> FileTransferProtocol {
match protocol {
1 => FileTransferProtocol::Scp,
2 => FileTransferProtocol::Ftp(false),
3 => FileTransferProtocol::Ftp(true),
4 => FileTransferProtocol::AwsS3,
RADIO_PROTOCOL_SCP => FileTransferProtocol::Scp,
RADIO_PROTOCOL_FTP => FileTransferProtocol::Ftp(false),
RADIO_PROTOCOL_FTPS => FileTransferProtocol::Ftp(true),
RADIO_PROTOCOL_S3 => FileTransferProtocol::AwsS3,
RADIO_PROTOCOL_SMB => FileTransferProtocol::Smb,
RADIO_PROTOCOL_WEBDAV => FileTransferProtocol::WebDAV,
_ => FileTransferProtocol::Sftp,
}
}
@@ -48,11 +58,13 @@ impl ProtocolRadio {
/// Convert `FileTransferProtocol` enum into radio group index
fn protocol_enum_to_opt(protocol: FileTransferProtocol) -> usize {
match protocol {
FileTransferProtocol::Sftp => 0,
FileTransferProtocol::Scp => 1,
FileTransferProtocol::Ftp(false) => 2,
FileTransferProtocol::Ftp(true) => 3,
FileTransferProtocol::AwsS3 => 4,
FileTransferProtocol::Sftp => RADIO_PROTOCOL_SFTP,
FileTransferProtocol::Scp => RADIO_PROTOCOL_SCP,
FileTransferProtocol::Ftp(false) => RADIO_PROTOCOL_FTP,
FileTransferProtocol::Ftp(true) => RADIO_PROTOCOL_FTPS,
FileTransferProtocol::AwsS3 => RADIO_PROTOCOL_S3,
FileTransferProtocol::Smb => RADIO_PROTOCOL_SMB,
FileTransferProtocol::WebDAV => RADIO_PROTOCOL_WEBDAV,
}
}
}
@@ -107,7 +119,7 @@ impl InputRemoteDirectory {
)
.foreground(color)
.placeholder("/home/foo", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Default remote directory", Alignment::Left)
.title("Default remote working directory", Alignment::Left)
.input_type(InputType::Text)
.value(remote_dir),
}
@@ -125,6 +137,42 @@ impl Component<Msg, NoUserEvent> for InputRemoteDirectory {
}
}
// -- remote directory
#[derive(MockComponent)]
pub struct InputLocalDirectory {
component: Input,
}
impl InputLocalDirectory {
pub fn new(local_dir: &str, color: Color) -> Self {
Self {
component: Input::default()
.borders(
Borders::default()
.color(color)
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder("/home/foo", Style::default().fg(Color::Rgb(128, 128, 128)))
.title("Default local working directory", Alignment::Left)
.input_type(InputType::Text)
.value(local_dir),
}
}
}
impl Component<Msg, NoUserEvent> for InputLocalDirectory {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
handle_input_ev(
self,
ev,
Msg::Ui(UiMsg::LocalDirectoryBlurDown),
Msg::Ui(UiMsg::LocalDirectoryBlurUp),
)
}
}
// -- address
#[derive(MockComponent)]
@@ -673,3 +721,109 @@ fn handle_input_ev(
_ => None,
}
}
#[derive(MockComponent)]
pub struct InputSmbShare {
component: Input,
}
impl InputSmbShare {
pub fn new(host: &str, color: Color) -> Self {
Self {
component: Input::default()
.borders(
Borders::default()
.color(color)
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Share", Alignment::Left)
.input_type(InputType::Text)
.value(host),
}
}
}
impl Component<Msg, NoUserEvent> for InputSmbShare {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
handle_input_ev(
self,
ev,
Msg::Ui(UiMsg::SmbShareBlurDown),
Msg::Ui(UiMsg::SmbShareBlurUp),
)
}
}
#[cfg(unix)]
#[derive(MockComponent)]
pub struct InputSmbWorkgroup {
component: Input,
}
#[cfg(unix)]
impl InputSmbWorkgroup {
pub fn new(host: &str, color: Color) -> Self {
Self {
component: Input::default()
.borders(
Borders::default()
.color(color)
.modifiers(BorderType::Rounded),
)
.foreground(color)
.title("Workgroup", Alignment::Left)
.input_type(InputType::Text)
.value(host),
}
}
}
#[cfg(unix)]
impl Component<Msg, NoUserEvent> for InputSmbWorkgroup {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
handle_input_ev(
self,
ev,
Msg::Ui(UiMsg::SmbWorkgroupDown),
Msg::Ui(UiMsg::SmbWorkgroupUp),
)
}
}
#[derive(MockComponent)]
pub struct InputWebDAVUri {
component: Input,
}
impl InputWebDAVUri {
pub fn new(host: &str, color: Color) -> Self {
Self {
component: Input::default()
.borders(
Borders::default()
.color(color)
.modifiers(BorderType::Rounded),
)
.foreground(color)
.placeholder(
"http://localhost:8080",
Style::default().fg(Color::Rgb(128, 128, 128)),
)
.title("HTTP url", Alignment::Left)
.input_type(InputType::Text)
.value(host),
}
}
}
impl Component<Msg, NoUserEvent> for InputWebDAVUri {
fn on(&mut self, ev: Event<NoUserEvent>) -> Option<Msg> {
handle_input_ev(
self,
ev,
Msg::Ui(UiMsg::WebDAVUriBlurDown),
Msg::Ui(UiMsg::WebDAVUriBlurUp),
)
}
}

View File

@@ -13,17 +13,19 @@ pub use bookmarks::{
BookmarkName, BookmarkSavePassword, BookmarksList, DeleteBookmarkPopup, DeleteRecentPopup,
RecentsList,
};
#[cfg(unix)]
pub use form::InputSmbWorkgroup;
pub use form::{
InputAddress, InputPassword, InputPort, InputRemoteDirectory, InputS3AccessKey, InputS3Bucket,
InputS3Endpoint, InputS3Profile, InputS3Region, InputS3SecretAccessKey, InputS3SecurityToken,
InputS3SessionToken, InputUsername, ProtocolRadio, RadioS3NewPathStyle,
InputAddress, InputLocalDirectory, InputPassword, InputPort, InputRemoteDirectory,
InputS3AccessKey, InputS3Bucket, InputS3Endpoint, InputS3Profile, InputS3Region,
InputS3SecretAccessKey, InputS3SecurityToken, InputS3SessionToken, InputSmbShare,
InputUsername, InputWebDAVUri, ProtocolRadio, RadioS3NewPathStyle,
};
pub use popup::{
ErrorPopup, InfoPopup, InstallUpdatePopup, Keybindings, QuitPopup, ReleaseNotes, WaitPopup,
WindowSizeError,
};
pub use text::{HelpFooter, NewVersionDisclaimer, Subtitle, Title};
use tui_realm_stdlib::Phantom;
use tuirealm::event::{Event, Key, KeyEvent, KeyModifiers, NoUserEvent};
use tuirealm::{Component, MockComponent};

View File

@@ -2,14 +2,14 @@
//!
//! auth activity popups
use super::{FormMsg, Msg, UiMsg};
use tui_realm_stdlib::{List, Paragraph, Radio, Textarea};
use tuirealm::command::{Cmd, CmdResult, Direction, Position};
use tuirealm::event::{Key, KeyEvent, KeyModifiers};
use tuirealm::props::{Alignment, BorderType, Borders, Color, TableBuilder, TextSpan};
use tuirealm::{Component, Event, MockComponent, NoUserEvent, State, StateValue};
use super::{FormMsg, Msg, UiMsg};
// -- error popup
#[derive(MockComponent)]

View File

@@ -2,12 +2,12 @@
//!
//! auth activity texts
use super::Msg;
use tui_realm_stdlib::{Label, Span};
use tuirealm::props::{Color, TextModifiers, TextSpan};
use tuirealm::{Component, Event, MockComponent, NoUserEvent};
use super::Msg;
// -- Title
#[derive(MockComponent)]

View File

@@ -14,6 +14,8 @@ impl AuthActivity {
FileTransferProtocol::Sftp | FileTransferProtocol::Scp => 22,
FileTransferProtocol::Ftp(_) => 21,
FileTransferProtocol::AwsS3 => 22, // Doesn't matter, since not used
FileTransferProtocol::Smb => 445,
FileTransferProtocol::WebDAV => 80, // Doesn't matter, since not used
}
}
@@ -36,7 +38,11 @@ impl AuthActivity {
pub(super) fn collect_host_params(&self) -> Result<FileTransferParams, &'static str> {
match self.protocol {
FileTransferProtocol::AwsS3 => self.collect_s3_host_params(),
protocol => self.collect_generic_host_params(protocol),
FileTransferProtocol::Smb => self.collect_smb_host_params(),
FileTransferProtocol::Ftp(_)
| FileTransferProtocol::Scp
| FileTransferProtocol::Sftp => self.collect_generic_host_params(self.protocol),
FileTransferProtocol::WebDAV => self.collect_webdav_host_params(),
}
}
@@ -55,7 +61,8 @@ impl AuthActivity {
Ok(FileTransferParams {
protocol,
params: ProtocolParams::Generic(params),
entry_directory: self.get_input_remote_directory(),
local_path: self.get_input_local_directory(),
remote_path: self.get_input_remote_directory(),
})
}
@@ -68,7 +75,41 @@ impl AuthActivity {
Ok(FileTransferParams {
protocol: FileTransferProtocol::AwsS3,
params: ProtocolParams::AwsS3(params),
entry_directory: self.get_input_remote_directory(),
local_path: self.get_input_local_directory(),
remote_path: self.get_input_remote_directory(),
})
}
pub(super) fn collect_smb_host_params(&self) -> Result<FileTransferParams, &'static str> {
let params = self.get_smb_params_input();
if params.address.is_empty() {
return Err("Invalid address");
}
#[cfg(unix)]
if params.port == 0 {
return Err("Invalid port");
}
if params.share.is_empty() {
return Err("Invalid share");
}
Ok(FileTransferParams {
protocol: FileTransferProtocol::Smb,
params: ProtocolParams::Smb(params),
local_path: self.get_input_local_directory(),
remote_path: self.get_input_remote_directory(),
})
}
pub(super) fn collect_webdav_host_params(&self) -> Result<FileTransferParams, &'static str> {
let params = self.get_webdav_params_input();
if params.uri.is_empty() {
return Err("Invalid URI");
}
Ok(FileTransferParams {
protocol: FileTransferProtocol::WebDAV,
params: ProtocolParams::WebDAV(params),
local_path: self.get_input_local_directory(),
remote_path: self.get_input_remote_directory(),
})
}

View File

@@ -10,16 +10,27 @@ mod update;
mod view;
// locals
// Includes
use std::time::Duration;
use tuirealm::application::PollStrategy;
use tuirealm::listener::EventListenerCfg;
use tuirealm::{Application, NoUserEvent, Update};
use super::{Activity, Context, ExitReason};
use crate::config::themes::Theme;
use crate::filetransfer::{FileTransferParams, FileTransferProtocol};
use crate::system::bookmarks_client::BookmarksClient;
use crate::system::config_client::ConfigClient;
// Includes
use std::time::Duration;
use tuirealm::listener::EventListenerCfg;
use tuirealm::{application::PollStrategy, Application, NoUserEvent, Update};
// radio
const RADIO_PROTOCOL_SFTP: usize = 0;
const RADIO_PROTOCOL_SCP: usize = 1;
const RADIO_PROTOCOL_FTP: usize = 2;
const RADIO_PROTOCOL_FTPS: usize = 3;
const RADIO_PROTOCOL_S3: usize = 4;
const RADIO_PROTOCOL_WEBDAV: usize = 5;
const RADIO_PROTOCOL_SMB: usize = 6;
// -- components
#[derive(Debug, Eq, PartialEq, Clone, Hash)]
@@ -36,6 +47,7 @@ pub enum Id {
InfoPopup,
InstallUpdatePopup,
Keybindings,
LocalDirectory,
NewVersionChangelog,
NewVersionDisclaimer,
Password,
@@ -53,10 +65,14 @@ pub enum Id {
S3SecretAccessKey,
S3SecurityToken,
S3SessionToken,
SmbShare,
#[cfg(unix)]
SmbWorkgroup,
Subtitle,
Title,
Username,
WaitPopup,
WebDAVUri,
WindowSizeError,
}
@@ -95,6 +111,8 @@ pub enum UiMsg {
CloseKeybindingsPopup,
CloseQuitPopup,
CloseSaveBookmark,
LocalDirectoryBlurDown,
LocalDirectoryBlurUp,
ParamsFormBlur,
PasswordBlurDown,
PasswordBlurUp,
@@ -123,6 +141,12 @@ pub enum UiMsg {
S3SecurityTokenBlurUp,
S3SessionTokenBlurDown,
S3SessionTokenBlurUp,
SmbShareBlurDown,
SmbShareBlurUp,
#[cfg(unix)]
SmbWorkgroupDown,
#[cfg(unix)]
SmbWorkgroupUp,
BookmarkNameBlur,
SaveBookmarkPasswordBlur,
ShowDeleteBookmarkPopup,
@@ -133,6 +157,8 @@ pub enum UiMsg {
ShowSaveBookmarkPopup,
UsernameBlurDown,
UsernameBlurUp,
WebDAVUriBlurDown,
WebDAVUriBlurUp,
WindowResized,
}
@@ -141,14 +167,14 @@ pub enum UiMsg {
enum InputMask {
Generic,
AwsS3,
Smb,
WebDAV,
}
// Store keys
const STORE_KEY_LATEST_VERSION: &str = "AUTH_LATEST_VERSION";
const STORE_KEY_RELEASE_NOTES: &str = "AUTH_RELEASE_NOTES";
/// ### AuthActivity
///
/// AuthActivity is the data holder for the authentication activity
pub struct AuthActivity {
app: Application<Id, Msg, NoUserEvent>,
@@ -218,6 +244,8 @@ impl AuthActivity {
FileTransferProtocol::Ftp(_)
| FileTransferProtocol::Scp
| FileTransferProtocol::Sftp => InputMask::Generic,
FileTransferProtocol::Smb => InputMask::Smb,
FileTransferProtocol::WebDAV => InputMask::WebDAV,
}
}
}

Some files were not shown because too many files have changed in this diff Show More