mirror of
https://github.com/azukaar/Cosmos-Server.git
synced 2026-05-12 22:59:21 -05:00
[release] v0.18.0-unstable4
This commit is contained in:
@@ -42,12 +42,13 @@ export const getNestedValue = (values, path) => {
|
||||
}, values);
|
||||
};
|
||||
|
||||
export const CosmosInputText = ({ name, style, value, errors, multiline, type, placeholder, onChange, label, formik }) => {
|
||||
export const CosmosInputText = ({ name, style, value, errors, multiline, type, placeholder, onChange, label, formik, disabled }) => {
|
||||
return <Grid item xs={12}>
|
||||
<Stack spacing={1} style={style}>
|
||||
{label && <InputLabel htmlFor={name}>{label}</InputLabel>}
|
||||
<OutlinedInput
|
||||
id={name}
|
||||
disabled={disabled}
|
||||
type={type ? type : 'text'}
|
||||
value={value || (formik && getNestedValue(formik.values, name))}
|
||||
name={name}
|
||||
@@ -187,12 +188,13 @@ export const CosmosSelect = ({ name, onChange, label, formik, disabled, options,
|
||||
);
|
||||
};
|
||||
|
||||
export const CosmosCheckbox = ({ name, label, formik, style }) => {
|
||||
export const CosmosCheckbox = ({ name, label, formik, style, disabled }) => {
|
||||
return <Grid item xs={12}>
|
||||
<Stack direction="row" justifyContent="space-between" alignItems="center" spacing={2}>
|
||||
<Field
|
||||
type="checkbox"
|
||||
name={name}
|
||||
disabled={disabled}
|
||||
as={FormControlLabel}
|
||||
control={<Checkbox size="large" />}
|
||||
label={label}
|
||||
|
||||
@@ -93,12 +93,22 @@ export const ConstellationVPN = ({freeVersion}) => {
|
||||
</Alert>}
|
||||
<MainCard title={t('mgmt.constellation.setupTitle')} content={config.constellationIP}>
|
||||
<Stack spacing={2}>
|
||||
{constellationEnabled && config.ConstellationConfig.SlaveMode && <>
|
||||
{constellationEnabled && config.ConstellationConfig.SlaveMode && isAdmin && <>
|
||||
<Alert severity="info">
|
||||
{t('mgmt.constellation.externalTextSlaveNoAdmin')}
|
||||
</Alert>
|
||||
</>}
|
||||
{constellationEnabled && config.ConstellationConfig.SlaveMode && isAdmin && <>
|
||||
<Alert severity="info">
|
||||
{t('mgmt.constellation.externalText')}
|
||||
</Alert>
|
||||
</>}
|
||||
<Formik
|
||||
{!constellationEnabled && !isAdmin && <>
|
||||
<Alert severity="info">
|
||||
{t('mgmt.constellation.setupTextNoAdmin')}
|
||||
</Alert>
|
||||
</>}
|
||||
{(isAdmin || constellationEnabled) && <Formik
|
||||
enableReinitialize
|
||||
initialValues={{
|
||||
Enabled: config.ConstellationConfig.Enabled,
|
||||
@@ -124,7 +134,7 @@ export const ConstellationVPN = ({freeVersion}) => {
|
||||
{(formik) => (
|
||||
<form onSubmit={formik.handleSubmit}>
|
||||
<Stack spacing={2}>
|
||||
{constellationEnabled && <Stack spacing={2} direction="row">
|
||||
{isAdmin && constellationEnabled && <Stack spacing={2} direction="row">
|
||||
<Button
|
||||
disableElevation
|
||||
variant="outlined"
|
||||
@@ -165,21 +175,21 @@ export const ConstellationVPN = ({freeVersion}) => {
|
||||
</div>}
|
||||
|
||||
{!freeVersion && <>
|
||||
<CosmosCheckbox formik={formik} name="Enabled" label={t('mgmt.constellation.setup.enabledCheckbox')} />
|
||||
<CosmosCheckbox disabled={!isAdmin} formik={formik} name="Enabled" label={t('mgmt.constellation.setup.enabledCheckbox')} />
|
||||
|
||||
{constellationEnabled && !config.ConstellationConfig.SlaveMode && <>
|
||||
{formik.values.Enabled && <>
|
||||
<CosmosCheckbox formik={formik} name="IsRelay" label={t('mgmt.constellation.setup.relayRequests.label')} />
|
||||
<CosmosCheckbox formik={formik} name="PrivateNode" label={t('mgmt.constellation.setup.privNode.label')} />
|
||||
<CosmosCheckbox formik={formik} name="SyncNodes" label={t('mgmt.constellation.setup.dataSync.label')} />
|
||||
<CosmosCheckbox disabled={!isAdmin} formik={formik} name="IsRelay" label={t('mgmt.constellation.setup.relayRequests.label')} />
|
||||
<CosmosCheckbox disabled={!isAdmin} formik={formik} name="PrivateNode" label={t('mgmt.constellation.setup.privNode.label')} />
|
||||
<CosmosCheckbox disabled={!isAdmin} formik={formik} name="SyncNodes" label={t('mgmt.constellation.setup.dataSync.label')} />
|
||||
{!formik.values.PrivateNode && <>
|
||||
<Alert severity="info"><Trans i18nKey="mgmt.constellation.setup.hostnameInfo" /></Alert>
|
||||
<CosmosInputText formik={formik} name="ConstellationHostname" label={'Constellation '+t('global.hostname')} />
|
||||
<CosmosInputText disabled={!isAdmin} formik={formik} name="ConstellationHostname" label={'Constellation '+t('global.hostname')} />
|
||||
</>}
|
||||
</>}
|
||||
</>}
|
||||
|
||||
<LoadingButton
|
||||
{isAdmin && <><LoadingButton
|
||||
disableElevation
|
||||
loading={formik.isSubmitting}
|
||||
type="submit"
|
||||
@@ -189,7 +199,8 @@ export const ConstellationVPN = ({freeVersion}) => {
|
||||
{t('global.saveAction')}
|
||||
</LoadingButton>
|
||||
</>}
|
||||
<UploadButtons
|
||||
</>}
|
||||
{isAdmin && <><UploadButtons
|
||||
accept=".yml,.yaml"
|
||||
label={config.ConstellationConfig.SlaveMode ?
|
||||
t('mgmt.constellation.setup.externalConfig.slaveMode.label')
|
||||
@@ -203,11 +214,11 @@ export const ConstellationVPN = ({freeVersion}) => {
|
||||
refreshConfig();
|
||||
}, 1000);
|
||||
}}
|
||||
/>
|
||||
/></>}
|
||||
</Stack>
|
||||
</form>
|
||||
)}
|
||||
</Formik>
|
||||
</Formik>}
|
||||
</Stack>
|
||||
</MainCard>
|
||||
</div>
|
||||
|
||||
@@ -235,6 +235,8 @@
|
||||
"mgmt.config.security.geoBlockSelection.varBlock": "block",
|
||||
"mgmt.config.security.geoblock.resetToDefaultButton": "Reset to default (most dangerous countries)",
|
||||
"mgmt.config.security.invertBlacklistCheckbox.invertBlacklistLabel": "Use list as whitelist instead of blacklist",
|
||||
"mgmt.constellation.externalTextSlaveNoAdmin": "This server is currently running as slave mode, you can only add your devices to the main server.",
|
||||
"mgmt.constellation.setupTextNoAdmin": "Constellation is not enabled on this server. Only an admin can activate it.",
|
||||
"mgmt.constellation.dns.resetButton": "Reset",
|
||||
"mgmt.constellation.dnsBlocklistsTitle": "DNS Blocklists",
|
||||
"mgmt.constellation.dnsTitle": "Constellation Internal DNS",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cosmos-server",
|
||||
"version": "0.18.0-unstable3",
|
||||
"version": "0.18.0-unstable4",
|
||||
"description": "",
|
||||
"main": "test-server.js",
|
||||
"bugs": {
|
||||
|
||||
@@ -145,7 +145,7 @@ func API_GetLogs(w http.ResponseWriter, req *http.Request) {
|
||||
}
|
||||
|
||||
func API_Ping(w http.ResponseWriter, req *http.Request) {
|
||||
if utils.AdminOnly(w, req) != nil {
|
||||
if utils.LoggedInOnly(w, req) != nil {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user