mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-11-12 21:30:10 +00:00
Compare commits
11 Commits
d279b22c61
...
610ca635f3
Author | SHA1 | Date | |
---|---|---|---|
|
610ca635f3 | ||
6b576f2ffe | |||
7c989fda08 | |||
a4d436b16b | |||
9339992693 | |||
214d16cf0e | |||
a085e91cc6 | |||
272c38e0c5 | |||
|
6052329c0b | ||
|
acfdcdbc63 | ||
|
97506c0bcd |
@ -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:
|
||||
|
@ -1,3 +1,5 @@
|
||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||
version: 2
|
||||
project_name: jfa-go
|
||||
release:
|
||||
github:
|
||||
|
10
api-users.go
10
api-users.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
@ -927,12 +928,17 @@ 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"
|
||||
// @Param name path string true "name of template (url encoded if necessary)"
|
||||
// @Router /users/announce/template/{name} [get]
|
||||
// @Security Bearer
|
||||
// @tags Users
|
||||
func (app *appContext) GetAnnounceTemplate(gc *gin.Context) {
|
||||
name := gc.Param("name")
|
||||
escapedName := gc.Param("name")
|
||||
name, err := url.QueryUnescape(escapedName)
|
||||
if err != nil {
|
||||
respondBool(400, false, gc)
|
||||
return
|
||||
}
|
||||
if announcement, ok := app.storage.GetAnnouncementsKey(name); ok {
|
||||
gc.JSON(200, announcement)
|
||||
return
|
||||
|
12
main.go
12
main.go
@ -566,11 +566,19 @@ func start(asDaemon, firstCall bool) {
|
||||
}
|
||||
}
|
||||
|
||||
app.err.Fatalf("Failure serving with SSL/TLS: %s", err)
|
||||
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)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if err := SRV.ListenAndServe(); err != nil {
|
||||
app.err.Printf("Failure serving: %s", err)
|
||||
if err == http.ErrServerClosed {
|
||||
app.err.Printf("Failure serving: %s", err)
|
||||
} else {
|
||||
app.err.Fatalf("Failure serving: %s", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
15
package-lock.json
generated
15
package-lock.json
generated
@ -22,7 +22,7 @@
|
||||
"mjml": "^4.14.1",
|
||||
"nightwind": "^1.1.13",
|
||||
"perl-regex": "^1.0.4",
|
||||
"postcss": "^8.4.24",
|
||||
"postcss": "^8.4.31",
|
||||
"remixicon": "^3.3.0",
|
||||
"remove-markdown": "^0.5.0",
|
||||
"tailwindcss": "^3.3.2",
|
||||
@ -1653,6 +1653,7 @@
|
||||
"resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.20.tgz",
|
||||
"integrity": "sha512-ceqxoedUrcayh7Y7ZX6NdbbDzGROiyVBgC4PriJThBKSVPWnnFHZAkfI1lJT8QFkOwH4qOS2SJkS4wvpGl8BpA==",
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"optional": true,
|
||||
"bin": {
|
||||
"esbuild": "bin/esbuild"
|
||||
@ -4273,9 +4274,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.24",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz",
|
||||
"integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==",
|
||||
"version": "8.4.31",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
|
||||
"funding": [
|
||||
{
|
||||
"type": "opencollective",
|
||||
@ -9990,9 +9991,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"postcss": {
|
||||
"version": "8.4.24",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.24.tgz",
|
||||
"integrity": "sha512-M0RzbcI0sO/XJNucsGjvWU9ERWxb/ytp1w6dKtxTKgixdtQDq4rmx/g8W1hnaheq9jgwL/oyEdH5Bc4WwJKMqg==",
|
||||
"version": "8.4.31",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.31.tgz",
|
||||
"integrity": "sha512-PS08Iboia9mts/2ygV3eLpY5ghnUcfLV/EXTOW1E2qYxJKGGBUtNjN76FYHnMs36RmARn41bC0AZmn+rR0OVpQ==",
|
||||
"requires": {
|
||||
"nanoid": "^3.3.6",
|
||||
"picocolors": "^1.0.0",
|
||||
|
@ -30,7 +30,7 @@
|
||||
"mjml": "^4.14.1",
|
||||
"nightwind": "^1.1.13",
|
||||
"perl-regex": "^1.0.4",
|
||||
"postcss": "^8.4.24",
|
||||
"postcss": "^8.4.31",
|
||||
"remixicon": "^3.3.0",
|
||||
"remove-markdown": "^0.5.0",
|
||||
"tailwindcss": "^3.3.2",
|
||||
|
@ -16,4 +16,6 @@ else
|
||||
fi
|
||||
|
||||
JFA_GO_VERSION=$(git describe --exact-match HEAD 2> /dev/null || echo 'vgit')
|
||||
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=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
|
||||
|
@ -1275,8 +1275,9 @@ 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">×</span>
|
||||
`;
|
||||
let urlSafeName = encodeURIComponent(encodeURIComponent(name));
|
||||
(el.querySelector("span.accounts-announce-template-button") as HTMLSpanElement).onclick = () => {
|
||||
_get("/users/announce/" + name, null, (req: XMLHttpRequest) => {
|
||||
_get("/users/announce/" + urlSafeName, null, (req: XMLHttpRequest) => {
|
||||
if (req.readyState == 4) {
|
||||
let template: announcementTemplate;
|
||||
if (req.status != 200) {
|
||||
@ -1289,7 +1290,7 @@ export class accountsList {
|
||||
});
|
||||
};
|
||||
(el.querySelector("span.accounts-announce-template-delete") as HTMLSpanElement).onclick = () => {
|
||||
_delete("/users/announce/" + name, null, (req: XMLHttpRequest) => {
|
||||
_delete("/users/announce/" + urlSafeName, null, (req: XMLHttpRequest) => {
|
||||
if (req.readyState == 4) {
|
||||
if (req.status != 200) {
|
||||
window.notifications.customError("deleteTemplateError", window.lang.notif("errorFailureCheckLogs"));
|
||||
|
19
ts/user.ts
19
ts/user.ts
@ -266,13 +266,20 @@ class ReferralCard {
|
||||
get code(): string { return this._code; }
|
||||
set code(c: string) {
|
||||
this._code = c;
|
||||
let url = window.location.href;
|
||||
for (let split of ["#", "?", "account", "my"]) {
|
||||
url = url.split(split)[0];
|
||||
|
||||
let u = new URL(window.location.href);
|
||||
let path = u.pathname;
|
||||
for (let split of ["account", "my"]) {
|
||||
path = path.split(split)[0];
|
||||
}
|
||||
if (url.slice(-1) != "/") { url += "/"; }
|
||||
url = url + "invite/" + this._code;
|
||||
this._url = url;
|
||||
if (path.slice(-1) != "/") { path += "/"; }
|
||||
path = path + "invite/" + this._code;
|
||||
|
||||
u.pathname = path;
|
||||
u.hash = "";
|
||||
u.search = "";
|
||||
|
||||
this._url = u.toString();
|
||||
}
|
||||
|
||||
get remaining_uses(): number { return this._remainingUses; }
|
||||
|
Loading…
Reference in New Issue
Block a user