mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 00:15:11 +01:00
fix (console): wss issue
This commit is contained in:
parent
810f84c3e3
commit
fea7050b1e
2 changed files with 9 additions and 5 deletions
|
|
@ -47,9 +47,9 @@ steps:
|
|||
from_secret: GIT_PASSWORD
|
||||
commands:
|
||||
- apk add git > /dev/null
|
||||
- chmod -R o+r+w+x ./dist/data
|
||||
- cd ../ && git clone "https://readonly:$PASSWORD@git.kerjean.me/filestash/test.git"
|
||||
- chmod -R 777 ./test/
|
||||
- chmod -R 777 ./filestash/dist/data
|
||||
|
||||
- name: test_frontend
|
||||
image: node:8-alpine
|
||||
|
|
@ -91,7 +91,8 @@ steps:
|
|||
GPG_PASSPHRASE:
|
||||
from_secret: GPG_PASSPHRASE
|
||||
commands:
|
||||
- cp -R config/* dist/data/state/config/
|
||||
- cp -R config/* ./dist/data/state/config/
|
||||
- chmod -R o-r-w-x- ./dist/
|
||||
- apt-get update > /dev/null && apt-get install -y gnupg1 curl > /dev/null
|
||||
- mv dist filestash
|
||||
- tar -cf filestash_linux-amd64.tar ./filestash
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ func AuthBasic(credentials func() (string, string), fn http.Handler) http.Handle
|
|||
http.NotFoundHandler().ServeHTTP(res, req)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
auth := req.Header.Get("Authorization")
|
||||
if strings.HasPrefix(auth, "Basic ") == false {
|
||||
notAuthorised(res, req)
|
||||
|
|
@ -273,6 +273,7 @@ func htmlIndex(pathPrefix string) []byte {
|
|||
|
||||
func AppScript(pathPrefix string) string {
|
||||
return `
|
||||
|
||||
(function() {
|
||||
Terminal.applyAddon(fit);
|
||||
var term;
|
||||
|
|
@ -302,7 +303,7 @@ func AppScript(pathPrefix string) string {
|
|||
});
|
||||
|
||||
var websocket = new WebSocket(
|
||||
(location.protocol === "https:") ? "wss://" : "ws://" +
|
||||
(location.protocol === "https:" ? "wss://" : "ws://") +
|
||||
location.hostname + ((location.port) ? (":" + location.port) : "") +
|
||||
"`+ pathPrefix +`socket"
|
||||
);
|
||||
|
|
@ -343,7 +344,9 @@ func AppScript(pathPrefix string) string {
|
|||
}
|
||||
|
||||
websocket.onerror = function(e){
|
||||
term.destroy();
|
||||
var $term = document.getElementById("terminal");
|
||||
if($term) $term.remove();
|
||||
document.getElementById("terminal").remove()
|
||||
document.getElementById("error-message").innerText = "Websocket Error";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue