1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-11-09 20:00:12 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
dependabot[bot]
d279b22c61
Merge 97506c0bcd into a7529c7498 2024-07-10 08:47:08 +02:00
8 changed files with 15 additions and 42 deletions

View File

@ -85,7 +85,7 @@ steps:
commands: commands:
- curl -sL https://git.io/goreleaser > goreleaser - curl -sL https://git.io/goreleaser > goreleaser
- chmod +x goreleaser - chmod +x goreleaser
- ./scripts/version.sh ./goreleaser --snapshot --skip=publish --clean - ./scripts/version.sh ./goreleaser --snapshot --skip-publish --clean
- wget https://builds.hrfee.pw/upload.py - wget https://builds.hrfee.pw/upload.py
- pip3 install requests - pip3 install requests
- bash -c 'sftp -i /id_rsa2 -o StrictHostKeyChecking=no root@161.97.102.153:/mnt/redoc <<< $"put docs/swagger.json jfa-go.json"' - bash -c 'sftp -i /id_rsa2 -o StrictHostKeyChecking=no root@161.97.102.153:/mnt/redoc <<< $"put docs/swagger.json jfa-go.json"'
@ -164,7 +164,7 @@ steps:
commands: commands:
- curl -sL https://git.io/goreleaser > goreleaser - curl -sL https://git.io/goreleaser > goreleaser
- chmod +x goreleaser - chmod +x goreleaser
- ./scripts/version.sh ./goreleaser --snapshot --skip=publish --clean - ./scripts/version.sh ./goreleaser --snapshot --skip-publish --clean
trigger: trigger:
event: event:

View File

@ -1,5 +1,3 @@
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
version: 2
project_name: jfa-go project_name: jfa-go
release: release:
github: github:

View File

@ -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

View File

@ -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
View File

@ -1653,7 +1653,6 @@
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz", "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz",
"integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==", "integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==",
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT",
"optional": true, "optional": true,
"bin": { "bin": {
"esbuild": "bin/esbuild" "esbuild": "bin/esbuild"

View File

@ -16,6 +16,4 @@ else
fi fi
JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit') JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit')
TIMEOUT=60m JFA_GO_CSS_VERSION="v3" JFA_GO_NFPM_EPOCH=$(git rev-list --all --count) JFA_GO_BUILD_TIME=$(date +%s) JFA_GO_BUILT_BY=${JFA_GO_BUILT_BY:-"???"} JFA_GO_VERSION="$(echo $JFA_GO_VERSION | sed 's/v//g')" $@
JFA_GO_CSS_VERSION="v3" JFA_GO_NFPM_EPOCH=$(git rev-list --all --count) JFA_GO_BUILD_TIME=$(date +%s) JFA_GO_BUILT_BY=${JFA_GO_BUILT_BY:-"???"} JFA_GO_VERSION="$(echo $JFA_GO_VERSION | sed 's/v//g')" $@ --timeout $TIMEOUT

View File

@ -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">&times;</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">&times;</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"));

View File

@ -266,20 +266,13 @@ class ReferralCard {
get code(): string { return this._code; } get code(): string { return this._code; }
set code(c: string) { set code(c: string) {
this._code = c; this._code = c;
let url = window.location.href;
let u = new URL(window.location.href); for (let split of ["#", "?", "account", "my"]) {
let path = u.pathname; url = url.split(split)[0];
for (let split of ["account", "my"]) {
path = path.split(split)[0];
} }
if (path.slice(-1) != "/") { path += "/"; } if (url.slice(-1) != "/") { url += "/"; }
path = path + "invite/" + this._code; url = url + "invite/" + this._code;
this._url = url;
u.pathname = path;
u.hash = "";
u.search = "";
this._url = u.toString();
} }
get remaining_uses(): number { return this._remainingUses; } get remaining_uses(): number { return this._remainingUses; }