1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-09-19 10:50:11 +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:
- curl -sL https://git.io/goreleaser > 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
- 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"'
@ -164,7 +164,7 @@ steps:
commands:
- curl -sL https://git.io/goreleaser > goreleaser
- chmod +x goreleaser
- ./scripts/version.sh ./goreleaser --snapshot --skip=publish --clean
- ./scripts/version.sh ./goreleaser --snapshot --skip-publish --clean
trigger:
event:

View File

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

View File

@ -2,7 +2,6 @@ package main
import (
"fmt"
"net/url"
"os"
"strings"
"time"
@ -928,17 +927,12 @@ func (app *appContext) GetAnnounceTemplates(gc *gin.Context) {
// @Produce json
// @Success 200 {object} announcementTemplate
// @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]
// @Security Bearer
// @tags Users
func (app *appContext) GetAnnounceTemplate(gc *gin.Context) {
escapedName := gc.Param("name")
name, err := url.QueryUnescape(escapedName)
if err != nil {
respondBool(400, false, gc)
return
}
name := gc.Param("name")
if announcement, ok := app.storage.GetAnnouncementsKey(name); ok {
gc.JSON(200, announcement)
return

12
main.go
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 {
if err := SRV.ListenAndServe(); err != nil {
if err == http.ErrServerClosed {
app.err.Printf("Failure serving: %s", err)
} else {
app.err.Fatalf("Failure serving: %s", err)
}
app.err.Printf("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",
"integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==",
"hasInstallScript": true,
"license": "MIT",
"optional": true,
"bin": {
"esbuild": "bin/esbuild"

View File

@ -16,6 +16,4 @@ else
fi
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')" $@ --timeout $TIMEOUT
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')" $@

View File

@ -1275,9 +1275,8 @@ export class accountsList {
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>
`;
let urlSafeName = encodeURIComponent(encodeURIComponent(name));
(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) {
let template: announcementTemplate;
if (req.status != 200) {
@ -1290,7 +1289,7 @@ export class accountsList {
});
};
(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.status != 200) {
window.notifications.customError("deleteTemplateError", window.lang.notif("errorFailureCheckLogs"));

View File

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