[release] v0.7.9
This commit is contained in:
parent
aa569f8c90
commit
eec4b3cbdb
|
@ -1,4 +1,4 @@
|
|||
## Version 0.7.1 -> 0.7.8
|
||||
## Version 0.7.1 -> 0.7.9
|
||||
- Fix issue where multiple DBs get created at the setup
|
||||
- Add more special characters to be used for password validation
|
||||
- Add configurable default data path for binds
|
||||
|
|
|
@ -53,13 +53,62 @@ let isOnline = () => {
|
|||
}
|
||||
|
||||
let newInstall = (req, onProgress) => {
|
||||
return wrap(fetch('/cosmos/api/newInstall', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
}))
|
||||
if(req.step == '2') {
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
};
|
||||
|
||||
return fetch('/cosmos/api/newInstall', requestOptions)
|
||||
.then(response => {
|
||||
if (!response.ok) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
|
||||
// The response body is a ReadableStream. This code reads the stream and passes chunks to the callback.
|
||||
const reader = response.body.getReader();
|
||||
|
||||
// Read the stream and pass chunks to the callback as they arrive
|
||||
return new ReadableStream({
|
||||
start(controller) {
|
||||
function read() {
|
||||
return reader.read().then(({ done, value }) => {
|
||||
if (done) {
|
||||
controller.close();
|
||||
return;
|
||||
}
|
||||
// Decode the UTF-8 text
|
||||
let text = new TextDecoder().decode(value);
|
||||
// Split by lines in case there are multiple lines in one chunk
|
||||
let lines = text.split('\n');
|
||||
for (let line of lines) {
|
||||
if (line) {
|
||||
// Call the progress callback
|
||||
onProgress(line);
|
||||
}
|
||||
}
|
||||
controller.enqueue(value);
|
||||
return read();
|
||||
});
|
||||
}
|
||||
return read();
|
||||
}
|
||||
});
|
||||
}).catch((e) => {
|
||||
console.error(e);
|
||||
});
|
||||
} else {
|
||||
return wrap(fetch('/cosmos/api/newInstall', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(req)
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
let checkHost = (host) => {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
VERSION=$(grep -o '\"version\": \"[^\"]*\"' package.json | sed 's/[^0-9a-z.-]//g')
|
||||
VERSION=$(grep -o '\"version\": \"[^\"]*\"' package.json | sed 's/[^0-9a-z.-]//g' | sed 's/version//g')
|
||||
LATEST="latest"
|
||||
|
||||
# if branch is unstable in git for circle ci
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
VERSION=$(grep -o '\"version\": \"[^\"]*\"' package.json | sed 's/[^0-9a-z.-]//g')
|
||||
VERSION=$(grep -o '\"version\": \"[^\"]*\"' package.json | sed 's/[^0-9a-z.-]//g'| sed 's/version//g')
|
||||
LATEST="latest"
|
||||
|
||||
# if branch is unstable in git for circle ci
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.7.8",
|
||||
"version": "0.7.9",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
|
|
@ -5,7 +5,8 @@ import (
|
|||
"io"
|
||||
"os"
|
||||
"net/http"
|
||||
|
||||
"fmt"
|
||||
"errors"
|
||||
|
||||
// "github.com/docker/docker/client"
|
||||
"github.com/docker/docker/api/types/container"
|
||||
|
@ -22,6 +23,18 @@ type VolumeMount struct {
|
|||
}
|
||||
|
||||
func NewDB(w http.ResponseWriter, req *http.Request) (string, error) {
|
||||
w.Header().Set("X-Content-Type-Options", "nosniff")
|
||||
w.Header().Set("Transfer-Encoding", "chunked")
|
||||
|
||||
flusher, ok := w.(http.Flusher)
|
||||
if !ok {
|
||||
http.Error(w, "Streaming unsupported!", http.StatusInternalServerError)
|
||||
return "", errors.New("Streaming unsupported!")
|
||||
}
|
||||
|
||||
fmt.Fprintf(w, "NewInstall: Create DB\n")
|
||||
flusher.Flush()
|
||||
|
||||
id := utils.GenerateRandomString(3)
|
||||
mongoUser := "cosmos-" + utils.GenerateRandomString(5)
|
||||
mongoPass := utils.GenerateRandomString(24)
|
||||
|
@ -72,6 +85,8 @@ func NewDB(w http.ResponseWriter, req *http.Request) (string, error) {
|
|||
err := CreateService(service,
|
||||
func (msg string) {
|
||||
utils.Log(msg)
|
||||
fmt.Fprintf(w, msg + "\n")
|
||||
flusher.Flush()
|
||||
},
|
||||
)
|
||||
|
||||
|
|
|
@ -98,6 +98,8 @@ func NewInstallRoute(w http.ResponseWriter, req *http.Request) {
|
|||
utils.LoadBaseMainConfig(newConfig)
|
||||
utils.Log("NewInstall: MongoDB created, waiting for it to be ready")
|
||||
waitForDB()
|
||||
w.WriteHeader(http.StatusOK)
|
||||
return
|
||||
} else {
|
||||
utils.Log("NewInstall: Invalid MongoDBMode")
|
||||
utils.Error("NewInstall: Invalid MongoDBMode", nil)
|
||||
|
|
Loading…
Reference in New Issue