krz/skunky-art

Alternative privacy frontend for DeviantArt.

clone: git clone https://gitbay.org/krz/skunky-art.git

v1.3.5: main.go · raw

 1package main
 2
 3import (
 4	"skunkyart/app"
 5	"skunkyart/static"
 6	"time"
 7
 8	"github.com/zerolabsco/devianter"
 9)
10
11func main() {
12	app.Release.Version = "1.3.2"
13	app.Release.Description = "Two API endpoints and template embedding into binary"
14
15	app.ExecuteCommandLineArguments()
16	app.ExecuteConfig()
17	static.CopyTemplatesToMemory()
18
19	// Rate/concurrency-limit + time-out outbound DeviantArt requests so bot floods
20	// can't exhaust the process or get our egress IP banned by CloudFront/WAF.
21	app.InstallDAThrottle()
22
23	// Only once the config is loaded and the throttle installed: this fetches over
24	// the network, so starting it earlier both raced ExecuteConfig's writes to CFG
25	// and let the request escape the throttle and the configured User-Agent.
26	go app.RefreshInstances()
27
28	go func() {
29		for {
30			err := devianter.UpdateCSRF()
31			if err != nil {
32				println(err.Error())
33			}
34			time.Sleep(12 * time.Hour)
35		}
36	}()
37
38	app.Router()
39}