-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add username and password values to properties
- Loading branch information
Showing
4 changed files
with
72 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { matches, types as T, util, YAML } from "../deps.ts"; | ||
|
||
const { shape, string } = matches; | ||
|
||
const noPropertiesFound: T.ResultType<T.Properties> = { | ||
result: { | ||
version: 2, | ||
data: { | ||
"Not Ready": { | ||
type: "string", | ||
value: "Could not find properties. The service might still be starting", | ||
qr: false, | ||
copyable: false, | ||
masked: false, | ||
description: "Fallback Message When Properties could not be found", | ||
}, | ||
}, | ||
}, | ||
} as const; | ||
|
||
const configMatcher = shape({ | ||
"password": string, | ||
}); | ||
|
||
export const properties: T.ExpectedExports.properties = async ( effects: T.Effects ) => { | ||
if ( | ||
await util.exists(effects, { | ||
volumeId: "main", | ||
path: "start9/config.yaml", | ||
}) === false | ||
) { | ||
return noPropertiesFound; | ||
} | ||
const config = configMatcher.unsafeCast(YAML.parse( | ||
await effects.readFile({ | ||
path: "start9/config.yaml", | ||
volumeId: "main", | ||
}), | ||
)); | ||
const properties: T.ResultType<T.Properties> = { | ||
result: { | ||
version: 2, | ||
data: { | ||
"Username": { | ||
type: "string", | ||
value: "abc", | ||
description: "Default username for Bisq XRDP session.", | ||
copyable: true, | ||
qr: false, | ||
masked: false, | ||
}, | ||
"Password": { | ||
type: "string", | ||
value: config["password"], | ||
description: "This is the password for Bisq XRDP session.", | ||
copyable: true, | ||
qr: false, | ||
masked: true, | ||
}, | ||
} | ||
} | ||
} as const; | ||
return properties; | ||
}; |