Add a missing instruction to the installation guide.

Add the /tmp/ folder, currently unused.

Shorten some things.
This commit is contained in:
Azareal 2019-10-27 09:11:09 +10:00
parent bbef9cead8
commit 1189967f2b
10 changed files with 25 additions and 27 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
tmp/*
!tmp/filler.txt
tmp2/*
cert_test/*
tmp.txt

View File

@ -262,8 +262,7 @@ func (s *DefaultConversationStore) GetUserExtra(uid int, offset int) (cos []*Con
idmap[cid] = append(idmap[cid],uid)
puidmap[uid] = struct{}{}
}
err = rows.Err()
if err != nil {
if err = rows.Err(); err != nil {
return nil, err
}
//log.Println("3")

View File

@ -59,7 +59,7 @@ func (list SFileList) JSTmplInit() error {
tmplName := strings.TrimSuffix(path, ".jgo")
shortName := strings.TrimPrefix(tmplName, "template_")
var replace = func(data []byte, replaceThis string, withThis string) []byte {
replace := func(data []byte, replaceThis string, withThis string) []byte {
return bytes.Replace(data, []byte(replaceThis), []byte(withThis), -1)
}
@ -94,7 +94,7 @@ func (list SFileList) JSTmplInit() error {
fmt.Println("new endBrace: ", endBrace)
fmt.Println("data: ", string(data))
/*var showPos = func(data []byte, index int) (out string) {
/*showPos := func(data []byte, index int) (out string) {
out = "["
for j, char := range data {
if index == j {
@ -107,9 +107,9 @@ func (list SFileList) JSTmplInit() error {
}*/
// ? Can we just use a regex? I'm thinking of going more efficient, or just outright rolling wasm, this is a temp hack in a place where performance doesn't particularly matter
var each = func(phrase string, handle func(index int)) {
each := func(phrase string, handle func(index int)) {
//fmt.Println("find each '" + phrase + "'")
var index = endBrace
index := endBrace
if index < 0 {
panic("index under zero: " + strconv.Itoa(index))
}

View File

@ -3,7 +3,7 @@ package common
import (
"database/sql"
"github.com/Azareal/Gosora/query_gen"
qgen "github.com/Azareal/Gosora/query_gen"
)
var IPSearch IPSearcher
@ -30,7 +30,7 @@ func NewDefaultIPSearcher() (*DefaultIPSearcher, error) {
}, acc.FirstError()
}
func (searcher *DefaultIPSearcher) Lookup(ip string) (uids []int, err error) {
func (s *DefaultIPSearcher) Lookup(ip string) (uids []int, err error) {
var uid int
reqUserList := make(map[int]bool)
runQuery := func(stmt *sql.Stmt) error {
@ -50,19 +50,19 @@ func (searcher *DefaultIPSearcher) Lookup(ip string) (uids []int, err error) {
return rows.Err()
}
err = runQuery(searcher.searchUsers)
err = runQuery(s.searchUsers)
if err != nil {
return uids, err
}
err = runQuery(searcher.searchTopics)
err = runQuery(s.searchTopics)
if err != nil {
return uids, err
}
err = runQuery(searcher.searchReplies)
err = runQuery(s.searchReplies)
if err != nil {
return uids, err
}
err = runQuery(searcher.searchUsersReplies)
err = runQuery(s.searchUsersReplies)
if err != nil {
return uids, err
}

View File

@ -70,8 +70,12 @@ Type in a strong password for the `gosora` user, please oh please... Don't use "
`chmod 2775 logs`
`chmod 2775 attachs`
`chmod 2775 uploads`
`chmod 2775 tmp`
`chmod 755 ./install-linux`
`./install-linux`

View File

@ -10,6 +10,6 @@ type Adventure struct {
}
// TODO: Should we add a table interface?
func (adventure *Adventure) GetTable() string {
func (a *Adventure) GetTable() string {
return "adventure"
}

View File

@ -34,7 +34,7 @@ func LogsRegs(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
pageList := c.Paginate(page, lastPage, 5)
pi := c.PanelRegLogsPage{basePage, llist, c.Paginator{pageList, page, lastPage}}
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_reglogs", pi})
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage, "", "", "panel_reglogs", pi})
}
// TODO: Log errors when something really screwy is going on?
@ -60,7 +60,7 @@ func topicElementTypeAction(action string, elementType string, elementID int, ac
var tbit string
aarr := strings.Split(action, "-")
switch aarr[0] {
case "lock","unlock","stick","unstick":
case "lock", "unlock", "stick", "unstick":
tbit = aarr[0]
case "move":
if len(aarr) == 2 {
@ -107,10 +107,9 @@ func LogsMod(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
return ferr
}
logCount := c.ModLogs.Count()
page, _ := strconv.Atoi(r.FormValue("page"))
perPage := 12
offset, page, lastPage := c.PageOffset(logCount, page, perPage)
offset, page, lastPage := c.PageOffset(c.ModLogs.Count(), page, perPage)
logs, err := c.ModLogs.GetOffset(offset, perPage)
if err != nil {
@ -125,7 +124,7 @@ func LogsMod(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
pageList := c.Paginate(page, lastPage, 5)
pi := c.PanelLogsPage{basePage, llist, c.Paginator{pageList, page, lastPage}}
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_modlogs", pi})
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage, "", "", "panel_modlogs", pi})
}
func LogsAdmin(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
@ -134,10 +133,9 @@ func LogsAdmin(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
return ferr
}
logCount := c.ModLogs.Count()
page, _ := strconv.Atoi(r.FormValue("page"))
perPage := 12
offset, page, lastPage := c.PageOffset(logCount, page, perPage)
offset, page, lastPage := c.PageOffset(c.ModLogs.Count(), page, perPage)
logs, err := c.AdminLogs.GetOffset(offset, perPage)
if err != nil {
@ -152,5 +150,5 @@ func LogsAdmin(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
pageList := c.Paginate(page, lastPage, 5)
pi := c.PanelLogsPage{basePage, llist, c.Paginator{pageList, page, lastPage}}
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage,"","","panel_adminlogs", pi})
return renderTemplate("panel", w, r, basePage.Header, c.Panel{basePage, "", "", "panel_adminlogs", pi})
}

View File

@ -104,7 +104,6 @@ func ThemesMenusEdit(w http.ResponseWriter, r *http.Request, user c.User, smid s
if err != nil {
return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, user)
}
menuHold, err := c.Menus.Get(mid)
if err == sql.ErrNoRows {
return c.NotFound(w, r, basePage.Header)
@ -149,7 +148,6 @@ func ThemesMenuItemEdit(w http.ResponseWriter, r *http.Request, user c.User, sit
if err != nil {
return c.LocalError(p.GetErrorPhrase("url_id_must_be_integer"), w, r, user)
}
menuItem, err := c.Menus.ItemStore().Get(itemID)
if err == sql.ErrNoRows {
return c.NotFound(w, r, basePage.Header)
@ -434,7 +432,6 @@ func ThemesWidgetsEditSubmit(w http.ResponseWriter, r *http.Request, user c.User
// ThemesWidgetsCreateSubmit is an action which is triggered when someone sends a create request for a widget
func ThemesWidgetsCreateSubmit(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
//fmt.Println("in ThemesWidgetsCreateSubmit")
js := r.PostFormValue("js") == "1"
_, ferr := c.SimplePanelUserCheck(w, r, &user)
if ferr != nil {

View File

@ -9,7 +9,5 @@
<a href="/panel/backups/{{.SQLURL}}" class="panel_tag panel_right_button">{{lang "panel_backups_download"}}</a>
</span>
</div>
{{else}}
<div class="rowitem rowmsg">{{lang "panel_backups_no_backups"}}</div>
{{end}}
{{else}}<div class="rowitem rowmsg">{{lang "panel_backups_no_backups"}}</div>{{end}}
</div>

1
tmp/filler.txt Normal file
View File

@ -0,0 +1 @@
This file is here so that Git will include this folder in the repository.