From b84407b2683b55644cce72cac49d9a1668614048 Mon Sep 17 00:00:00 2001 From: VnPower Date: Tue, 6 Jun 2023 09:20:46 +0700 Subject: [PATCH] Feature: port --- README.md | 10 +++++++++- config.example.yml | 5 ++++- configs/config.go | 1 + main.go | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 55b82b0..afdb307 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ A privacy-respecting alternative front-end for Pixiv that doesn't suck ## Installation -Run these commands below, then access the site on [localhost:8080](https://localhost:8080) +Run these commands below. ``` git clone https://codeberg.org/VnPower/pixivfe.git @@ -28,6 +28,14 @@ cp config.example.yml config.yml # config file You will have to add your own `PHPSESSID` in order to run. Go to `config.yml` for more details. +After that, execute the code. + +``` +go run main.go +``` + +By default, if you did not configure the port, the site will run on localhost:8080 + ## Self-host guide WIP diff --git a/config.example.yml b/config.example.yml index 9a923ae..735eac3 100644 --- a/config.example.yml +++ b/config.example.yml @@ -1,11 +1,14 @@ # This is required for the API. See https://github.com/Nandaka/PixivUtil2/wiki#pixiv-login-using-cookie # Please keep this carefully, there is a risk of account theft if somebody got your cookie. # It is better to use a decoy account, instead of using your main account's cookie. -PHPSESSID: +PHPSESSID: XXXXXXXX_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +Port: 8080 UserAgent: Mozilla/5.0 # Number of items in each list page +# This is going to be deprecated PageItems: 30 # Default image proxy server. Recommended since Pixiv doesn't like you accessing images on their server. diff --git a/configs/config.go b/configs/config.go index 2b32623..99a3e46 100644 --- a/configs/config.go +++ b/configs/config.go @@ -11,6 +11,7 @@ var Configs Conf type Conf struct { PHPSESSID string `yaml:"PHPSESSID"` + Port string `yaml:"Port"` UserAgent string `yaml:"UserAgent"` PageItems int `yaml:"PageItems"` ImageProxyServer string `yaml:"ImageProxyServer"` diff --git a/main.go b/main.go index 68035a2..1400f94 100644 --- a/main.go +++ b/main.go @@ -171,5 +171,5 @@ func main() { r := setupRouter() - r.Run(":8080") + r.Run(":" + configs.Configs.Port) }