1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-10-18 17:10:11 +00:00

Compare commits

..

No commits in common. "d51a6abb02af96cad804ea341b49742f0053aac6" and "3e73d16cce77bc0ae877629c2a3304673d0be7fe" have entirely different histories.

33 changed files with 45 additions and 128 deletions

1
.gitignore vendored
View File

@ -13,4 +13,3 @@ server.key
server.pem
server.crt
instructions-debian.txt
cl.md

View File

@ -276,16 +276,7 @@
<span class="ml-1 chev"></span>
</span>
<div class="dropdown-display">
<div class="card ~neutral !low">
<label class="switch pb-1">
<input type="radio" name="lang-time" id="lang-12h">
<span>{{ .strings.time12h }}</span>
</label>
<label class="switch pb-1">
<input type="radio" name="lang-time" id="lang-24h">
<span>{{ .strings.time24h }}</span>
</label>
<div id="lang-list"></div>
<div class="card ~neutral !low" id="lang-list">
</div>
</div>
</span>

View File

@ -5,7 +5,6 @@
window.invalidPassword = "{{ .strings.reEnterPasswordInvalid }}";
window.URLBase = "{{ .urlBase }}";
window.code = "{{ .code }}";
window.language = "{{ .langName }}";
window.messages = JSON.parse({{ .notifications }});
window.confirmation = {{ .confirmation }};
window.userExpiryEnabled = {{ .userExpiry }};

View File

@ -266,10 +266,10 @@
</label>
<div>
<label class="row switch pb-1">
<input type="radio" name="email-24h" value="true" checked><span>{{ .lang.Strings.time24h }}</span>
<input type="radio" name="email-24h" value="true" checked><span>{{ .lang.Email.time24h }}</span>
</label>
<label class="row switch pb-1">
<input type="radio" name="email-24h" value="false"><span>{{ .lang.Strings.time12h }}</span>
<input type="radio" name="email-24h" value="false"><span>{{ .lang.Email.time12h }}</span>
</label>
</div>
</div>

View File

@ -1,5 +0,0 @@
{
"meta": {
"name": "English (GB)"
}
}

View File

@ -12,8 +12,6 @@
"error": "Fehler",
"copy": "Kopieren",
"theme": "Thema",
"time24h": "24h-Format",
"time12h": "12h-Format",
"copied": "Kopiert"
}
}

View File

@ -12,8 +12,6 @@
"error": "Σφάλμα",
"copy": "Αντιγραφή",
"theme": "Θέμα",
"time24h": "24 Ώρες",
"time12h": "12 Ώρες",
"copied": "Αντιγράφηκε"
}
}

View File

@ -1,5 +0,0 @@
{
"meta": {
"name": "English (GB)"
}
}

View File

@ -12,8 +12,6 @@
"error": "Error",
"copy": "Copy",
"copied": "Copied",
"time24h": "24h Time",
"time12h": "12h Time",
"theme": "Theme"
}
}

View File

@ -12,8 +12,6 @@
"success": "Succès",
"error": "Erreur",
"copy": "Copier",
"time24h": "Temps 24h",
"time12h": "Temps 12h",
"theme": "Thème"
}
}

View File

@ -11,8 +11,6 @@
"success": "Sukses",
"error": "Error",
"copy": "Salin",
"time24h": "Waktu 24 jam",
"time12h": "Waktu 12 jam",
"theme": "Tema"
}
}

View File

@ -12,8 +12,6 @@
"error": "Fout",
"copy": "Kopiëer",
"theme": "Thema",
"time24h": "24u-formaat",
"time12h": "12u-formaat",
"copied": "Gekopieerd"
}
}

View File

@ -12,8 +12,6 @@
"error": "Erro",
"copy": "Copiar",
"theme": "Tema",
"time24h": "Horário 24h",
"time12h": "Horário 12h",
"copied": "Copiado"
}
}

View File

@ -11,8 +11,6 @@
"success": "Lyckades",
"error": "Fel",
"copy": "Kopiera",
"time24h": "24 timmarsklocka",
"time12h": "12 timmarsklocka",
"theme": "Tema"
}
}

View File

@ -1,5 +0,0 @@
{
"meta": {
"name": "English (GB)"
}
}

View File

@ -1,5 +0,0 @@
{
"meta": {
"name": "English (GB)"
}
}

View File

@ -82,6 +82,8 @@
"senderName": "Absendername",
"dateFormat": "Datumsformat",
"dateFormatNotice": "Datum folgt dem strftime-Format. Für weitere Informationen, besuche {n}.",
"time24h": "24h-Format",
"time12h": "12h-Format",
"encryption": "Verschlüsselung",
"mailgunApiURL": "API-URL"
},

