[skip ci] add demo
This commit is contained in:
parent
420b0203be
commit
8c61d6a98f
16 changed files with 2107 additions and 8 deletions
31
client/src/api/authentication.demo.jsx
Normal file
31
client/src/api/authentication.demo.jsx
Normal file
|
@ -0,0 +1,31 @@
|
|||
import wrap from './wrap';
|
||||
|
||||
function login(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function me() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function logout() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
login,
|
||||
logout,
|
||||
me
|
||||
};
|
79
client/src/api/config.demo.ts
Normal file
79
client/src/api/config.demo.ts
Normal file
|
@ -0,0 +1,79 @@
|
|||
import { resolve } from 'eslint-import-resolver-typescript';
|
||||
import configDemo from './demo.config.json';
|
||||
|
||||
interface Route {
|
||||
Name: string;
|
||||
}
|
||||
|
||||
type Operation = 'replace' | 'move_up' | 'move_down' | 'delete' | 'add';
|
||||
|
||||
function get() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(configDemo)
|
||||
});
|
||||
}
|
||||
|
||||
function set(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function restart() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function canSendEmail() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
"data": {
|
||||
"canSendEmail": true,
|
||||
}
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
async function rawUpdateRoute(routeName: string, operation: Operation, newRoute?: Route): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve()
|
||||
});
|
||||
}
|
||||
|
||||
async function replaceRoute(routeName: string, newRoute: Route): Promise<void> {
|
||||
return rawUpdateRoute(routeName, 'replace', newRoute);
|
||||
}
|
||||
|
||||
async function moveRouteUp(routeName: string): Promise<void> {
|
||||
return rawUpdateRoute(routeName, 'move_up');
|
||||
}
|
||||
|
||||
async function moveRouteDown(routeName: string): Promise<void> {
|
||||
return rawUpdateRoute(routeName, 'move_down');
|
||||
}
|
||||
|
||||
async function deleteRoute(routeName: string): Promise<void> {
|
||||
return rawUpdateRoute(routeName, 'delete');
|
||||
}
|
||||
async function addRoute(newRoute: Route): Promise<void> {
|
||||
return rawUpdateRoute("", 'add', newRoute);
|
||||
}
|
||||
|
||||
export {
|
||||
get,
|
||||
set,
|
||||
restart,
|
||||
rawUpdateRoute,
|
||||
replaceRoute,
|
||||
moveRouteUp,
|
||||
moveRouteDown,
|
||||
deleteRoute,
|
||||
addRoute,
|
||||
canSendEmail,
|
||||
};
|
350
client/src/api/demo.config.json
Normal file
350
client/src/api/demo.config.json
Normal file
|
@ -0,0 +1,350 @@
|
|||
{
|
||||
"data": {
|
||||
"LoggingLevel": "INFO",
|
||||
"MongoDB": "mongodb://cosmos-asda:fdhgaiodfiaushdfiuahsdf@cosmos-mongo-ASD:27017",
|
||||
"DisableUserManagement": false,
|
||||
"NewInstall": false,
|
||||
"HTTPConfig": {
|
||||
"TLSCert": "",
|
||||
"TLSKey": "",
|
||||
"TLSKeyHostsCached": null,
|
||||
"AuthPrivateKey": "",
|
||||
"AuthPublicKey": "-----BEGIN PUBLIC KEY-----\nMCowBQYDhf9sadf089a7sdgf8gsd8f7ga89sdfgXVoUD9HYk=\n-----END PUBLIC KEY-----\n",
|
||||
"GenerateMissingAuthCert": true,
|
||||
"HTTPSCertificateMode": "LETSENCRYPT",
|
||||
"DNSChallengeProvider": "",
|
||||
"HTTPPort": "80",
|
||||
"HTTPSPort": "443",
|
||||
"ProxyConfig": {
|
||||
"Routes": [
|
||||
{
|
||||
"Name": "Jellyfin",
|
||||
"Description": "Expose Jellyfin to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "play.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 14400000,
|
||||
"ThrottlePerMinute": 10000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": false,
|
||||
"AdminOnly": false,
|
||||
"Target": "http://Jellyfin:8096",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "Documents Folder",
|
||||
"Description": "Share my Documents",
|
||||
"UseHost": true,
|
||||
"Host": "doc.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 14400000,
|
||||
"ThrottlePerMinute": 10000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 10000000,
|
||||
"AuthEnabled": true,
|
||||
"AdminOnly": false,
|
||||
"Target": "/Doc",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "STATIC",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "navidrome",
|
||||
"Description": "Expose navidrome to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "music.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 0,
|
||||
"ThrottlePerMinute": 9000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": false,
|
||||
"AdminOnly": false,
|
||||
"Target": "http://navidrome:4533",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "Plex",
|
||||
"Description": "Expose Plex to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "plex.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 0,
|
||||
"ThrottlePerMinute": 0,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": false,
|
||||
"AdminOnly": false,
|
||||
"Target": "http://Plex:32400",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 2,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 2
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "Radarr",
|
||||
"Description": "Expose Radarr to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "dl-movies.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 30000,
|
||||
"ThrottlePerMinute": 2000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": true,
|
||||
"AdminOnly": true,
|
||||
"Target": "http://Radarr:7878",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "Sonarr",
|
||||
"Description": "Expose Sonarr to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "dl-series.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 30000,
|
||||
"ThrottlePerMinute": 200,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": true,
|
||||
"AdminOnly": true,
|
||||
"Target": "http://Sonarr:8989",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "nzbget",
|
||||
"Description": "Expose nzbget to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "dl.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 999999999,
|
||||
"ThrottlePerMinute": 3000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": true,
|
||||
"AdminOnly": true,
|
||||
"Target": "http://nzbget:6789",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "photoprism",
|
||||
"Description": "Expose photoprism to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "photos.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 45000,
|
||||
"ThrottlePerMinute": 5000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": false,
|
||||
"AdminOnly": false,
|
||||
"Target": "http://photoprism:2342",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "Owncloud",
|
||||
"Description": "Expose Owncloud to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "cloud.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 0,
|
||||
"ThrottlePerMinute": 2000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": false,
|
||||
"AdminOnly": false,
|
||||
"Target": "http://Owncloud:8080",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
},
|
||||
{
|
||||
"Name": "Lidarr",
|
||||
"Description": "Expose Lidarr to the internet",
|
||||
"UseHost": true,
|
||||
"Host": "dl-music.my-server.com",
|
||||
"UsePathPrefix": false,
|
||||
"PathPrefix": "",
|
||||
"Timeout": 30000,
|
||||
"ThrottlePerMinute": 2000,
|
||||
"CORSOrigin": "",
|
||||
"StripPathPrefix": false,
|
||||
"MaxBandwith": 0,
|
||||
"AuthEnabled": true,
|
||||
"AdminOnly": true,
|
||||
"Target": "http://Lidarr:8686",
|
||||
"SmartShield": {
|
||||
"Enabled": true,
|
||||
"PolicyStrictness": 0,
|
||||
"PerUserTimeBudget": 0,
|
||||
"PerUserRequestLimit": 0,
|
||||
"PerUserByteLimit": 0,
|
||||
"PerUserSimultaneous": 0,
|
||||
"MaxGlobalSimultaneous": 0,
|
||||
"PrivilegedGroups": 0
|
||||
},
|
||||
"Mode": "SERVAPP",
|
||||
"BlockCommonBots": false,
|
||||
"BlockAPIAbuse": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"Hostname": "my-server.com",
|
||||
"SSLEmail": "myemail@gmail.com"
|
||||
},
|
||||
"EmailConfig": {
|
||||
"Enabled": true,
|
||||
"Host": "smtp.gmail.com",
|
||||
"Port": "587",
|
||||
"Username": "asdasdasd@gmail.com",
|
||||
"Password": "ufahsd9f9asf",
|
||||
"From": "Cosmos Server Admin",
|
||||
"UseTLS": true
|
||||
},
|
||||
"DockerConfig": {
|
||||
"SkipPruneNetwork": false
|
||||
},
|
||||
"BlockedCountries": [
|
||||
"CN",
|
||||
"RU",
|
||||
"TR",
|
||||
"BR",
|
||||
"BD",
|
||||
"IN",
|
||||
"NP",
|
||||
"PK",
|
||||
"LK",
|
||||
"VN",
|
||||
"ID",
|
||||
"IR",
|
||||
"IQ",
|
||||
"EG",
|
||||
"AF",
|
||||
"RO"
|
||||
],
|
||||
"ServerCountry": "",
|
||||
"RequireMFA": false,
|
||||
"AutoUpdate": false
|
||||
},
|
||||
"status": "OK"
|
||||
}
|
1332
client/src/api/docker.demo.json
Normal file
1332
client/src/api/docker.demo.json
Normal file
File diff suppressed because it is too large
Load diff
29
client/src/api/docker.demo.jsx
Normal file
29
client/src/api/docker.demo.jsx
Normal file
|
@ -0,0 +1,29 @@
|
|||
import configDemo from './docker.demo.json';
|
||||
|
||||
function list() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(configDemo)
|
||||
});
|
||||
}
|
||||
|
||||
function secure(id, res) {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
const newDB = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
list,
|
||||
newDB,
|
||||
secure
|
||||
};
|
39
client/src/api/index.demo.jsx
Normal file
39
client/src/api/index.demo.jsx
Normal file
|
@ -0,0 +1,39 @@
|
|||
|
||||
export const getStatus = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve({
|
||||
"data": {
|
||||
"HTTPSCertificateMode": "LETSENCRYPT",
|
||||
"database": true,
|
||||
"docker": true,
|
||||
"domain": false,
|
||||
"letsencrypt": false,
|
||||
"needsRestart": false,
|
||||
"newVersionAvailable": false
|
||||
},
|
||||
"status": "OK"
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export const isOnline = () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export const newInstall = (req) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
|
@ -1,11 +1,17 @@
|
|||
import * as auth from './authentication';
|
||||
import * as users from './users';
|
||||
import * as config from './config';
|
||||
import * as docker from './docker';
|
||||
import * as _auth from './authentication';
|
||||
import * as _users from './users';
|
||||
import * as _config from './config';
|
||||
import * as _docker from './docker';
|
||||
|
||||
import * as authDemo from './authentication.demo';
|
||||
import * as usersDemo from './users.demo';
|
||||
import * as configDemo from './config.demo';
|
||||
import * as dockerDemo from './docker.demo';
|
||||
import * as indexDemo from './index.demo';
|
||||
|
||||
import wrap from './wrap';
|
||||
|
||||
const getStatus = () => {
|
||||
let getStatus = () => {
|
||||
return wrap(fetch('/cosmos/api/status', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
|
@ -14,7 +20,7 @@ const getStatus = () => {
|
|||
}))
|
||||
}
|
||||
|
||||
const isOnline = () => {
|
||||
let isOnline = () => {
|
||||
return fetch('/cosmos/api/status', {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
|
@ -36,7 +42,7 @@ const isOnline = () => {
|
|||
});
|
||||
}
|
||||
|
||||
const newInstall = (req) => {
|
||||
let newInstall = (req) => {
|
||||
return wrap(fetch('/cosmos/api/newInstall', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
|
@ -46,6 +52,23 @@ const newInstall = (req) => {
|
|||
}))
|
||||
}
|
||||
|
||||
const isDemo = import.meta.env.MODE === 'demo';
|
||||
|
||||
let auth = _auth;
|
||||
let users = _users;
|
||||
let config = _config;
|
||||
let docker = _docker;
|
||||
|
||||
if(isDemo) {
|
||||
auth = authDemo;
|
||||
users = usersDemo;
|
||||
config = configDemo;
|
||||
docker = dockerDemo;
|
||||
getStatus = indexDemo.getStatus;
|
||||
newInstall = indexDemo.newInstall;
|
||||
isOnline = indexDemo.isOnline;
|
||||
}
|
||||
|
||||
export {
|
||||
auth,
|
||||
users,
|
||||
|
|
53
client/src/api/users.demo.json
Normal file
53
client/src/api/users.demo.json
Normal file
|
@ -0,0 +1,53 @@
|
|||
{
|
||||
"data": [
|
||||
{
|
||||
"nickname": "Cosmos",
|
||||
"registerKey": "",
|
||||
"registerKeyExp": "0001-01-01T00:00:00Z",
|
||||
"role": 2,
|
||||
"link": "/api/user/Cosmos",
|
||||
"email": "",
|
||||
"registeredAt": "2023-04-01T16:40:34.169Z",
|
||||
"lastPasswordChangedAt": "0001-01-01T00:00:00Z",
|
||||
"createdAt": "2023-04-01T16:40:34.169Z",
|
||||
"lastLogin": "2023-04-30T22:17:26.463Z"
|
||||
},
|
||||
{
|
||||
"nickname": "Gertrude",
|
||||
"registerKey": "",
|
||||
"registerKeyExp": "0001-01-01T00:00:00Z",
|
||||
"role": 1,
|
||||
"link": "/api/user/Gertrude",
|
||||
"email": "",
|
||||
"registeredAt": "2023-04-29T12:20:09.268Z",
|
||||
"lastPasswordChangedAt": "2023-04-29T12:20:09.268Z",
|
||||
"createdAt": "2023-04-29T11:46:36.521Z",
|
||||
"lastLogin": "2023-04-30T16:37:38.815Z"
|
||||
},
|
||||
{
|
||||
"nickname": "John",
|
||||
"registerKey": "",
|
||||
"registerKeyExp": "0001-01-01T00:00:00Z",
|
||||
"role": 1,
|
||||
"link": "/api/user/John",
|
||||
"email": "",
|
||||
"registeredAt": "2023-04-29T13:31:59.04Z",
|
||||
"lastPasswordChangedAt": "2023-04-29T13:31:59.04Z",
|
||||
"createdAt": "2023-04-29T13:10:23.515Z",
|
||||
"lastLogin": "2023-04-29T13:33:31.982Z"
|
||||
},
|
||||
{
|
||||
"nickname": "Wilfred",
|
||||
"registerKey": "4S4ALTTl5Z9ROiY1tqFgT46xPiNk9FU9FI83WsOT15NXKhz6",
|
||||
"registerKeyExp": "2023-05-08T15:14:21.856Z",
|
||||
"role": 1,
|
||||
"link": "/api/user/Wilfred",
|
||||
"email": "wilfred@gmail.com",
|
||||
"registeredAt": "0001-01-01T00:00:00Z",
|
||||
"lastPasswordChangedAt": "0001-01-01T00:00:00Z",
|
||||
"createdAt": "2023-05-01T15:14:21.812Z",
|
||||
"lastLogin": "0001-01-01T00:00:00Z"
|
||||
}
|
||||
],
|
||||
"status": "OK"
|
||||
}
|
131
client/src/api/users.demo.jsx
Normal file
131
client/src/api/users.demo.jsx
Normal file
|
@ -0,0 +1,131 @@
|
|||
import configDemo from './users.demo.json';
|
||||
|
||||
function list() {
|
||||
return new Promise((resolve, reject) => {
|
||||
resolve(configDemo)
|
||||
});
|
||||
}
|
||||
|
||||
function create(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function register(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function invite(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function edit(nickname, values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function get(nickname) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteUser(nickname) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function new2FA(nickname) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function check2FA(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function reset2FA(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
function resetPassword(values) {
|
||||
return new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
"status": "ok",
|
||||
})},
|
||||
2000
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
export {
|
||||
list,
|
||||
create,
|
||||
register,
|
||||
invite,
|
||||
edit,
|
||||
get,
|
||||
deleteUser,
|
||||
new2FA,
|
||||
check2FA,
|
||||
reset2FA,
|
||||
resetPassword,
|
||||
};
|
Binary file not shown.
Before Width: | Height: | Size: 410 KiB |
12
client/src/utils/icons.demo.json
Normal file
12
client/src/utils/icons.demo.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -1,4 +1,7 @@
|
|||
import Folder from '../assets/images/icons/folder(1).svg';
|
||||
import demoicons from './icons.demo.json';
|
||||
import logogray from '../assets/images/icons/cosmos_gray.png';
|
||||
|
||||
import * as Yup from 'yup';
|
||||
|
||||
export const sanitizeRoute = (_route) => {
|
||||
|
@ -40,7 +43,15 @@ export const getFullOrigin = (route) => {
|
|||
return addProtocol(getOrigin(route));
|
||||
}
|
||||
|
||||
const isDemo = import.meta.env.MODE === 'demo';
|
||||
|
||||
export const getFaviconURL = (route) => {
|
||||
if(isDemo) {
|
||||
if (route.Mode == "STATIC")
|
||||
return Folder;
|
||||
return demoicons[route.Name] || logogray;
|
||||
}
|
||||
|
||||
const addRemote = (url) => {
|
||||
return '/cosmos/api/favicon?q=' + encodeURIComponent(url)
|
||||
}
|
||||
|
|
|
@ -58,7 +58,9 @@
|
|||
"dev": "npm run build && npm run start",
|
||||
"dockerdevbuild": "sh build.sh && npm run client-build && docker build --tag cosmos-dev .",
|
||||
"dockerdevrun": "docker stop cosmos-dev; docker rm cosmos-dev; docker run -d -p 80:80 -p 443:443 -e DOCKER_HOST=tcp://host.docker.internal:2375 -e COSMOS_HOSTNAME=localhost -e COSMOS_MONGODB=$MONGODB -e COSMOS_LOG_LEVEL=DEBUG --restart=unless-stopped -h cosmos-dev --name cosmos-dev cosmos-dev",
|
||||
"dockerdev": "npm run dockerdevbuild && npm run dockerdevrun"
|
||||
"dockerdev": "npm run dockerdevbuild && npm run dockerdevrun",
|
||||
"demo": "vite build --base=/ui/ --mode demo",
|
||||
"devdemo": "vite --mode demo"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
|
|
|
@ -17,6 +17,13 @@
|
|||
|
||||
Cosmos is a self-hosted platform for running server applications securely and with built-in privacy features. It acts as a secure gateway to your application, as well as a server manager. It aims to solve the increasingly worrying problem of vulnerable self-hosted applications and personal servers.
|
||||
|
||||
|
||||
<p align="center" style="margin-top: 50px; margin-bottom: 50px;">
|
||||
<a href="https://cosmos-cloud.io/" style="padding: 12px 24px; background-color: #6f42c1; color: #ffffff; border-radius: 4px; text-decoration: none;">Website</a>
|
||||
<a href="https://cosmos-cloud.io/doc" style="padding: 12px 24px; background-color: #000; color: #ffffff; border-radius: 4px; text-decoration: none; margin-left: 16px; margin-right: 16px;">Documentation / Getting Started</a>
|
||||
<a href="https://cosmos-cloud.io/ui" style="padding: 12px 24px; background-color: #000; color: #ffffff; border-radius: 4px; text-decoration: none;">Demo</a>
|
||||
</p>
|
||||
|
||||

|
||||
|
||||
Whether you have a **server**, a **NAS**, or a **Raspberry Pi** with applications such as **Plex**, **HomeAssistant** or even a blog, Cosmos is the perfect solution to secure them all. Simply install Cosmos on your server and connect to your applications through it to enjoy built-in security and robustness for all your services, right out of the box.
|
||||
|
|
BIN
schema.png
BIN
schema.png
Binary file not shown.
Before Width: | Height: | Size: 658 KiB After Width: | Height: | Size: 100 KiB |
BIN
screenshot1.png
BIN
screenshot1.png
Binary file not shown.
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 678 KiB |
Loading…
Add table
Reference in a new issue