Safe CLI2GUI

As requested I’ve shared the SAFE CLI2GUI on Github. Please note it’s still in process of adding the custom fields. Many buttons that don’t have a text field next to them will work.

The API uses Nodejs to call the CLI using the commands. I believe this will only work on linux because the windows terminal is slightly different.

Requirements are Node & NPM to be installed (so you can do npm install for the node modules and run it).

30 Likes

THank you I ill enjoy exploring this.

9 Likes

From GitHub - DeusNexus/safe-gui: Graphical User Interface for the SafeNetwork CLI

#DEPENDENCIES

-Only for linux (Ubuntu)

-node

-npm

I installed npm and that pulled down a bunch of packages named node-something, but Linux Mint, based on Ubuntu, doesn’t recognize any package named node.

Should the Readme be edited to show the exact command needed for the dependencies on Ubuntu? E.g.

apt-get install npm

2 Likes

I have added Card styling and option to show/hide and additional comment what the command is about.
Most of the text fields inputs are now working and there are also checker boxes for some commands that allow to enable testcoins, or show secret key in response.

Lots of refactoring and making pieces reusable and easier to read. When everything works I will attempt to create a Electron app out of it that can be used cross-platform without needing to install anything additionally!

15 Likes

Take a look at Tauri, it may be much easier than Electron.

1 Like

Wow! This looks really great - hope to be able to try it on next test net. :star_struck:

4 Likes

In progress of updating… Removed some deprecated safe cli commands and have to add/change new ones to make it fully work again.

Basically Auth & Seq are gone and also wondering if --test-coins is still used anywhere with DBC’s?

8 Likes

Ive done some work on safe-telegram which may be transferable to CLI2GUI

3 Likes

That’s great :smiley:

2 Likes

Think to redo this and deprecated the older git repo. It was using Nodejs as backend with react as front-end and nodejs often has vulnerabilities.

Now this simple tool will only use Python and PyQt6 for the GUI. Very little dependencies and should be cross-platform compatible as long as someone has python. The tool will then provide users with default templates which they can optionally edit (for faster interaction with the CLI or to make it easier).

Then executing the build command it will use subprocess to send command to a shell terminal and get response back. subprocess.popen would allow command to be piped in and out as a stream I believe (e.g. if one downloads the latest safe binary for github it could show the output of the subprocess in realtime and not only return a Promise once the whole command is run).

Excuse me for my bad design skills learning how to use Qt just now.

Feel free to share any features you think would be nice to have.
Personally I was thinking of:

  • Create random files (size and count) and test upload speed for the given amounts.
  • Download all files from a container to test download speeds
  • File browser to select individual file to upload (will create command for that file in a given folder)
  • Browse to upload selected folder (recursively upload all files in a selected folder)
  • Dropdown menu with different testnet work urls to select from and switch to.
  • Join as a node and keep simple track of how many chunks are in the folder and total size stored.
  • Sequenced commands: Clean and .safe, download and install latest safe binary and node and switch to given (test) network. Sequence for inspecting a random XOR URL with dog to see if it is a file or not, if it is a file then what filename.extension to use while downloading it with cat xor_url > filename.extension (if size in bytes is known it could be displayed as progress bar downloading).
  • Give ability to edit your own templates and save them, then they can easily be run with small adjustments if needed.
13 Likes

:clap: awesome!

I am on the fence with this one, I know it probably can’t be stopped until payments though.

1 Like

Hmhmm - did you have a look at dash because it creates Web apps it’s cross platform like qt but you could even deploy it at a server and enable random people to interact with it just by visiting a website (which might then raise additional questions from a legal perspective but would be pretty awesome nonetheless)

(and because it integrates seamlessly with Plotly graphs adding some nice charts about statistical data would be super easy there too)

2 Likes

:clap::clap:
One thing that would be great to have is a way to capture from the output the containers/files safe:// addresses, even if just in a list, in order to be able to copy/paste to the forum

8 Likes

Great idea. :clap: I’d forgotten about this. I think that’s a perfect list to help people get started. Later additions could include key generation and NRS and ultimately DBCs but best to start with the simple stuff.

4 Likes

People in this thread might be interested in klask which can auto-generate a GUI form for rust apps that use Clap to parse CLI args (which the safe-cli does).

A nice thing is that it can be generated automatically and thus stay up to date with the latest changes.

A community member could make this for safe-cli, eg by running a cron job, or possibly the maidsafe team could incorporate it into official build process.

8 Likes

Interesting. Seems a bit short of examples and documentation for those who aren’t hardcore developers. How do you actually use it?

1 Like

So for safe-cli, one would clone the safe_network repo, and modify the safe-cli crate a little:

  1. add a new binary target safe-cli-gui
  2. create a main.rs, something like the above that utilizes the clap::App created in iirc src/cli.rs.

something like that. ymmv.

that said, I haven’t personaly used klask. Just saw it discussed the other day and thought it looks pretty neat.

edit: this is a task best suited for someone with basic familiarity with rust development. Once the safe-cli-gui is built and automated, well that’s when non-devs would use it.

for those who aren’t hardcore developers. How do you actually use it?

3 Likes

ChatGPT: Show me how to use safe-cli with klask

To use the `safe-cli` command-line interface (CLI) with `klask`, you will need to have both `safe-cli` and `klask` installed on your system.

Assuming that you have already installed `safe-cli` and `klask`, you can use the `safe` command to interact with `klask` as follows:

1. Open a terminal and navigate to the directory where you want to work with `klask`.
2. Run the `safe auth` command to authenticate with the SAFE Network and obtain a session token:

Copy code

safe auth


3. Run the `safe klask create` command to create a new `klask` instance:

Copy code

safe klask create


This will create a new `klask` instance and return the instance ID, which you can use to interact with the instance.

4. Run the `safe klask get <instance ID>` command to retrieve the current state of the `klask` instance:

Copy code

safe klask get


Replace `<instance ID>` with the instance ID returned by the `safe klask create` command.

5. Run the `safe klask set <instance ID> <key> <value>` command to set a key-value pair in the `klask` instance:

Copy code

safe klask set


Replace `<instance ID>` with the instance ID, `<key>` with the key you want to set, and `<value>` with the value you want to set for the key.

6. Run the `safe klask get <instance ID> <key>` command to retrieve the value for a specific key in the `klask` instance:

Copy code

safe klask get


Replace `<instance ID>` with the instance ID and `<key>` with the key whose value you want to retrieve.

These are just a few examples of the commands you can use with `safe-cli` and `klask`. For more information and a complete list of commands, you can refer to the `safe-cli` documentation.

So we need to let chatGPT know that safe auth is deprecated for starters.
Now Im going to read the rest of this , send feedback about safe auth and see what it comes up with next :slight_smile:

2 Likes


it’s not always right, but it’s not far off, klask is likely too new

1 Like

ChatGPT1.1: Jeez you humans. Questions, questions, questions. You do bore me. Peel me a grape.

2 Likes