View File

@ -82,6 +82,8 @@
"senderName": "Ονομα αποστολέα",
"dateFormat": "Μορφή ημερομηνίας",
"dateFormatNotice": "Η ημερομηνία ακολουθεί τη μορφή strftime. Για περισσότερες πληροφορίες, επισκεφτείτε το {n}.",
"time24h": "24 Ώρες",
"time12h": "12 Ώρες",
"encryption": "Κρυπτογράφηση",
"mailgunApiURL": "Διεύθυνση API"
},

View File

@ -1,5 +0,0 @@
{
"meta": {
"name": "English (GB)"
}
}

View File

@ -89,6 +89,8 @@
"senderName": "Sender Name",
"dateFormat": "Date Format",
"dateFormatNotice": "Date follows the strftime format. For more info, visit {n}.",
"time24h": "24h Time",
"time12h": "12h Time",
"encryption": "Encryption",
"mailgunApiURL": "API URL"
},

View File

@ -82,6 +82,8 @@
"senderName": "Nom de l'envoyeur",
"dateFormat": "Format de la date",
"dateFormatNotice": "La date suis le format srtftime. Pour plus d'informations, consultez {n}.",
"time24h": "Temps 24h",
"time12h": "Temps 12h",
"encryption": "Chiffrement",
"mailgunApiURL": "URL de l'API"
},

View File

@ -82,6 +82,8 @@
"senderName": "Nama Pengirim",
"dateFormat": "Format Tanggal",
"dateFormatNotice": "Tanggal mengikuti format strftime. Untuk info lebih lanjut, kunjungi {n}.",
"time24h": "Waktu 24 jam",
"time12h": "Waktu 12 jam",
"encryption": "Enkripsi",
"mailgunApiURL": "URL API"
},

View File

@ -82,6 +82,8 @@
"senderName": "Naam afzender",
"dateFormat": "Datumformaat",
"dateFormatNotice": "Datum volgend het strftime formaat. Meer info op {n}.",
"time24h": "24u-formaat",
"time12h": "12u-formaat",
"encryption": "Versleuteling",
"mailgunApiURL": "API-URL"
},

View File

@ -82,6 +82,8 @@
"senderName": "Nome do remetente",
"dateFormat": "Formato da Data",
"dateFormatNotice": "A data segue o formato strftime. Para obter mais informações, visite {n}.",
"time24h": "Horário 24h",
"time12h": "Horário 12h",
"encryption": "Encriptação",
"mailgunApiURL": "API URL"
},

View File

@ -82,6 +82,8 @@
"senderName": "Avsändarens namn",
"dateFormat": "Datumformat",
"dateFormatNotice": "Datum följer strftime-formatet. Mer information finns på {n}.",
"time24h": "24 timmarsklocka",
"time12h": "12 timmarsklocka",
"encryption": "Kryptering",
"mailgunApiURL": "API URL"
},

View File

