Skip to content

Personal website navigation. | 个人网站导航。

License

Notifications You must be signed in to change notification settings

dragonish/slender-go

Repository files navigation

slender-go

English 👈(゚ヮ゚👈) | 简体中文

Personal website navigation.

Preview

desktop

mobile

Feature

  • Allow defining access password and admin password.
  • Support dynamic link function.
  • Support privacy mode function.
  • Support searching for bookmark items within the homepage.
  • Built-in MaterialDesign and simple-icons icons, and allows custom or upload icons.
  • Allows custom web search engines.
  • Allows to custom the code in the home footer element.
  • Optional folder sidebar.
  • Optional display of latest bookmarks and hot bookmarks.

Installation

Docker deployment

Pull image:

docker pull giterhub/slender:latest

Create the compose.yaml file and run:

docker compose up -d

Support defining environment variables or service configuration or adding startup commands.

Local compile

Install git and Go locally and run:

# Clone project code
git clone https://github.com/dragonish/slender-go.git

# Enter project directory
cd slender-go

# At the first time or update version
./download.sh

# Run
CGO_ENABLED=1 go run main.go

Support defining environment variables or service configuration or adding startup commands.

Environment variables

Name Type Default Description
SLENDER_ACCESS_PWD string "" Access password
SLENDER_ADMIN_PWD string "" Admin password
SLENDER_LOG_LEVEL string Info Log output level. Optional: Debug, Info, Warn, Error
SLENDER_PORT int 8080 Web service running port
SLENDER_TOKEN_AGE int 30 Token age (days)
SLENDER_PERFORMANCE_MODE string 0 Enable performance mode when a truthy value (1, yes, true, on). It is recommended to enable only when the database update performance is bad
SLENDER_SERVICE_CONFIG string ./slender.yaml Specify service config file path

Service configuration

Service configuration take precedence over environment variables.

The service configuration file can be defined as a YAML or JSON format file.

YAML format

By default, the program reads slender.yaml in the program directory as the service configuration file (if it exists). If you need to use a service configuration file located elsewhere, specify its file path either by environment variables or adding startup commands.

Each field in the file is optional. The file can declare fields as follows:

access_password: string # Access password
admin_password: string # Admin password
log_level: Debug|Info|Warn|Error # Log output level
port: number # Web service running port
token_age: number # Token age (days)
performance_mode: true # Performance mode. It is recommended to enable only when the database update performance is bad

JSON format

If you want to use a service configuration file in JSON format, specify its file path either by environment variables or adding startup commands.

Each field in the file is optional. The file can declare fields as follows:

{
  "accessPassword": "string", // Access password
  "adminPassword": "string", // Admin password
  "logLevel": "Debug|Info|Warn|Error", // Log output level
  "port": 8080, // Web service running port
  "tokenAge": 30, // Token age (days)
  "performanceMode": true, // Performance mode. It is recommended to enable only when the database update performance is bad
}

Startup commands

Startup commands take precedence over service configuration and environment variables.

Name Type Description
--debug, -D Enable debug mode
--version, -v Show application version
--help, -h Show help document
--performance, -P Enable performance mode. It is recommended to enable only when the database update performance is bad
--config, -c string Specify service config file path
--access_pwd, -a string Specify access password
--admin_pwd, -d string Specify admin password
--token_age, -t int Specify token age (days)
--log, -l string Specify log output level. Optional: Debug, Info, Warn, Error
--port, -p int Specify web service running port

Access password

Used to access the homepage. If not defined, it can be accessed directly by default.

Admin password

Used to access backend management and enter privacy mode.

If no admin password is set, it defaults to the access password(non-empty) or p@$$w0rd.

Dynamic link

Convert dynamic links and display them according to the network environment.

Suppose the homepage address of the Slender service is https://192.168.0.1:8080/, the following available parameters and their corresponding results:

parameter result
host 192.168.0.1:8080
hostname 192.168.0.1
href https://192.168.0.1:8080/
origin https://192.168.0.1:8080
pathname /
port 8080
protocol https:

Example

If a bookmark URL is configured as https://{hostname}:8888/test:

  • When the homepage of the Slender service is https://192.168.0.1:8080/, it appears as https://192.168.0.1:8888/test.
  • When the homepage of the Slender service is https://172.17.0.1:8080/, it appears as https://172.17.0.1:8888/test.
  • When the homepage of the Slender service is https://link.example.com/, it appears as https://link.example.com:8888/test.

Credits

License

GPL-3.0 license