mirror of
https://github.com/ditatompel/xmr-remote-nodes.git
synced 2025-01-08 05:52:10 +07:00
Compare commits
No commits in common. "3f6920ee65021b4bbd1cb9f4aca8604a867ca1e3" and "76a54a0f295dbe5d25d5178354a68f4b8a581fa3" have entirely different histories.
3f6920ee65
...
76a54a0f29
5 changed files with 2 additions and 67 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
||||||
v0.1.1
|
v0.1.0
|
||||||
|
|
|
@ -12,6 +12,4 @@ func init() {
|
||||||
probersCmd.AddCommand(deleteProbersCmd)
|
probersCmd.AddCommand(deleteProbersCmd)
|
||||||
listProbersCmd.Flags().StringP("sort-by", "s", "last_submit_ts", "Sort by column name, can be id or last_submit_ts")
|
listProbersCmd.Flags().StringP("sort-by", "s", "last_submit_ts", "Sort by column name, can be id or last_submit_ts")
|
||||||
listProbersCmd.Flags().StringP("sort-dir", "d", "desc", "Sort direction, can be asc or desc")
|
listProbersCmd.Flags().StringP("sort-dir", "d", "desc", "Sort direction, can be asc or desc")
|
||||||
cmd.Root.AddCommand(nodeCmd)
|
|
||||||
nodeCmd.AddCommand(deleteNodeCmd)
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
package server
|
|
||||||
|
|
||||||
import (
|
|
||||||
"fmt"
|
|
||||||
"log/slog"
|
|
||||||
"os"
|
|
||||||
"strconv"
|
|
||||||
|
|
||||||
"github.com/ditatompel/xmr-remote-nodes/internal/database"
|
|
||||||
"github.com/ditatompel/xmr-remote-nodes/internal/monero"
|
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
|
||||||
)
|
|
||||||
|
|
||||||
var nodeCmd = &cobra.Command{
|
|
||||||
Use: "node",
|
|
||||||
Short: "[Server] Administer monitored nodes",
|
|
||||||
Long: `Command to administer monitored nodes.
|
|
||||||
|
|
||||||
This command should only be run on the server which directly connect to the MySQL database.
|
|
||||||
`,
|
|
||||||
Run: func(cmd *cobra.Command, _ []string) {
|
|
||||||
if err := cmd.Help(); err != nil {
|
|
||||||
slog.Error(err.Error())
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
var deleteNodeCmd = &cobra.Command{
|
|
||||||
Use: "delete",
|
|
||||||
Short: "Delete node",
|
|
||||||
Long: `Delete node identified by ID.
|
|
||||||
|
|
||||||
This command delete node and it's associated probe logs (if exists).
|
|
||||||
|
|
||||||
To find out the node ID, visit frontend UI or from "/api/v1/nodes" endpoint.
|
|
||||||
`,
|
|
||||||
Run: func(_ *cobra.Command, _ []string) {
|
|
||||||
if err := database.ConnectDB(); err != nil {
|
|
||||||
fmt.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
nodeID, err := strconv.Atoi(stringPrompt("Node ID:"))
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Invalid ID:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
moneroRepo := monero.New()
|
|
||||||
err = moneroRepo.Delete(uint(nodeID))
|
|
||||||
if err != nil {
|
|
||||||
fmt.Println("Failed to delete node:", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Printf("Node ID %d deleted\n", nodeID)
|
|
||||||
},
|
|
||||||
}
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "xmr-nodes-frontend",
|
"name": "xmr-nodes-frontend",
|
||||||
"version": "v0.1.1",
|
"version": "v0.1.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "VITE_API_URL=http://127.0.0.1:18901 vite dev --host 127.0.0.1",
|
"dev": "VITE_API_URL=http://127.0.0.1:18901 vite dev --host 127.0.0.1",
|
||||||
|
|
|
@ -220,10 +220,6 @@ func (r *moneroRepo) Add(protocol string, hostname string, port uint) error {
|
||||||
|
|
||||||
ipAddr = hostIp.String()
|
ipAddr = hostIp.String()
|
||||||
ips = ip.SliceToString(hostIps)
|
ips = ip.SliceToString(hostIps)
|
||||||
} else {
|
|
||||||
if strings.HasPrefix(hostname, "http://") || strings.HasPrefix(hostname, "https://") {
|
|
||||||
return errors.New("Don't start hostname with http:// or https://, just put your hostname")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
row, err := r.db.Query(`
|
row, err := r.db.Query(`
|
||||||
|
|
Loading…
Reference in a new issue