@ -144,14 +144,11 @@ func patchLang(english, other *langSection) {
}
func patchQuantityStrings(english, other *map[string]quantityString) {
if *other == nil {
*other = map[string]quantityString{}
}
for n, ev := range *english {
qs, ok := (*other)[n]
if !ok {
(*other)[n] = ev
continue
return
} else if qs.Singular == "" {
qs.Singular = ev.Singular
} else if (*other)[n].Plural == "" {
@ -432,8 +429,6 @@ func (st *Storage) loadLangEmail(filesystems ...fs.FS) error {
patchLang(&english.UserDeleted, &lang.UserDeleted)
patchLang(&english.InviteEmail, &lang.InviteEmail)
patchLang(&english.WelcomeEmail, &lang.WelcomeEmail)
patchLang(&english.EmailConfirmation, &lang.EmailConfirmation)
patchLang(&english.UserExpired, &lang.UserExpired)
}
st.lang.Email[index] = lang
return nil

View File

@ -1,5 +1,5 @@
import { Modal } from "./modules/modal.js";
import { _get, _post, toggleLoader, toDateString } from "./modules/common.js";
import { _get, _post, toggleLoader } from "./modules/common.js";
import { loadLangSelector } from "./modules/lang.js";
interface formWindow extends Window {
@ -46,7 +46,7 @@ if (window.userExpiryEnabled) {
time.setDate(time.getDate() + window.userExpiryDays);
time.setHours(time.getHours() + window.userExpiryHours);
time.setMinutes(time.getMinutes() + window.userExpiryMinutes);
messageEl.textContent = window.userExpiryMessage.replace("{date}", toDateString(time));
messageEl.textContent = window.userExpiryMessage.replace("{date}", time.toDateString() + " " + time.toLocaleTimeString());
setTimeout(calculateTime, 1000);
};
calculateTime();

View File

@ -83,7 +83,7 @@ class user implements User {
set last_active(unix: number) {
this._lastActiveUnix = unix;
if (unix == 0) {
this._lastActive.textContent == "n/a";
this._lastActive.textContent == "";
} else {
this._lastActive.textContent = toDateString(new Date(unix*1000));
}
@ -142,11 +142,6 @@ class user implements User {
};
this.update(user);
document.addEventListener("timefmt-change", () => {
this.expiry = this.expiry;
this.last_active = this.last_active;
});
}
private _updateEmail = () => {

View File

@ -7,24 +7,10 @@ export function createEl(html: string): HTMLElement {
}
export function toDateString(date: Date): string {
const locale = window.language || (window as any).navigator.userLanguage || window.navigator.language;
const t12 = document.getElementById("lang-12h") as HTMLInputElement;
const t24 = document.getElementById("lang-24h") as HTMLInputElement;
let args1 = {};
let args2 = {
return date.toLocaleDateString() + " " + date.toLocaleString([], {
hour: "2-digit",
minute: "2-digit"
};
if (t12 && t24) {
if (t12.checked) {
args1["hour12"] = true;
args2["hour12"] = true;
} else if (t24.checked) {
args1["hour12"] = false;
args2["hour12"] = false;
}
}
return date.toLocaleDateString(locale, args1) + " " + date.toLocaleString(locale, args2);
})
}
export function serializeForm(id: string): Object {

View File

@ -363,10 +363,6 @@ export class DOMInvite implements Invite {
this.update(invite);
document.addEventListener("profileLoadEvent", () => { this.loadProfiles(); }, false);
document.addEventListener("timefmt-change", () => {
this.created = this.created;
this.usedBy = this.usedBy;
});
}
update = (invite: Invite) => {

View File

@ -47,28 +47,7 @@ export class lang implements Lang {
}
}
export const loadLangSelector = (page: string) => {
if (page == "admin") {
const ev = new CustomEvent("timefmt-change");
const setTimefmt = (fmt: string) => {
document.dispatchEvent(ev);
localStorage.setItem("timefmt", fmt);
};
const t12 = document.getElementById("lang-12h") as HTMLInputElement;
t12.onchange = () => setTimefmt("12h");
const t24 = document.getElementById("lang-24h") as HTMLInputElement;
t24.onchange = () => setTimefmt("24h");
const preference = localStorage.getItem("timefmt");
if (preference == "12h") {
t12.checked = true;
t24.checked = false;
} else if (preference == "24h") {
t24.checked = true;
t12.checked = false;
}
}
_get("/lang/" + page, null, (req: XMLHttpRequest) => {
export const loadLangSelector = (page: string) => _get("/lang/" + page, null, (req: XMLHttpRequest) => {
if (req.readyState == 4) {
if (req.status != 200) {
document.getElementById("lang-dropdown").remove();
@ -82,4 +61,7 @@ export const loadLangSelector = (page: string) => {
list.innerHTML = innerHTML;
}
});
};

View File

@ -8,7 +8,7 @@ interface updateDTO {
export class Updater implements updater {
private _update: Update;
private _date: number;
private _date: Date;
updateAvailable = false;
checkForUpdates = (run?: (req: XMLHttpRequest) => void) => _get("/config/update", null, (req: XMLHttpRequest) => {
@ -26,10 +26,10 @@ export class Updater implements updater {
}
}
});
get date(): number { return this._date; }
get date(): number { return Math.floor(this._date.getTime() / 1000); }
set date(unix: number) {
this._date = unix;
document.getElementById("update-date").textContent = toDateString(new Date(this._date * 1000));
this._date = new Date(unix * 1000);
document.getElementById("update-date").textContent = toDateString(this._date);
}
get description(): string { return this._update.description; }

View File

@ -221,7 +221,6 @@ func (app *appContext) InviteProxy(gc *gin.Context) {
"userExpiryHours": inv.UserHours,
"userExpiryMinutes": inv.UserMinutes,
"userExpiryMessage": app.storage.lang.Form[lang].Strings.get("yourAccountIsValidUntil"),
"langName": lang,
})
}