From ffe8d01b064f4e67ebde34e6bd4b170d5ea8377e Mon Sep 17 00:00:00 2001 From: adro Date: Fri, 18 Feb 2022 15:34:33 +0100 Subject: [PATCH] Better readme, proper gomod --- .gitignore | 1 + README.md | 15 ++++++++++++--- go.mod | 2 +- main.go | 5 +++-- web/web.go | 5 +++-- 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index 82299f4..0e7c768 100644 --- a/.gitignore +++ b/.gitignore @@ -23,5 +23,6 @@ go.work # Custom config.toml +miniwol !example/** diff --git a/README.md b/README.md index 9904811..659b896 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,20 @@ Small web server to send Wake-on-LAN requests to its local network - Fully static frontend without JS - Binary includes everything except config +## Installation +Option 1: Run `go build` in this folder after cloning, resulting in a binary `miniwol` in the current directory. + +Option 2: Run `go get git.ulra.eu/adro/miniwol`, resulting in a binary in TODO. + +Put the resulting binary in a place like `/usr/bin/miniwol` if you wish to run it like any command, + ## Usage -Add an empty config, the program checks for `./config.toml`, `./config/config.toml` and `/etc/miniwol/config.toml`. Make sure miniwol can write to it. +Add an empty config, the program checks, in order of priority, for `./config.toml`, `./config/config.toml` and `/etc/miniwol/config.toml`. Make sure miniwol can write to it. Set a password and write its hash to the config using `miniwol setpass `. This will also add the other default fields to the config. -Configure the devices you want to be able to wake up as per the [example](./example/config.toml) +Configure the devices you want to be able to wake up as per the [example](./example/config.toml). -Now you can run the webserver using `miniwol` or `miniwol web` +Now you can run the webserver using `miniwol` or `miniwol web` . + +Sessions are simply stored in memory. In case you need to, you can clear all sessions by just restarting the webserver. diff --git a/go.mod b/go.mod index dc8a81b..99c2809 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module miniwol +module git.ulra.eu/adro/miniwol go 1.17 diff --git a/main.go b/main.go index 57a6810..36400e0 100644 --- a/main.go +++ b/main.go @@ -3,10 +3,11 @@ package main import ( "fmt" "log" - "miniwol/config" - "miniwol/web" "os" + "git.ulra.eu/adro/miniwol/config" + "git.ulra.eu/adro/miniwol/web" + "golang.org/x/crypto/bcrypt" ) diff --git a/web/web.go b/web/web.go index b21d1b1..98dd087 100644 --- a/web/web.go +++ b/web/web.go @@ -6,12 +6,13 @@ import ( "errors" "fmt" "html/template" - "miniwol/config" - "miniwol/lib" "net/http" "strings" "time" + "git.ulra.eu/adro/miniwol/config" + "git.ulra.eu/adro/miniwol/lib" + "github.com/google/uuid" "github.com/labstack/echo/v4" "golang.org/x/crypto/bcrypt"