mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-29 12:30:11 +00:00
Compare commits
No commits in common. "43e36ee6fc64812fd0b9a6705305b4c384683ede" and "c39a9e80e7328e9363a8968cebea50803da37029" have entirely different histories.
43e36ee6fc
...
c39a9e80e7
@ -54,7 +54,6 @@ builds:
|
||||
goos:
|
||||
- linux
|
||||
- darwin
|
||||
- windows
|
||||
goarch:
|
||||
- arm
|
||||
- arm64
|
||||
|
@ -122,32 +122,6 @@
|
||||
</select>
|
||||
</div>
|
||||
</label>
|
||||
<span class="heading">{{ .lang.Proxy.title }}</span>
|
||||
<p class="content my-2" id="proxy-description">{{ .lang.Proxy.description }}</p>
|
||||
<label class="row switch pb-4">
|
||||
<input type="checkbox" class="mr-2" id="advanced-proxy"><span>{{ .lang.Strings.enabled }}</span>
|
||||
</label>
|
||||
<label class="label">
|
||||
<span>{{ .lang.Proxy.protocol }}</span>
|
||||
<div class="select ~neutral @low mt-4 mb-2">
|
||||
<select id="advanced-proxy_protocol">
|
||||
<option value="http">HTTP</option>
|
||||
<option value="socks">SOCKS5</option>
|
||||
</select>
|
||||
</div>
|
||||
</label>
|
||||
<label class="label">
|
||||
<span class="mt-4">{{ .lang.Proxy.address }}</span>
|
||||
<input type="text" class="input ~neutral @low mt-4 mb-2" id="advanced-proxy_address">
|
||||
</label>
|
||||
<label class="label">
|
||||
<span class="mt-4">{{ .lang.Strings.username }}</span>
|
||||
<input type="text" class="input ~neutral @low mt-4 mb-2" id="advanced-proxy_user">
|
||||
</label>
|
||||
<label class="label">
|
||||
<span class="mt-4">{{ .lang.Strings.password }}</span>
|
||||
<input type="text" class="input ~neutral @low mt-4 mb-2" id="advanced-proxy_password">
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<section class="section ~neutral banner footer flex-expand middle">
|
||||
|
1
lang.go
1
lang.go
@ -116,7 +116,6 @@ type setupLang struct {
|
||||
EndPage langSection `json:"endPage"`
|
||||
General langSection `json:"general"`
|
||||
Updates langSection `json:"updates"`
|
||||
Proxy langSection `json:"proxy"`
|
||||
Language langSection `json:"language"`
|
||||
Login langSection `json:"login"`
|
||||
JellyfinEmby langSection `json:"jellyfinEmby"`
|
||||
|
@ -18,12 +18,11 @@
|
||||
"apiKey": "API Key",
|
||||
"error": "Error",
|
||||
"errorInvalidUserPass": "Invalid username/password.",
|
||||
"errorNotAdmin": "User is not aEnabledllowed to manage server.",
|
||||
"errorNotAdmin": "User is not allowed to manage server.",
|
||||
"errorUserDisabled": "User may be disabled.",
|
||||
"error404": "404, check the internal URL.",
|
||||
"errorConnectionRefused": "Connection refused.",
|
||||
"errorUnknown": "Unknown error, check app logs.",
|
||||
"errorProxy": "Proxy configuration invalid."
|
||||
"errorUnknown": "Unknown error, check app logs."
|
||||
},
|
||||
"startPage": {
|
||||
"welcome": "Welcome!",
|
||||
@ -63,12 +62,6 @@
|
||||
"stable": "Stable",
|
||||
"unstable": "Unstable"
|
||||
},
|
||||
"proxy": {
|
||||
"title": "Proxy",
|
||||
"description": "Have jfa-go make all connections through a HTTP/SOCKS5 proxy. Connection to Jellyfin will be tested through this.",
|
||||
"protocol": "Protocol",
|
||||
"address": "Address (Including Port)"
|
||||
},
|
||||
"login": {
|
||||
"title": "Login",
|
||||
"description": "To access the admin page, you need to login with a method below:",
|
||||
|
28
setup.go
28
setup.go
@ -7,7 +7,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/hrfee/jfa-go/easyproxy"
|
||||
"github.com/hrfee/mediabrowser"
|
||||
)
|
||||
|
||||
@ -52,11 +51,6 @@ type testReq struct {
|
||||
Server string `json:"server"`
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Proxy bool `json:"proxy"`
|
||||
ProxyProtocol string `json:"proxy_protocol,omitempty"`
|
||||
ProxyAddress string `json:"proxy_address,omitempty"`
|
||||
ProxyUsername string `json:"proxy_user,omitempty"`
|
||||
ProxyPassword string `json:"proxy_password,omitempty"`
|
||||
}
|
||||
|
||||
func (app *appContext) TestJF(gc *gin.Context) {
|
||||
@ -70,26 +64,6 @@ func (app *appContext) TestJF(gc *gin.Context) {
|
||||
serverType = mediabrowser.EmbyServer
|
||||
}
|
||||
tempjf, _ := mediabrowser.NewServer(serverType, req.Server, "jfa-go-setup", app.version, "auth", "auth", mediabrowser.NewNamedTimeoutHandler("authJF", req.Server, true), 30)
|
||||
|
||||
if req.Proxy {
|
||||
conf := easyproxy.ProxyConfig{
|
||||
Protocol: easyproxy.HTTP,
|
||||
Addr: req.ProxyAddress,
|
||||
User: req.ProxyUsername,
|
||||
Password: req.ProxyPassword,
|
||||
}
|
||||
if strings.Contains(req.ProxyProtocol, "socks") {
|
||||
conf.Protocol = easyproxy.SOCKS5
|
||||
}
|
||||
|
||||
transport, err := easyproxy.NewTransport(conf)
|
||||
if err != nil {
|
||||
respond(400, "errorProxy", gc)
|
||||
return
|
||||
}
|
||||
tempjf.SetTransport(transport)
|
||||
}
|
||||
|
||||
user, status, err := tempjf.Authenticate(req.Username, req.Password)
|
||||
if !(status == 200 || status == 204) || err != nil {
|
||||
msg := ""
|
||||
@ -152,7 +126,6 @@ func (st *Storage) loadLangSetup(filesystems ...fs.FS) error {
|
||||
patchLang(&lang.Strings, &fallback.Strings, &english.Strings)
|
||||
patchLang(&lang.StartPage, &fallback.StartPage, &english.StartPage)
|
||||
patchLang(&lang.Updates, &fallback.Updates, &english.Updates)
|
||||
patchLang(&lang.Proxy, &fallback.Proxy, &english.Proxy)
|
||||
patchLang(&lang.EndPage, &fallback.EndPage, &english.EndPage)
|
||||
patchLang(&lang.Language, &fallback.Language, &english.Language)
|
||||
patchLang(&lang.Login, &fallback.Login, &english.Login)
|
||||
@ -171,7 +144,6 @@ func (st *Storage) loadLangSetup(filesystems ...fs.FS) error {
|
||||
patchLang(&lang.Strings, &english.Strings)
|
||||
patchLang(&lang.StartPage, &english.StartPage)
|
||||
patchLang(&lang.Updates, &english.Updates)
|
||||
patchLang(&lang.Proxy, &english.Proxy)
|
||||
patchLang(&lang.EndPage, &english.EndPage)
|
||||
patchLang(&lang.Language, &english.Language)
|
||||
patchLang(&lang.Login, &english.Login)
|
||||
|
22
ts/setup.ts
22
ts/setup.ts
@ -85,13 +85,6 @@ class Checkbox {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (this._el.hasAttribute("checked")) {
|
||||
this._el.checked = true;
|
||||
} else {
|
||||
this._el.checked = false;
|
||||
}
|
||||
this.broadcast();
|
||||
}
|
||||
}
|
||||
|
||||
@ -322,14 +315,10 @@ const settings = {
|
||||
"tls": new Checkbox(get("advanced-tls"), "", false, "advanced", "tls"),
|
||||
"tls_port": new Input(get("advanced-tls_port"), "", "", "tls", true, "advanced"),
|
||||
"tls_cert": new Input(get("advanced-tls_cert"), "", "", "tls", true, "advanced"),
|
||||
"tls_key": new Input(get("advanced-tls_key"), "", "", "tls", true, "advanced"),
|
||||
"proxy": new Checkbox(get("advanced-proxy"), "", false, "advanced", "proxy"),
|
||||
"proxy_protocol": new Select(get("advanced-proxy_protocol"), "proxy", true, "advanced"),
|
||||
"proxy_address": new Input(get("advanced-proxy_address"), "", "", "proxy", true, "advanced"),
|
||||
"proxy_user": new Input(get("advanced-proxy_user"), "", "", "proxy", true, "advanced"),
|
||||
"proxy_password": new Input(get("advanced-proxy_password"), "", "", "proxy", true, "advanced")
|
||||
"tls_key": new Input(get("advanced-tls_key"), "", "", "tls", true, "advanced")
|
||||
}
|
||||
};
|
||||
|
||||
const checkTheme = () => {
|
||||
if (settings["ui"]["theme"].value.includes("Dark")) {
|
||||
document.documentElement.classList.add("dark-theme");
|
||||
@ -564,12 +553,7 @@ window.onpopstate = (event: PopStateEvent) => {
|
||||
"type": settings["jellyfin"]["type"].value,
|
||||
"server": settings["jellyfin"]["server"].value,
|
||||
"username": settings["jellyfin"]["username"].value,
|
||||
"password": settings["jellyfin"]["password"].value,
|
||||
"proxy": settings["advanced"]["proxy"].value == "true",
|
||||
"proxy_protocol": settings["advanced"]["proxy_protocol"].value,
|
||||
"proxy_address": settings["advanced"]["proxy_address"].value,
|
||||
"proxy_user": settings["advanced"]["proxy_user"].value,
|
||||
"proxy_password": settings["advanced"]["proxy_password"].value
|
||||
"password": settings["jellyfin"]["password"].value
|
||||
};
|
||||
_post("/jellyfin/test", send, (req: XMLHttpRequest) => {
|
||||
if (req.readyState == 4) {
|
||||
|
Loading…
Reference in New Issue
Block a user