[release] v0.10.0-unstable21

This commit is contained in:
Yann Stepienik 2023-10-06 13:34:03 +01:00
parent 3f7527b6ef
commit 1f7c588a2b
3 changed files with 31 additions and 9 deletions

View file

@ -57,13 +57,33 @@ function getLogs() {
} }
function connect(file) { function connect(file) {
return wrap(fetch('/cosmos/api/constellation/connect', { return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => {
fetch('/cosmos/api/constellation/connect', {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/yaml' 'Content-Type': 'text/plain',
}, },
body: file, body: reader.result,
})) })
.then(response => {
// Add additional response handling here if needed.
resolve(response);
})
.catch(error => {
// Handle the error.
reject(error);
});
};
reader.onerror = () => {
reject(new Error('Failed to read the file.'));
};
reader.readAsText(file);
});
} }
function block(nickname, devicename, block) { function block(nickname, devicename, block) {

View file

@ -147,7 +147,9 @@ export const ConstellationVPN = () => {
OnChange={async (e) => { OnChange={async (e) => {
let file = e.target.files[0]; let file = e.target.files[0];
await API.constellation.connect(file); await API.constellation.connect(file);
setTimeout(() => {
refreshConfig(); refreshConfig();
}, 1000);
}} }}
/> />
</Stack> </Stack>

View file

@ -1,6 +1,6 @@
{ {
"name": "cosmos-server", "name": "cosmos-server",
"version": "0.10.0-unstable20", "version": "0.10.0-unstable21",
"description": "", "description": "",
"main": "test-server.js", "main": "test-server.js",
"bugs": { "bugs": {