mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-09 20:00:12 +00:00
Compare commits
No commits in common. "6b576f2ffe0a09fdd4f210fa4490d7bb5fd5e1e1" and "a4d436b16b0e509dfbd1c78561eae157ebf1e362" have entirely different histories.
6b576f2ffe
...
a4d436b16b
10
api-users.go
10
api-users.go
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/url"
|
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
@ -928,17 +927,12 @@ func (app *appContext) GetAnnounceTemplates(gc *gin.Context) {
|
|||||||
// @Produce json
|
// @Produce json
|
||||||
// @Success 200 {object} announcementTemplate
|
// @Success 200 {object} announcementTemplate
|
||||||
// @Failure 400 {object} boolResponse
|
// @Failure 400 {object} boolResponse
|
||||||
// @Param name path string true "name of template (url encoded if necessary)"
|
// @Param name path string true "name of template"
|
||||||
// @Router /users/announce/template/{name} [get]
|
// @Router /users/announce/template/{name} [get]
|
||||||
// @Security Bearer
|
// @Security Bearer
|
||||||
// @tags Users
|
// @tags Users
|
||||||
func (app *appContext) GetAnnounceTemplate(gc *gin.Context) {
|
func (app *appContext) GetAnnounceTemplate(gc *gin.Context) {
|
||||||
escapedName := gc.Param("name")
|
name := gc.Param("name")
|
||||||
name, err := url.QueryUnescape(escapedName)
|
|
||||||
if err != nil {
|
|
||||||
respondBool(400, false, gc)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if announcement, ok := app.storage.GetAnnouncementsKey(name); ok {
|
if announcement, ok := app.storage.GetAnnouncementsKey(name); ok {
|
||||||
gc.JSON(200, announcement)
|
gc.JSON(200, announcement)
|
||||||
return
|
return
|
||||||
|
8
main.go
8
main.go
@ -566,19 +566,11 @@ func start(asDaemon, firstCall bool) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err == http.ErrServerClosed {
|
|
||||||
app.err.Printf("Failure serving with SSL/TLS: %s", err)
|
|
||||||
} else {
|
|
||||||
app.err.Fatalf("Failure serving with SSL/TLS: %s", err)
|
app.err.Fatalf("Failure serving with SSL/TLS: %s", err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if err := SRV.ListenAndServe(); err != nil {
|
if err := SRV.ListenAndServe(); err != nil {
|
||||||
if err == http.ErrServerClosed {
|
|
||||||
app.err.Printf("Failure serving: %s", err)
|
app.err.Printf("Failure serving: %s", err)
|
||||||
} else {
|
|
||||||
app.err.Fatalf("Failure serving: %s", err)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
1
package-lock.json
generated
1
package-lock.json
generated
@ -15,6 +15,7 @@
|
|||||||
"any-date-parser": "^1.5.4",
|
"any-date-parser": "^1.5.4",
|
||||||
"browserslist": "^4.21.7",
|
"browserslist": "^4.21.7",
|
||||||
"cheerio": "^1.0.0-rc.12",
|
"cheerio": "^1.0.0-rc.12",
|
||||||
|
"esbuild": "^0.18.20",
|
||||||
"fs-cheerio": "^3.0.0",
|
"fs-cheerio": "^3.0.0",
|
||||||
"inline-source": "^8.0.2",
|
"inline-source": "^8.0.2",
|
||||||
"jsdom": "^22.1.0",
|
"jsdom": "^22.1.0",
|
||||||
|
@ -1275,9 +1275,8 @@ export class accountsList {
|
|||||||
el.innerHTML = `
|
el.innerHTML = `
|
||||||
<span class="button ~neutral sm full-width accounts-announce-template-button">${name}</span><span class="button ~critical fr ml-4 accounts-announce-template-delete">×</span>
|
<span class="button ~neutral sm full-width accounts-announce-template-button">${name}</span><span class="button ~critical fr ml-4 accounts-announce-template-delete">×</span>
|
||||||
`;
|
`;
|
||||||
let urlSafeName = encodeURIComponent(encodeURIComponent(name));
|
|
||||||
(el.querySelector("span.accounts-announce-template-button") as HTMLSpanElement).onclick = () => {
|
(el.querySelector("span.accounts-announce-template-button") as HTMLSpanElement).onclick = () => {
|
||||||
_get("/users/announce/" + urlSafeName, null, (req: XMLHttpRequest) => {
|
_get("/users/announce/" + name, null, (req: XMLHttpRequest) => {
|
||||||
if (req.readyState == 4) {
|
if (req.readyState == 4) {
|
||||||
let template: announcementTemplate;
|
let template: announcementTemplate;
|
||||||
if (req.status != 200) {
|
if (req.status != 200) {
|
||||||
@ -1290,7 +1289,7 @@ export class accountsList {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
(el.querySelector("span.accounts-announce-template-delete") as HTMLSpanElement).onclick = () => {
|
(el.querySelector("span.accounts-announce-template-delete") as HTMLSpanElement).onclick = () => {
|
||||||
_delete("/users/announce/" + urlSafeName, null, (req: XMLHttpRequest) => {
|
_delete("/users/announce/" + name, null, (req: XMLHttpRequest) => {
|
||||||
if (req.readyState == 4) {
|
if (req.readyState == 4) {
|
||||||
if (req.status != 200) {
|
if (req.status != 200) {
|
||||||
window.notifications.customError("deleteTemplateError", window.lang.notif("errorFailureCheckLogs"));
|
window.notifications.customError("deleteTemplateError", window.lang.notif("errorFailureCheckLogs"));
|
||||||
|
Loading…
Reference in New Issue
Block a user