Add simpledash config

This commit is contained in:
2021-04-02 16:00:48 -07:00
parent 19d8a85841
commit 80e342af6a
83 changed files with 9059 additions and 1831 deletions

View File

@@ -15,10 +15,10 @@ draft: false
{{< button-gitea project="opensend" text="Opensend" owner="opensend" color="green" >}}
{{< button-gitlab project="opensend" text="Opensend" color="OrangeRed" >}}
- Statusboard: A full-stack web application that tracks website status written in Swift, Swift Crypto, and the Vapor stack. It uses a tabler web UI for the dashboard, a JSON config to define servers to track, and an SQLite database to keep track of log-ins and show private servers. My instance can be found [here](https://status.arsenm.dev)
- Simpledash: A full-stack web application to act as a dashboard for important links and information. It is written mostly in go, other than the SQLite driver for session storage. It is configured via a TOML file called `simpledash.toml`. Passwords are stored as bcrypt hashes.
{{< button-gitea project="statusboard" text="Statusboard" color="green" >}}
{{< button-gitlab project="statusboard" text="Statusboard" color="OrangeRed" >}}
{{< button-gitea project="simpledash" text="Simpledash" color="green" >}}
{{< button-gitlab project="" text="Simpledash (WIP)" color="OrangeRed" >}}
- Chromebook Linux Audio: A collection of bash scripts to compile and install the required kernel and audio server to enable audio and other chromebook features in a mainline linux distro.

View File

@@ -0,0 +1,8 @@
---
title: "Orchestra Docs"
draft: true
description: "Documentation for Orchestra, a very simple orchestrator"
menu:
docs:
parent: "docs"
---

View File

@@ -0,0 +1,8 @@
---
title: "Simpledash Docs"
draft: false
description: "Documentation for Simpledash, a simple and fast web dashboard"
menu:
docs:
parent: "docs"
---

View File

@@ -0,0 +1,144 @@
---
title: "Configuration"
draft: false
description: "Configuring simpledash"
---
## Flags
Simpledash can be run using the simpledash binary directly, or for convenience, using `advmake run`.
If using the binary directly, the listen IP, port, etc. can be configured via flags.
This is the help screen of simpledash:
```text
Usage of ./simpledash:
-a, --addr ip Bind address for HTTP server (default 0.0.0.0)
-c, --config string TOML config file (default "simpledash.toml")
--hash string Generate new bcrypt password hash
-p, --port int Bind port for HTTP server (default 8080)
simpledash: help requested
```
The default address of simpledash is `0.0.0.0:8080` meaning any origin IP on any interface, port 8080.
The `--hash` option creates a suitable bcrypt password hash for use in the config, prints it, and exits.
## Config file
Simpledash is configured using a TOML configuration file (simpledash.toml by default). It contains the users, cards, etc.
An example file is provided in the simpledash repository. It contains examples of all the card types in simpledash.
This is the example:
```toml
title = "SimpleDash"
theme = "dark"
loginRequired = false
allowProxy = ["https://www.metaweather.com/", "https://ifconfig.co/json"]
[session]
name = "simpledash-session"
[users]
[[users._public_.card]]
type = "weather"
title = "Weather"
data = {"woeid" = "2442047"}
[[users._public_.card]]
type = "api"
title = "Server IP (API card example)"
url = "https://ifconfig.co/json"
data = {"format" = """
<p class="subtitle">${data.ip}</p>
Country: ${data.country} (${data.country_iso})
Time zone: ${data.time_zone}
"""}
[users.admin]
passwordHash = "$2a$10$w00dzQ1PP6nwXLhuzV2pFOUU6m8bcZXtDX3UVxpOYq3fTSwVMqPge"
showPublic = true
[[users.admin.card]]
type = "status"
title = "Google"
icon = "ion:logo-google"
desc = "Google search engine. Status card example."
url = "https://www.google.com"
[[users.admin.card]]
type = "simple"
title = "Gmail"
icon = "simple-icons:gmail"
desc = "Gmail mail client. Simple card example"
url = "https://mail.google.com/"
[[users.admin.card]]
type = "collection"
title = "Programming"
icon = "entypo:code"
[users.admin.card.data]
Godoc = {"url" = "https://pkg.go.dev", "target" = "newTab"}
Ruby-Doc = {"url" = "https://ruby-doc.org/", "target" = "sameTab"}
[[users.admin.card]]
type = "collection"
title = "Science"
icon = "ic:outline-science"
data = {"Google Scholar" = {"url" = "https://scholar.google.com/", "target" = "sameTab"}}
```
### Title
The title field sets the name of the website which will be used in all mentions including title tags and headers.
### Theme
The theme can either be dark or light. The dark theme was generated using darkreader.
### LoginRequired
The loginRequired field denotes whether login is required to view the dashboard. If `false`, public cards will be viewable without logging in.
### Session
The session section contains one field, `name`. This field is the name of the session cookie set in the browser upon visiting simpledash.
### Users
The `users` section contains all users and their associated cards. A user can be defined like so:
```toml
[users.admin]
passwordHash = "$2a$10$w00dzQ1PP6nwXLhuzV2pFOUU6m8bcZXtDX3UVxpOYq3fTSwVMqPge"
showPublic = true
```
The `passwordHash` field contains a hash as created by the `--hash` flag.
The `showPublic` field is a boolean denoting whether to show public cards as well when logged in.
### Cards
Cards reside under their respective user in the config file. A card can be defined like so:
```toml
[[users.admin.card]]
type = "status"
title = "Google"
icon = "ion:logo-google"
desc = "Google search engine. Status card example."
url = "https://www.google.com"
```
The cards contain various fields, some required, some not:
- `type`: The type of the card. (required)
- `title`: The title of the card to be used in the header. (required)
- `icon`: The icon to be used in various places depending on the card. Icons can be anything from [iconify](https://iconify.design).
- `desc`: The description of the card's content.
- `url`: The URL of the card to be used for various purposes depending on the card.
- `data`: A dictionary containing any extra data not listed above.
Card types can be added simply by adding a file to `resources/templates/cards`. The name of the file will be used as the name of the card type

View File

@@ -0,0 +1,40 @@
---
title: "Installation"
draft: false
description: "Installing simpledash"
---
## Building from source
### Prerequisites
Simpledash utilizes an SQLite database for session storage. That means that sqlite3 must be installed along with its development files to build simpledash. It also means cross-compilation is not as simple as setting some environment variables.
On Debian, the required packages are: `sqlite3` and `sqlite3-dev`.
On Arch, the required package is `sqlite`.
---
### Building
To build simpledash, first, clone the git repository of simpledash. Then, use a terminal to enter the cloned directory and run:
```shell
go build
```
---
### Building with Advmake
Simpledash can be built with another of my projects, `advmake`. Using this also builds the CSS framework used in this project, Bulma.
To build simpledash using advmake, simply run:
```shell
advmake
```
To run via advmake, run:
```shell
advmake run
```