mirror of
https://github.com/wavetermdev/waveterm.git
synced 2024-12-22 16:48:23 +01:00
update to env0
This commit is contained in:
parent
db3f780275
commit
d61246e8a4
@ -82,6 +82,7 @@ type RemoteType = {
|
|||||||
|
|
||||||
type RemoteStateType = {
|
type RemoteStateType = {
|
||||||
cwd : string,
|
cwd : string,
|
||||||
|
env0 : string, // in base64 "env -0" form
|
||||||
};
|
};
|
||||||
|
|
||||||
type RemoteInstanceType = {
|
type RemoteInstanceType = {
|
||||||
|
22
src/util.ts
22
src/util.ts
@ -142,4 +142,24 @@ function genMergeData<ObjType extends IObjType<DataType>, DataType extends IData
|
|||||||
objs.replace(newObjs);
|
objs.replace(newObjs);
|
||||||
}
|
}
|
||||||
|
|
||||||
export {handleJsonFetchResponse, base64ToArray, genMergeData, genMergeSimpleData};
|
function parseEnv0(envStr64 : string) : Map<string, string> {
|
||||||
|
let envStr = atob(envStr64);
|
||||||
|
let parts = envStr.split("\x00");
|
||||||
|
let rtn : Map<string, string> = new Map();
|
||||||
|
for (let i=0; i<parts.length; i++) {
|
||||||
|
let part = parts[i];
|
||||||
|
if (part == "") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let eqIdx = part.indexOf("=");
|
||||||
|
if (eqIdx == -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
let varName = part.substr(0, eqIdx);
|
||||||
|
let varVal = part.substr(eqIdx+1)
|
||||||
|
rtn.set(varName, varVal)
|
||||||
|
}
|
||||||
|
return rtn;
|
||||||
|
}
|
||||||
|
|
||||||
|
export {handleJsonFetchResponse, base64ToArray, genMergeData, genMergeSimpleData, parseEnv0};
|
||||||
|
Loading…
Reference in New Issue
Block a user