Исправление некоторых обосрамсов
This commit is contained in:
parent
4b3bf2c6a0
commit
e02174cb71
@ -29,6 +29,7 @@ server {
|
|||||||
|
|
||||||
location ((BASE URL)) { # if you have a separate subdomain for the frontend, insert '/' instead of '((BASE URL))'.
|
location ((BASE URL)) { # if you have a separate subdomain for the frontend, insert '/' instead of '((BASE URL))'.
|
||||||
proxy_set_header Scheme $scheme;
|
proxy_set_header Scheme $scheme;
|
||||||
|
proxy_set_header Host $host;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_pass http://((IP)):((PORT));
|
proxy_pass http://((IP)):((PORT));
|
||||||
}
|
}
|
||||||
@ -63,6 +64,7 @@ server {
|
|||||||
|
|
||||||
location ((BASE URL)) { # если у вас отдельный поддомен для фронтенда, вместо '((BASE URL))' вставляйте '/'
|
location ((BASE URL)) { # если у вас отдельный поддомен для фронтенда, вместо '((BASE URL))' вставляйте '/'
|
||||||
proxy_set_header Scheme $scheme;
|
proxy_set_header Scheme $scheme;
|
||||||
|
proxy_set_header Host $host;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_pass http://((IP)):((PORT));
|
proxy_pass http://((IP)):((PORT));
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,6 @@ func Router() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
path := parsepath(r.URL.Path)
|
path := parsepath(r.URL.Path)
|
||||||
|
|
||||||
// структура с функциями
|
// структура с функциями
|
||||||
var skunky skunkyart
|
var skunky skunkyart
|
||||||
skunky.Writer = w
|
skunky.Writer = w
|
||||||
@ -77,7 +76,7 @@ func Router() {
|
|||||||
default:
|
default:
|
||||||
skunky.ReturnHTTPError(404)
|
skunky.ReturnHTTPError(404)
|
||||||
case "":
|
case "":
|
||||||
skunky.ExecuteTemplate("html/index.htm", &CFG.BasePath)
|
skunky.ExecuteTemplate("index.htm", &CFG.BasePath)
|
||||||
case "post":
|
case "post":
|
||||||
skunky.Deviation(path[2], path[3])
|
skunky.Deviation(path[2], path[3])
|
||||||
case "search":
|
case "search":
|
||||||
@ -98,10 +97,10 @@ func Router() {
|
|||||||
skunky.About()
|
skunky.About()
|
||||||
case "stylesheet":
|
case "stylesheet":
|
||||||
w.Header().Add("content-type", "text/css")
|
w.Header().Add("content-type", "text/css")
|
||||||
io.WriteString(w, Templates["css/skunky.css"])
|
io.WriteString(w, Templates["skunky.css"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
http.HandleFunc("/", handle)
|
http.HandleFunc("/", handle)
|
||||||
http.ListenAndServe(CFG.Listen, nil)
|
try_with_exitstatus(http.ListenAndServe(CFG.Listen, nil), 1)
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,6 @@ func (s skunkyart) DownloadAndSendMedia(subdomain, path string) {
|
|||||||
url.WriteString(s.Args.Get("token"))
|
url.WriteString(s.Args.Get("token"))
|
||||||
|
|
||||||
if CFG.Cache.Enabled {
|
if CFG.Cache.Enabled {
|
||||||
os.Mkdir(CFG.Cache.Path, 0700)
|
|
||||||
fname := CFG.Cache.Path + "/" + base64.StdEncoding.EncodeToString([]byte(subdomain+path))
|
fname := CFG.Cache.Path + "/" + base64.StdEncoding.EncodeToString([]byte(subdomain+path))
|
||||||
file, e := os.Open(fname)
|
file, e := os.Open(fname)
|
||||||
|
|
||||||
@ -138,6 +137,7 @@ func (s skunkyart) DownloadAndSendMedia(subdomain, path string) {
|
|||||||
|
|
||||||
func InitCacheSystem() {
|
func InitCacheSystem() {
|
||||||
c := &CFG.Cache
|
c := &CFG.Cache
|
||||||
|
os.Mkdir(CFG.Cache.Path, 0700)
|
||||||
for {
|
for {
|
||||||
dir, e := os.Open(c.Path)
|
dir, e := os.Open(c.Path)
|
||||||
try(e)
|
try(e)
|
||||||
@ -175,10 +175,9 @@ func CopyTemplatesToMemory() {
|
|||||||
try_with_exitstatus(e, 1)
|
try_with_exitstatus(e, 1)
|
||||||
|
|
||||||
for _, x := range dir {
|
for _, x := range dir {
|
||||||
n := dirname + "/" + x.Name()
|
file, e := os.ReadFile(dirname + "/" + x.Name())
|
||||||
file, e := os.ReadFile(n)
|
|
||||||
try_with_exitstatus(e, 1)
|
try_with_exitstatus(e, 1)
|
||||||
Templates[n] = string(file)
|
Templates[x.Name()] = string(file)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ func (s skunkyart) GRUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !s.Atom {
|
if !s.Atom {
|
||||||
s.ExecuteTemplate("html/gruser.htm", &s)
|
s.ExecuteTemplate("gruser.htm", &s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ func (s skunkyart) Deviation(author, postname string) {
|
|||||||
|
|
||||||
post.Comments = s.ParseComments(devianter.CommentsFunc(id, post.Post.Comments.Cursor, s.Page, 1))
|
post.Comments = s.ParseComments(devianter.CommentsFunc(id, post.Post.Comments.Cursor, s.Page, 1))
|
||||||
|
|
||||||
s.ExecuteTemplate("html/deviantion.htm", &s)
|
s.ExecuteTemplate("deviantion.htm", &s)
|
||||||
} else {
|
} else {
|
||||||
s.ReturnHTTPError(400)
|
s.ReturnHTTPError(400)
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ func (s skunkyart) DD() {
|
|||||||
More: dd.HasMore,
|
More: dd.HasMore,
|
||||||
})
|
})
|
||||||
if !s.Atom {
|
if !s.Atom {
|
||||||
s.ExecuteTemplate("html/list.htm", &s)
|
s.ExecuteTemplate("list.htm", &s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -342,7 +342,7 @@ func (s skunkyart) Search() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
s.ExecuteTemplate("html/search.htm", &s)
|
s.ExecuteTemplate("search.htm", &s)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s skunkyart) Emojitar(name string) {
|
func (s skunkyart) Emojitar(name string) {
|
||||||
@ -361,5 +361,5 @@ func (s skunkyart) About() {
|
|||||||
s.Templates.About.Nsfw = CFG.Nsfw
|
s.Templates.About.Nsfw = CFG.Nsfw
|
||||||
s.Templates.About.Proxy = CFG.Proxy
|
s.Templates.About.Proxy = CFG.Proxy
|
||||||
try(json.Unmarshal([]byte(Templates["instances.json"]), &s.Templates.About))
|
try(json.Unmarshal([]byte(Templates["instances.json"]), &s.Templates.About))
|
||||||
s.ExecuteTemplate("html/about.htm", &s)
|
s.ExecuteTemplate("about.htm", &s)
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,16 @@
|
|||||||
"base-path": "/",
|
"base-path": "/",
|
||||||
"cache": {
|
"cache": {
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"path": "cache",
|
"path": "/home/skunk/projects/skunkyart/cache",
|
||||||
"lifetime": null,
|
"lifetime": null,
|
||||||
"max-size": 100000,
|
"max-size": 100000,
|
||||||
"update-interval": 5
|
"update-interval": 5
|
||||||
},
|
},
|
||||||
"dirs-to-memory": [
|
"dirs-to-memory": [
|
||||||
"html",
|
"/home/skunk/projects/skunkyart/html",
|
||||||
"css"
|
"/home/skunk/projects/skunkyart/css"
|
||||||
],
|
],
|
||||||
"download-proxy": "",
|
"download-proxy": null,
|
||||||
"proxy": true,
|
"proxy": true,
|
||||||
"nsfw": false
|
"nsfw": false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user