Commit e02174cb71

e02174cb710e6d6abd642f03e64ce91bbac38130

parent: 4b3bf2c6a0

Unsigned

lost+skunk <skunky@ebloid.ru> · 2024-07-13 20:55 UTC

Исправление некоторых обосрамсов

Layout: unified · split

README.md +2
@@ -29,6 +29,7 @@ server {
2929
3030 location ((BASE URL)) { # if you have a separate subdomain for the frontend, insert '/' instead of '((BASE URL))'.
3131 proxy_set_header Scheme $scheme;
32 proxy_set_header Host $host;
3233 proxy_http_version 1.1;
3334 proxy_pass http://((IP)):((PORT));
3435 }
@@ -63,6 +64,7 @@ server {
6364
6465 location ((BASE URL)) { # если у вас отдельный поддомен для фронтенда, вместо '((BASE URL))' вставляйте '/'
6566 proxy_set_header Scheme $scheme;
67 proxy_set_header Host $host;
6668 proxy_http_version 1.1;
6769 proxy_pass http://((IP)):((PORT));
6870 }
app/router.go +3 −4
@@ -51,7 +51,6 @@ func Router() {
5151 }
5252
5353 path := parsepath(r.URL.Path)
54
5554 // структура с функциями
5655 var skunky skunkyart
5756 skunky.Writer = w
@@ -77,7 +76,7 @@ func Router() {
7776 default:
7877 skunky.ReturnHTTPError(404)
7978 case "":
80 skunky.ExecuteTemplate("html/index.htm", &CFG.BasePath)
79 skunky.ExecuteTemplate("index.htm", &CFG.BasePath)
8180 case "post":
8281 skunky.Deviation(path[2], path[3])
8382 case "search":
@@ -98,10 +97,10 @@ func Router() {
9897 skunky.About()
9998 case "stylesheet":
10099 w.Header().Add("content-type", "text/css")
101 io.WriteString(w, Templates["css/skunky.css"])
100 io.WriteString(w, Templates["skunky.css"])
102101 }
103102 }
104103
105104 http.HandleFunc("/", handle)
106 http.ListenAndServe(CFG.Listen, nil)
105 try_with_exitstatus(http.ListenAndServe(CFG.Listen, nil), 1)
107106}
app/util.go +3 −4
@@ -112,7 +112,6 @@ func (s skunkyart) DownloadAndSendMedia(subdomain, path string) {
112112 url.WriteString(s.Args.Get("token"))
113113
114114 if CFG.Cache.Enabled {
115 os.Mkdir(CFG.Cache.Path, 0700)
116115 fname := CFG.Cache.Path + "/" + base64.StdEncoding.EncodeToString([]byte(subdomain+path))
117116 file, e := os.Open(fname)
118117
@@ -138,6 +137,7 @@ func (s skunkyart) DownloadAndSendMedia(subdomain, path string) {
138137
139138func InitCacheSystem() {
140139 c := &CFG.Cache
140 os.Mkdir(CFG.Cache.Path, 0700)
141141 for {
142142 dir, e := os.Open(c.Path)
143143 try(e)
@@ -175,10 +175,9 @@ func CopyTemplatesToMemory() {
175175 try_with_exitstatus(e, 1)
176176
177177 for _, x := range dir {
178 n := dirname + "/" + x.Name()
179 file, e := os.ReadFile(n)
178 file, e := os.ReadFile(dirname + "/" + x.Name())
180179 try_with_exitstatus(e, 1)
181 Templates[n] = string(file)
180 Templates[x.Name()] = string(file)
182181 }
183182 }
184183}
app/wrapper.go +5 −5
@@ -216,7 +216,7 @@ func (s skunkyart) GRUser() {
216216 }
217217
218218 if !s.Atom {
219 s.ExecuteTemplate("html/gruser.htm", &s)
219 s.ExecuteTemplate("gruser.htm", &s)
220220 }
221221}
222222
@@ -261,7 +261,7 @@ func (s skunkyart) Deviation(author, postname string) {
261261
262262 post.Comments = s.ParseComments(devianter.CommentsFunc(id, post.Post.Comments.Cursor, s.Page, 1))
263263
264 s.ExecuteTemplate("html/deviantion.htm", &s)
264 s.ExecuteTemplate("deviantion.htm", &s)
265265 } else {
266266 s.ReturnHTTPError(400)
267267 }
@@ -274,7 +274,7 @@ func (s skunkyart) DD() {
274274 More: dd.HasMore,
275275 })
276276 if !s.Atom {
277 s.ExecuteTemplate("html/list.htm", &s)
277 s.ExecuteTemplate("list.htm", &s)
278278 }
279279}
280280
@@ -342,7 +342,7 @@ func (s skunkyart) Search() {
342342 })
343343 }
344344
345 s.ExecuteTemplate("html/search.htm", &s)
345 s.ExecuteTemplate("search.htm", &s)
346346}
347347
348348func (s skunkyart) Emojitar(name string) {
@@ -361,5 +361,5 @@ func (s skunkyart) About() {
361361 s.Templates.About.Nsfw = CFG.Nsfw
362362 s.Templates.About.Proxy = CFG.Proxy
363363 try(json.Unmarshal([]byte(Templates["instances.json"]), &s.Templates.About))
364 s.ExecuteTemplate("html/about.htm", &s)
364 s.ExecuteTemplate("about.htm", &s)
365365}
config.example.json +5 −5
@@ -3,16 +3,16 @@
33 "base-path": "/",
44 "cache": {
55 "enabled": true,
6 "path": "cache",
6 "path": "/home/skunk/projects/skunkyart/cache",
77 "lifetime": null,
88 "max-size": 100000,
99 "update-interval": 5
1010 },
1111 "dirs-to-memory": [
12 "html",
13 "css"
12 "/home/skunk/projects/skunkyart/html",
13 "/home/skunk/projects/skunkyart/css"
1414 ],
15 "download-proxy": "",
15 "download-proxy": null,
1616 "proxy": true,
1717 "nsfw": false
18}
\ No newline at end of file
18}