commit
d653ad905c
35 changed files with 1169 additions and 164 deletions
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -42,6 +42,9 @@ jobs:
|
|||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Run global tests
|
||||
run: pnpm test
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm -r lint
|
||||
|
||||
|
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -7,6 +7,8 @@ traefik/ssl/*
|
|||
!traefik/ssl/.gitkeep
|
||||
!app-data/.gitkeep
|
||||
|
||||
scripts/pacapt
|
||||
|
||||
state/*
|
||||
!state/.gitkeep
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
pnpm test
|
||||
pnpm -r test
|
||||
pnpm -r lint
|
||||
|
|
23
README.md
23
README.md
|
@ -13,31 +13,35 @@
|
|||
Tipi is a personal homeserver orchestrator. It is running docker containers under the hood and provides a simple web interface to manage them. Every service comes with an opinionated configuration in order to remove the need for manual configuration and network setup.
|
||||
|
||||
## Apps available
|
||||
- [Adguard Home](https://github.com/AdguardTeam/AdGuardHome) - Adguard Home DNS adblocker
|
||||
- [Calibre-Web](https://github.com/janeczku/calibre-web) - Web Ebook Reader
|
||||
- [Code-Server](https://github.com/coder/code-server) - Web VS Code
|
||||
- [Filebrowser](https://github.com/filebrowser/filebrowser) - Web File Browser
|
||||
- [Freshrss](https://github.com/FreshRSS/FreshRSS) - A free, self-hostable RSS aggregator
|
||||
- [Gitea](https://github.com/go-gitea/gitea) - Gitea - A painless self-hosted Git service
|
||||
- [Homarr](https://github.com/ajnart/homarr) - A homepage for your server
|
||||
- [Home Assistant](https://github.com/home-assistant/core) - Open source home automation that puts local control and privacy first
|
||||
- [Invidious](https://github.com/iv-org/invidious) - An alternative front-end to YouTube
|
||||
- [Homarr](https://github.com/ajnart/homarr) - A homepage for your server.
|
||||
- [Jackett](https://github.com/Jackett/Jackett) - API Support for your favorite torrent trackers
|
||||
- [Jellyfin](https://github.com/jellyfin/jellyfin) - A media server for your home collection
|
||||
- [Joplin](https://github.com/laurent22/joplin) - Privacy focused note-taking app
|
||||
- [Libreddit](https://github.com/spikecodes/libreddit) - Private front-end for Reddit
|
||||
- [n8n](https://github.com/n8n-io/n8n) - Workflow Automation Tool
|
||||
- [Nextcloud](https://github.com/nextcloud/server) - A safe home for all your data
|
||||
- [Nitter](https://github.com/zedeus/nitter) - Alternative Twitter front-end
|
||||
- [Pihole](https://github.com/pi-hole/pi-hole) - A black hole for Internet advertisements
|
||||
- [Radarr](https://github.com/Radarr/Radarr) - Movie collection manager for Usenet and BitTorrent users.
|
||||
- [Prowlarr](https://github.com/Prowlarr/Prowlarr/) - A torrent/usenet indexer manager/proxy
|
||||
- [Radarr](https://github.com/Radarr/Radarr) - Movie collection manager for Usenet and BitTorrent users
|
||||
- [Sonarr](https://github.com/Sonarr/Sonarr) - TV show manager for Usenet and BitTorrent
|
||||
- [Syncthing](https://github.com/syncthing/syncthing) - Continuous File Synchronization
|
||||
- [Tailscale](https://github.com/tailscale/tailscale) - The easiest, most secure way to use WireGuard and 2FA.
|
||||
- [Tailscale](https://github.com/tailscale/tailscale) - The easiest, most secure way to use WireGuard and 2FA
|
||||
- [Tautulli](https://github.com/Tautulli/Tautulli) - A Python based monitoring and tracking tool for Plex Media Server
|
||||
- [Transmission](https://github.com/transmission/transmission) - Fast, easy, and free BitTorrent client
|
||||
- [Wireguard Easy](https://github.com/WeeJeWel/wg-easy) - WireGuard VPN + Web-based Admin UI
|
||||
- [Adguard Home](https://github.com/AdguardTeam/AdGuardHome) - Adguard Home DNS adblocker
|
||||
- [Libreddit](https://github.com/spikecodes/libreddit) - Private front-end for Reddit
|
||||
- [Nitter](https://github.com/zedeus/nitter) - Alternative Twitter front-end
|
||||
- [Vaultwarden](https://github.com/dani-garcia/vaultwarden) - Unofficial Bitwarden compatible server
|
||||
- [Prowlarr](https://github.com/Prowlarr/Prowlarr/) - A torrent/usenet indexer manager/proxy
|
||||
- [Gitea](https://github.com/go-gitea/gitea) - Gitea - A painless self-hosted Git service.
|
||||
|
||||
## 🛠 Installation
|
||||
|
||||
### Installation Requirements
|
||||
- Ubuntu 18.04 LTS or higher (or Debian 10)
|
||||
|
||||
|
@ -52,7 +56,8 @@ git clone https://github.com/meienberger/runtipi.git
|
|||
cd into the downloaded directory and run the start script.
|
||||
|
||||
```bash
|
||||
cd runtipi && sudo ./scripts/start.sh
|
||||
cd runtipi
|
||||
sudo ./scripts/start.sh
|
||||
```
|
||||
|
||||
The script will prompt you the ip address of the dashboard once configured.
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
0.2.0
|
||||
0.2.1
|
150
apps/__tests__/apps.test.ts
Normal file
150
apps/__tests__/apps.test.ts
Normal file
|
@ -0,0 +1,150 @@
|
|||
import fs from "fs";
|
||||
import jsyaml from "js-yaml";
|
||||
|
||||
interface AppConfig {
|
||||
id: string;
|
||||
port: number;
|
||||
requirements?: {
|
||||
ports?: number[];
|
||||
};
|
||||
name: string;
|
||||
description: string;
|
||||
version: string;
|
||||
image: string;
|
||||
short_desc: string;
|
||||
author: string;
|
||||
source: string;
|
||||
available: boolean;
|
||||
}
|
||||
|
||||
const networkExceptions = ["pihole", "tailscale", "homeassistant"];
|
||||
const getAppConfigs = (): AppConfig[] => {
|
||||
const apps: AppConfig[] = [];
|
||||
|
||||
const appsDir = fs.readdirSync("./apps");
|
||||
|
||||
appsDir.forEach((app) => {
|
||||
const path = `./apps/${app}/config.json`;
|
||||
|
||||
if (fs.existsSync(path)) {
|
||||
const configFile = fs.readFileSync(path).toString();
|
||||
|
||||
try {
|
||||
const config: AppConfig = JSON.parse(configFile);
|
||||
if (config.available) {
|
||||
apps.push(config);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error parsing config file", app);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return apps;
|
||||
};
|
||||
|
||||
describe("App configs", () => {
|
||||
it("Get app config should return at least one app", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
expect(apps.length).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("Each app should have an id", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
apps.forEach((app) => {
|
||||
expect(app.id).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
it("Each app should have a name", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
apps.forEach((app) => {
|
||||
expect(app.name).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
it("Each app should have a description", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
apps.forEach((app) => {
|
||||
expect(app.description).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
it("Each app should have a port", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
apps.forEach((app) => {
|
||||
expect(app.port).toBeDefined();
|
||||
expect(app.port).toBeGreaterThan(999);
|
||||
expect(app.port).toBeLessThan(65535);
|
||||
});
|
||||
});
|
||||
|
||||
it("Each app should have a different port", () => {
|
||||
const appConfigs = getAppConfigs();
|
||||
const ports = appConfigs.map((app) => app.port);
|
||||
expect(new Set(ports).size).toBe(appConfigs.length);
|
||||
});
|
||||
|
||||
it("Each app should have a unique id", () => {
|
||||
const appConfigs = getAppConfigs();
|
||||
const ids = appConfigs.map((app) => app.id);
|
||||
expect(new Set(ids).size).toBe(appConfigs.length);
|
||||
});
|
||||
|
||||
it("Each app should have a docker-compose file beside it", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
apps.forEach((app) => {
|
||||
expect(fs.existsSync(`./apps/${app.id}/docker-compose.yml`)).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it("Each app should have a container name equals to its id", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
apps.forEach((app) => {
|
||||
const dockerComposeFile = fs
|
||||
.readFileSync(`./apps/${app.id}/docker-compose.yml`)
|
||||
.toString();
|
||||
|
||||
const dockerCompose: any = jsyaml.load(dockerComposeFile);
|
||||
|
||||
if (!dockerCompose.services[app.id]) {
|
||||
console.error(app.id);
|
||||
}
|
||||
|
||||
expect(dockerCompose.services[app.id]).toBeDefined();
|
||||
expect(dockerCompose.services[app.id].container_name).toBe(app.id);
|
||||
});
|
||||
});
|
||||
|
||||
it("Each app should have network tipi_main_network", () => {
|
||||
const apps = getAppConfigs();
|
||||
|
||||
apps.forEach((app) => {
|
||||
if (!networkExceptions.includes(app.id)) {
|
||||
const dockerComposeFile = fs
|
||||
.readFileSync(`./apps/${app.id}/docker-compose.yml`)
|
||||
.toString();
|
||||
|
||||
const dockerCompose: any = jsyaml.load(dockerComposeFile);
|
||||
|
||||
expect(dockerCompose.services[app.id]).toBeDefined();
|
||||
|
||||
if (!dockerCompose.services[app.id].networks) {
|
||||
console.error(app.id);
|
||||
}
|
||||
|
||||
expect(dockerCompose.services[app.id].networks).toBeDefined();
|
||||
expect(dockerCompose.services[app.id].networks).toStrictEqual([
|
||||
"tipi_main_network",
|
||||
]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
version: "3.7"
|
||||
services:
|
||||
adguardhome:
|
||||
adguard:
|
||||
image: adguard/adguardhome:v0.107.6
|
||||
container_name: adguard
|
||||
volumes:
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
"id": "homarr",
|
||||
"description": "A homepage for your server.",
|
||||
"short_desc": "Homarr is a simple and lightweight homepage for your server, that helps you easily access all of your services in one place.",
|
||||
"author": "https://github.com/ajnart/",
|
||||
"source": "https://github.com/ajnart/homar",
|
||||
"author": "ajnart",
|
||||
"source": "https://github.com/ajnart/homarr",
|
||||
"website": "https://discord.gg/C2WTXkzkwK",
|
||||
"image": "https://raw.githubusercontent.com/ajnart/homarr/master/public/imgs/logo.png",
|
||||
"form_fields": {}
|
||||
|
|
12
apps/homeassistant/config.json
Normal file
12
apps/homeassistant/config.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "Home Assistant",
|
||||
"available": true,
|
||||
"port": 8123,
|
||||
"id": "homeassistant",
|
||||
"description": "Open source home automation that puts local control and privacy first. Powered by a worldwide community of tinkerers and DIY enthusiasts. Perfect to run on a Raspberry Pi or a local server.",
|
||||
"short_desc": "Open source home automation that puts local control and privacy first",
|
||||
"author": "ArneNaessens",
|
||||
"source": "https://github.com/home-assistant/core",
|
||||
"image": "https://avatars.githubusercontent.com/u/13844975?s=200&v=4",
|
||||
"form_fields": {}
|
||||
}
|
13
apps/homeassistant/docker-compose.yml
Normal file
13
apps/homeassistant/docker-compose.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
version: '3'
|
||||
services:
|
||||
homeassistant:
|
||||
container_name: homeassistant
|
||||
image: "ghcr.io/home-assistant/home-assistant:stable"
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/config:/config
|
||||
restart: unless-stopped
|
||||
privileged: true
|
||||
ports:
|
||||
- ${APP_PORT}:8123
|
||||
network_mode: host
|
|
@ -25,6 +25,8 @@ services:
|
|||
retries: 2
|
||||
depends_on:
|
||||
- invidious-db
|
||||
networks:
|
||||
- tipi_main_network
|
||||
|
||||
invidious-db:
|
||||
user: 1000:1000
|
||||
|
|
|
@ -26,6 +26,8 @@ services:
|
|||
retries: 2
|
||||
depends_on:
|
||||
- invidious-db
|
||||
networks:
|
||||
- tipi_main_network
|
||||
|
||||
invidious-db:
|
||||
user: 1000:1000
|
||||
|
|
12
apps/nodered/config.json
Normal file
12
apps/nodered/config.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "Node-RED",
|
||||
"port": 8111,
|
||||
"available": true,
|
||||
"id": "nodered",
|
||||
"description": "Node-RED is a programming tool for wiring together hardware devices, APIs and online services in new and interesting ways. It provides a browser-based editor that makes it easy to wire together flows using the wide range of nodes in the palette that can be deployed to its runtime in a single-click.",
|
||||
"short_desc": "Low-code programming for event-driven applications",
|
||||
"author": "node-red",
|
||||
"source": "https://github.com/node-red/node-red",
|
||||
"image": "https://avatars.githubusercontent.com/u/5375661?s=200&v=4",
|
||||
"form_fields": {}
|
||||
}
|
499
apps/nodered/data/settings.js
Normal file
499
apps/nodered/data/settings.js
Normal file
|
@ -0,0 +1,499 @@
|
|||
|
||||
/**
|
||||
* This is the default settings file provided by Node-RED.
|
||||
*
|
||||
* It can contain any valid JavaScript code that will get run when Node-RED
|
||||
* is started.
|
||||
*
|
||||
* Lines that start with // are commented out.
|
||||
* Each entry should be separated from the entries above and below by a comma ','
|
||||
*
|
||||
* For more information about individual settings, refer to the documentation:
|
||||
* https://nodered.org/docs/user-guide/runtime/configuration
|
||||
*
|
||||
* The settings are split into the following sections:
|
||||
* - Flow File and User Directory Settings
|
||||
* - Security
|
||||
* - Server Settings
|
||||
* - Runtime Settings
|
||||
* - Editor Settings
|
||||
* - Node Settings
|
||||
*
|
||||
**/
|
||||
|
||||
module.exports = {
|
||||
|
||||
/*******************************************************************************
|
||||
* Flow File and User Directory Settings
|
||||
* - flowFile
|
||||
* - credentialSecret
|
||||
* - flowFilePretty
|
||||
* - userDir
|
||||
* - nodesDir
|
||||
******************************************************************************/
|
||||
|
||||
/** The file containing the flows. If not set, defaults to flows_<hostname>.json **/
|
||||
flowFile: 'flows.json',
|
||||
|
||||
/** By default, credentials are encrypted in storage using a generated key. To
|
||||
* specify your own secret, set the following property.
|
||||
* If you want to disable encryption of credentials, set this property to false.
|
||||
* Note: once you set this property, do not change it - doing so will prevent
|
||||
* node-red from being able to decrypt your existing credentials and they will be
|
||||
* lost.
|
||||
*/
|
||||
//credentialSecret: "a-secret-key",
|
||||
|
||||
/** By default, the flow JSON will be formatted over multiple lines making
|
||||
* it easier to compare changes when using version control.
|
||||
* To disable pretty-printing of the JSON set the following property to false.
|
||||
*/
|
||||
flowFilePretty: true,
|
||||
|
||||
/** By default, all user data is stored in a directory called `.node-red` under
|
||||
* the user's home directory. To use a different location, the following
|
||||
* property can be used
|
||||
*/
|
||||
//userDir: '/home/nol/.node-red/',
|
||||
|
||||
/** Node-RED scans the `nodes` directory in the userDir to find local node files.
|
||||
* The following property can be used to specify an additional directory to scan.
|
||||
*/
|
||||
//nodesDir: '/home/nol/.node-red/nodes',
|
||||
|
||||
/*******************************************************************************
|
||||
* Security
|
||||
* - adminAuth
|
||||
* - https
|
||||
* - httpsRefreshInterval
|
||||
* - requireHttps
|
||||
* - httpNodeAuth
|
||||
* - httpStaticAuth
|
||||
******************************************************************************/
|
||||
|
||||
/** To password protect the Node-RED editor and admin API, the following
|
||||
* property can be used. See http://nodered.org/docs/security.html for details.
|
||||
*/
|
||||
//adminAuth: {
|
||||
// type: "credentials",
|
||||
// users: [{
|
||||
// username: "admin",
|
||||
// password: "$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN.",
|
||||
// permissions: "*"
|
||||
// }]
|
||||
//},
|
||||
|
||||
/** The following property can be used to enable HTTPS
|
||||
* This property can be either an object, containing both a (private) key
|
||||
* and a (public) certificate, or a function that returns such an object.
|
||||
* See http://nodejs.org/api/https.html#https_https_createserver_options_requestlistener
|
||||
* for details of its contents.
|
||||
*/
|
||||
|
||||
/** Option 1: static object */
|
||||
//https: {
|
||||
// key: require("fs").readFileSync('privkey.pem'),
|
||||
// cert: require("fs").readFileSync('cert.pem')
|
||||
//},
|
||||
|
||||
/** Option 2: function that returns the HTTP configuration object */
|
||||
// https: function() {
|
||||
// // This function should return the options object, or a Promise
|
||||
// // that resolves to the options object
|
||||
// return {
|
||||
// key: require("fs").readFileSync('privkey.pem'),
|
||||
// cert: require("fs").readFileSync('cert.pem')
|
||||
// }
|
||||
// },
|
||||
|
||||
/** If the `https` setting is a function, the following setting can be used
|
||||
* to set how often, in hours, the function will be called. That can be used
|
||||
* to refresh any certificates.
|
||||
*/
|
||||
//httpsRefreshInterval : 12,
|
||||
|
||||
/** The following property can be used to cause insecure HTTP connections to
|
||||
* be redirected to HTTPS.
|
||||
*/
|
||||
//requireHttps: true,
|
||||
|
||||
/** To password protect the node-defined HTTP endpoints (httpNodeRoot),
|
||||
* including node-red-dashboard, or the static content (httpStatic), the
|
||||
* following properties can be used.
|
||||
* The `pass` field is a bcrypt hash of the password.
|
||||
* See http://nodered.org/docs/security.html#generating-the-password-hash
|
||||
*/
|
||||
//httpNodeAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
|
||||
//httpStaticAuth: {user:"user",pass:"$2a$08$zZWtXTja0fB1pzD4sHCMyOCMYz2Z6dNbM6tl8sJogENOMcxWV9DN."},
|
||||
|
||||
/*******************************************************************************
|
||||
* Server Settings
|
||||
* - uiPort
|
||||
* - uiHost
|
||||
* - apiMaxLength
|
||||
* - httpServerOptions
|
||||
* - httpAdminRoot
|
||||
* - httpAdminMiddleware
|
||||
* - httpNodeRoot
|
||||
* - httpNodeCors
|
||||
* - httpNodeMiddleware
|
||||
* - httpStatic
|
||||
******************************************************************************/
|
||||
|
||||
/** the tcp port that the Node-RED web server is listening on */
|
||||
uiPort: process.env.PORT || 1880,
|
||||
|
||||
/** By default, the Node-RED UI accepts connections on all IPv4 interfaces.
|
||||
* To listen on all IPv6 addresses, set uiHost to "::",
|
||||
* The following property can be used to listen on a specific interface. For
|
||||
* example, the following would only allow connections from the local machine.
|
||||
*/
|
||||
//uiHost: "127.0.0.1",
|
||||
|
||||
/** The maximum size of HTTP request that will be accepted by the runtime api.
|
||||
* Default: 5mb
|
||||
*/
|
||||
//apiMaxLength: '5mb',
|
||||
|
||||
/** The following property can be used to pass custom options to the Express.js
|
||||
* server used by Node-RED. For a full list of available options, refer
|
||||
* to http://expressjs.com/en/api.html#app.settings.table
|
||||
*/
|
||||
//httpServerOptions: { },
|
||||
|
||||
/** By default, the Node-RED UI is available at http://localhost:1880/
|
||||
* The following property can be used to specify a different root path.
|
||||
* If set to false, this is disabled.
|
||||
*/
|
||||
//httpAdminRoot: '/admin',
|
||||
|
||||
/** The following property can be used to add a custom middleware function
|
||||
* in front of all admin http routes. For example, to set custom http
|
||||
* headers. It can be a single function or an array of middleware functions.
|
||||
*/
|
||||
// httpAdminMiddleware: function(req,res,next) {
|
||||
// // Set the X-Frame-Options header to limit where the editor
|
||||
// // can be embedded
|
||||
// //res.set('X-Frame-Options', 'sameorigin');
|
||||
// next();
|
||||
// },
|
||||
|
||||
|
||||
/** Some nodes, such as HTTP In, can be used to listen for incoming http requests.
|
||||
* By default, these are served relative to '/'. The following property
|
||||
* can be used to specifiy a different root path. If set to false, this is
|
||||
* disabled.
|
||||
*/
|
||||
//httpNodeRoot: '/red-nodes',
|
||||
|
||||
/** The following property can be used to configure cross-origin resource sharing
|
||||
* in the HTTP nodes.
|
||||
* See https://github.com/troygoode/node-cors#configuration-options for
|
||||
* details on its contents. The following is a basic permissive set of options:
|
||||
*/
|
||||
//httpNodeCors: {
|
||||
// origin: "*",
|
||||
// methods: "GET,PUT,POST,DELETE"
|
||||
//},
|
||||
|
||||
/** If you need to set an http proxy please set an environment variable
|
||||
* called http_proxy (or HTTP_PROXY) outside of Node-RED in the operating system.
|
||||
* For example - http_proxy=http://myproxy.com:8080
|
||||
* (Setting it here will have no effect)
|
||||
* You may also specify no_proxy (or NO_PROXY) to supply a comma separated
|
||||
* list of domains to not proxy, eg - no_proxy=.acme.co,.acme.co.uk
|
||||
*/
|
||||
|
||||
/** The following property can be used to add a custom middleware function
|
||||
* in front of all http in nodes. This allows custom authentication to be
|
||||
* applied to all http in nodes, or any other sort of common request processing.
|
||||
* It can be a single function or an array of middleware functions.
|
||||
*/
|
||||
//httpNodeMiddleware: function(req,res,next) {
|
||||
// // Handle/reject the request, or pass it on to the http in node by calling next();
|
||||
// // Optionally skip our rawBodyParser by setting this to true;
|
||||
// //req.skipRawBodyParser = true;
|
||||
// next();
|
||||
//},
|
||||
|
||||
/** When httpAdminRoot is used to move the UI to a different root path, the
|
||||
* following property can be used to identify a directory of static content
|
||||
* that should be served at http://localhost:1880/.
|
||||
*/
|
||||
//httpStatic: '/home/nol/node-red-static/',
|
||||
|
||||
/*******************************************************************************
|
||||
* Runtime Settings
|
||||
* - lang
|
||||
* - logging
|
||||
* - contextStorage
|
||||
* - exportGlobalContextKeys
|
||||
* - externalModules
|
||||
******************************************************************************/
|
||||
|
||||
/** Uncomment the following to run node-red in your preferred language.
|
||||
* Available languages include: en-US (default), ja, de, zh-CN, zh-TW, ru, ko
|
||||
* Some languages are more complete than others.
|
||||
*/
|
||||
// lang: "de",
|
||||
|
||||
/** Configure the logging output */
|
||||
logging: {
|
||||
/** Only console logging is currently supported */
|
||||
console: {
|
||||
/** Level of logging to be recorded. Options are:
|
||||
* fatal - only those errors which make the application unusable should be recorded
|
||||
* error - record errors which are deemed fatal for a particular request + fatal errors
|
||||
* warn - record problems which are non fatal + errors + fatal errors
|
||||
* info - record information about the general running of the application + warn + error + fatal errors
|
||||
* debug - record information which is more verbose than info + info + warn + error + fatal errors
|
||||
* trace - record very detailed logging + debug + info + warn + error + fatal errors
|
||||
* off - turn off all logging (doesn't affect metrics or audit)
|
||||
*/
|
||||
level: "info",
|
||||
/** Whether or not to include metric events in the log output */
|
||||
metrics: false,
|
||||
/** Whether or not to include audit events in the log output */
|
||||
audit: false
|
||||
}
|
||||
},
|
||||
|
||||
/** Context Storage
|
||||
* The following property can be used to enable context storage. The configuration
|
||||
* provided here will enable file-based context that flushes to disk every 30 seconds.
|
||||
* Refer to the documentation for further options: https://nodered.org/docs/api/context/
|
||||
*/
|
||||
//contextStorage: {
|
||||
// default: {
|
||||
// module:"localfilesystem"
|
||||
// },
|
||||
//},
|
||||
|
||||
/** `global.keys()` returns a list of all properties set in global context.
|
||||
* This allows them to be displayed in the Context Sidebar within the editor.
|
||||
* In some circumstances it is not desirable to expose them to the editor. The
|
||||
* following property can be used to hide any property set in `functionGlobalContext`
|
||||
* from being list by `global.keys()`.
|
||||
* By default, the property is set to false to avoid accidental exposure of
|
||||
* their values. Setting this to true will cause the keys to be listed.
|
||||
*/
|
||||
exportGlobalContextKeys: false,
|
||||
|
||||
/** Configure how the runtime will handle external npm modules.
|
||||
* This covers:
|
||||
* - whether the editor will allow new node modules to be installed
|
||||
* - whether nodes, such as the Function node are allowed to have their
|
||||
* own dynamically configured dependencies.
|
||||
* The allow/denyList options can be used to limit what modules the runtime
|
||||
* will install/load. It can use '*' as a wildcard that matches anything.
|
||||
*/
|
||||
externalModules: {
|
||||
// autoInstall: false, /** Whether the runtime will attempt to automatically install missing modules */
|
||||
// autoInstallRetry: 30, /** Interval, in seconds, between reinstall attempts */
|
||||
// palette: { /** Configuration for the Palette Manager */
|
||||
// allowInstall: true, /** Enable the Palette Manager in the editor */
|
||||
// allowUpdate: true, /** Allow modules to be updated in the Palette Manager */
|
||||
// allowUpload: true, /** Allow module tgz files to be uploaded and installed */
|
||||
// allowList: ['*'],
|
||||
// denyList: [],
|
||||
// allowUpdateList: ['*'],
|
||||
// denyUpdateList: []
|
||||
// },
|
||||
// modules: { /** Configuration for node-specified modules */
|
||||
// allowInstall: true,
|
||||
// allowList: [],
|
||||
// denyList: []
|
||||
// }
|
||||
},
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
* Editor Settings
|
||||
* - disableEditor
|
||||
* - editorTheme
|
||||
******************************************************************************/
|
||||
|
||||
/** The following property can be used to disable the editor. The admin API
|
||||
* is not affected by this option. To disable both the editor and the admin
|
||||
* API, use either the httpRoot or httpAdminRoot properties
|
||||
*/
|
||||
//disableEditor: false,
|
||||
|
||||
/** Customising the editor
|
||||
* See https://nodered.org/docs/user-guide/runtime/configuration#editor-themes
|
||||
* for all available options.
|
||||
*/
|
||||
editorTheme: {
|
||||
/** The following property can be used to set a custom theme for the editor.
|
||||
* See https://github.com/node-red-contrib-themes/theme-collection for
|
||||
* a collection of themes to chose from.
|
||||
*/
|
||||
//theme: "",
|
||||
|
||||
/** To disable the 'Welcome to Node-RED' tour that is displayed the first
|
||||
* time you access the editor for each release of Node-RED, set this to false
|
||||
*/
|
||||
//tours: false,
|
||||
|
||||
palette: {
|
||||
/** The following property can be used to order the categories in the editor
|
||||
* palette. If a node's category is not in the list, the category will get
|
||||
* added to the end of the palette.
|
||||
* If not set, the following default order is used:
|
||||
*/
|
||||
//categories: ['subflows', 'common', 'function', 'network', 'sequence', 'parser', 'storage'],
|
||||
},
|
||||
|
||||
projects: {
|
||||
/** To enable the Projects feature, set this value to true */
|
||||
enabled: false,
|
||||
workflow: {
|
||||
/** Set the default projects workflow mode.
|
||||
* - manual - you must manually commit changes
|
||||
* - auto - changes are automatically committed
|
||||
* This can be overridden per-user from the 'Git config'
|
||||
* section of 'User Settings' within the editor
|
||||
*/
|
||||
mode: "manual"
|
||||
}
|
||||
},
|
||||
|
||||
codeEditor: {
|
||||
/** Select the text editor component used by the editor.
|
||||
* Defaults to "ace", but can be set to "ace" or "monaco"
|
||||
*/
|
||||
lib: "ace",
|
||||
options: {
|
||||
/** The follow options only apply if the editor is set to "monaco"
|
||||
*
|
||||
* theme - must match the file name of a theme in
|
||||
* packages/node_modules/@node-red/editor-client/src/vendor/monaco/dist/theme
|
||||
* e.g. "tomorrow-night", "upstream-sunburst", "github", "my-theme"
|
||||
*/
|
||||
theme: "vs",
|
||||
/** other overrides can be set e.g. fontSize, fontFamily, fontLigatures etc.
|
||||
* for the full list, see https://microsoft.github.io/monaco-editor/api/interfaces/monaco.editor.istandaloneeditorconstructionoptions.html
|
||||
*/
|
||||
//fontSize: 14,
|
||||
//fontFamily: "Cascadia Code, Fira Code, Consolas, 'Courier New', monospace",
|
||||
//fontLigatures: true,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/*******************************************************************************
|
||||
* Node Settings
|
||||
* - fileWorkingDirectory
|
||||
* - functionGlobalContext
|
||||
* - functionExternalModules
|
||||
* - nodeMessageBufferMaxLength
|
||||
* - ui (for use with Node-RED Dashboard)
|
||||
* - debugUseColors
|
||||
* - debugMaxLength
|
||||
* - execMaxBufferSize
|
||||
* - httpRequestTimeout
|
||||
* - mqttReconnectTime
|
||||
* - serialReconnectTime
|
||||
* - socketReconnectTime
|
||||
* - socketTimeout
|
||||
* - tcpMsgQueueSize
|
||||
* - inboundWebSocketTimeout
|
||||
* - tlsConfigDisableLocalFiles
|
||||
* - webSocketNodeVerifyClient
|
||||
******************************************************************************/
|
||||
|
||||
/** The working directory to handle relative file paths from within the File nodes
|
||||
* defaults to the working directory of the Node-RED process.
|
||||
*/
|
||||
//fileWorkingDirectory: "",
|
||||
|
||||
/** Allow the Function node to load additional npm modules directly */
|
||||
functionExternalModules: true,
|
||||
|
||||
/** The following property can be used to set predefined values in Global Context.
|
||||
* This allows extra node modules to be made available with in Function node.
|
||||
* For example, the following:
|
||||
* functionGlobalContext: { os:require('os') }
|
||||
* will allow the `os` module to be accessed in a Function node using:
|
||||
* global.get("os")
|
||||
*/
|
||||
functionGlobalContext: {
|
||||
// os:require('os'),
|
||||
},
|
||||
|
||||
/** The maximum number of messages nodes will buffer internally as part of their
|
||||
* operation. This applies across a range of nodes that operate on message sequences.
|
||||
* defaults to no limit. A value of 0 also means no limit is applied.
|
||||
*/
|
||||
//nodeMessageBufferMaxLength: 0,
|
||||
|
||||
/** If you installed the optional node-red-dashboard you can set it's path
|
||||
* relative to httpNodeRoot
|
||||
* Other optional properties include
|
||||
* readOnly:{boolean},
|
||||
* middleware:{function or array}, (req,res,next) - http middleware
|
||||
* ioMiddleware:{function or array}, (socket,next) - socket.io middleware
|
||||
*/
|
||||
//ui: { path: "ui" },
|
||||
|
||||
/** Colourise the console output of the debug node */
|
||||
//debugUseColors: true,
|
||||
|
||||
/** The maximum length, in characters, of any message sent to the debug sidebar tab */
|
||||
debugMaxLength: 1000,
|
||||
|
||||
/** Maximum buffer size for the exec node. Defaults to 10Mb */
|
||||
//execMaxBufferSize: 10000000,
|
||||
|
||||
/** Timeout in milliseconds for HTTP request connections. Defaults to 120s */
|
||||
//httpRequestTimeout: 120000,
|
||||
|
||||
/** Retry time in milliseconds for MQTT connections */
|
||||
mqttReconnectTime: 15000,
|
||||
|
||||
/** Retry time in milliseconds for Serial port connections */
|
||||
serialReconnectTime: 15000,
|
||||
|
||||
/** Retry time in milliseconds for TCP socket connections */
|
||||
//socketReconnectTime: 10000,
|
||||
|
||||
/** Timeout in milliseconds for TCP server socket connections. Defaults to no timeout */
|
||||
//socketTimeout: 120000,
|
||||
|
||||
/** Maximum number of messages to wait in queue while attempting to connect to TCP socket
|
||||
* defaults to 1000
|
||||
*/
|
||||
//tcpMsgQueueSize: 2000,
|
||||
|
||||
/** Timeout in milliseconds for inbound WebSocket connections that do not
|
||||
* match any configured node. Defaults to 5000
|
||||
*/
|
||||
//inboundWebSocketTimeout: 5000,
|
||||
|
||||
/** To disable the option for using local files for storing keys and
|
||||
* certificates in the TLS configuration node, set this to true.
|
||||
*/
|
||||
//tlsConfigDisableLocalFiles: true,
|
||||
|
||||
/** The following property can be used to verify websocket connection attempts.
|
||||
* This allows, for example, the HTTP request headers to be checked to ensure
|
||||
* they include valid authentication information.
|
||||
*/
|
||||
//webSocketNodeVerifyClient: function(info) {
|
||||
// /** 'info' has three properties:
|
||||
// * - origin : the value in the Origin header
|
||||
// * - req : the HTTP request
|
||||
// * - secure : true if req.connection.authorized or req.connection.encrypted is set
|
||||
// *
|
||||
// * The function should return true if the connection should be accepted, false otherwise.
|
||||
// *
|
||||
// * Alternatively, if this function is defined to accept a second argument, callback,
|
||||
// * it can be used to verify the client asynchronously.
|
||||
// * The callback takes three arguments:
|
||||
// * - result : boolean, whether to accept the connection or not
|
||||
// * - code : if result is false, the HTTP error status to return
|
||||
// * - reason: if result is false, the HTTP reason string to return
|
||||
// */
|
||||
//},
|
||||
}
|
||||
|
13
apps/nodered/docker-compose.yml
Normal file
13
apps/nodered/docker-compose.yml
Normal file
|
@ -0,0 +1,13 @@
|
|||
version: "3.7"
|
||||
|
||||
services:
|
||||
nodered:
|
||||
container_name: nodered
|
||||
image: nodered/node-red:2.2.2-12
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- ${APP_PORT}:1880
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/data:/data
|
||||
networks:
|
||||
- tipi_main_network
|
21
apps/photoprism/config.json
Normal file
21
apps/photoprism/config.json
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"name": "PhotoPrism",
|
||||
"port": 8110,
|
||||
"available": true,
|
||||
"id": "photoprism",
|
||||
"description": "PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. It makes use of the latest technologies to tag and find pictures automatically without getting in your way. You can run it at home, on a private server, or in the cloud. Default username: admin",
|
||||
"short_desc": "AI-Powered Photos App for the Decentralized Web. We are on a mission to protect your freedom and privacy.",
|
||||
"author": "PhotoPrism",
|
||||
"source": "https://github.com/photoprism/photoprism",
|
||||
"image": "https://avatars.githubusercontent.com/u/32436079?s=200&v=4",
|
||||
"form_fields": {
|
||||
"password": {
|
||||
"type": "password",
|
||||
"label": "Photoprism admin password",
|
||||
"max": 50,
|
||||
"min": 8,
|
||||
"required": true,
|
||||
"env_variable": "PHOTOPRISM_ADMIN_PASSWORD"
|
||||
}
|
||||
}
|
||||
}
|
58
apps/photoprism/docker-compose.yml
Normal file
58
apps/photoprism/docker-compose.yml
Normal file
|
@ -0,0 +1,58 @@
|
|||
version: "3.7"
|
||||
|
||||
services:
|
||||
photoprism:
|
||||
image: photoprism/photoprism:latest
|
||||
container_name: photoprism
|
||||
depends_on:
|
||||
- photoprism-db
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "${APP_PORT}:2342"
|
||||
environment:
|
||||
PHOTOPRISM_ADMIN_PASSWORD: ${PHOTOPRISM_ADMIN_PASSWORD}
|
||||
PHOTOPRISM_SITE_URL: "http://localhost:2342/"
|
||||
PHOTOPRISM_ORIGINALS_LIMIT: 5000
|
||||
PHOTOPRISM_HTTP_COMPRESSION: "gzip"
|
||||
PHOTOPRISM_LOG_LEVEL: "info"
|
||||
PHOTOPRISM_PUBLIC: "false"
|
||||
PHOTOPRISM_READONLY: "false"
|
||||
PHOTOPRISM_EXPERIMENTAL: "false"
|
||||
PHOTOPRISM_DISABLE_CHOWN: "false"
|
||||
PHOTOPRISM_DISABLE_WEBDAV: "false"
|
||||
PHOTOPRISM_DISABLE_SETTINGS: "false"
|
||||
PHOTOPRISM_DISABLE_TENSORFLOW: "false"
|
||||
PHOTOPRISM_DISABLE_FACES: "false"
|
||||
PHOTOPRISM_DISABLE_CLASSIFICATION: "false"
|
||||
PHOTOPRISM_DISABLE_RAW: "false"
|
||||
PHOTOPRISM_RAW_PRESETS: "false"
|
||||
PHOTOPRISM_JPEG_QUALITY: 85
|
||||
PHOTOPRISM_DETECT_NSFW: "false"
|
||||
PHOTOPRISM_UPLOAD_NSFW: "true"
|
||||
PHOTOPRISM_DATABASE_DRIVER: "mysql"
|
||||
PHOTOPRISM_DATABASE_SERVER: "photoprism-db:3306"
|
||||
PHOTOPRISM_DATABASE_NAME: "photoprism"
|
||||
PHOTOPRISM_DATABASE_USER: "photoprism"
|
||||
PHOTOPRISM_DATABASE_PASSWORD: "photoprism"
|
||||
PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
|
||||
working_dir: "/photoprism"
|
||||
volumes:
|
||||
- "${APP_DATA_DIR}/data/photoprism/originals:/photoprism/originals"
|
||||
- "${APP_DATA_DIR}/data/photoprism/storage:/photoprism/storage"
|
||||
networks:
|
||||
- tipi_main_network
|
||||
|
||||
photoprism-db:
|
||||
restart: unless-stopped
|
||||
image: mariadb:10.8.3
|
||||
container_name: photoprism-db
|
||||
command: mysqld --innodb-buffer-pool-size=128M --transaction-isolation=READ-COMMITTED --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120
|
||||
volumes:
|
||||
- "${APP_DATA_DIR}/data/mariadb:/var/lib/mysql"
|
||||
environment:
|
||||
MARIADB_DATABASE: "photoprism"
|
||||
MARIADB_USER: "photoprism"
|
||||
MARIADB_PASSWORD: "photoprism"
|
||||
MARIADB_ROOT_PASSWORD: "photoprism"
|
||||
networks:
|
||||
- tipi_main_network
|
|
@ -5,7 +5,8 @@ services:
|
|||
image: ghcr.io/linuxserver/prowlarr:develop
|
||||
environment:
|
||||
- TZ=${TZ} # Can use any env variable. List in runtipi/templates/env-sample
|
||||
- DNS_IP=${DNS_IP}
|
||||
dns:
|
||||
- ${DNS_IP}
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/data/config:/config #Always start the path with ${APP_DATA_DIR}. This will put all data inside app-data/my-app/data
|
||||
ports:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
version: "3.7"
|
||||
services:
|
||||
radarr:
|
||||
sonarr:
|
||||
image: lscr.io/linuxserver/sonarr
|
||||
container_name: sonarr
|
||||
environment:
|
||||
|
|
12
apps/tautulli/config.json
Normal file
12
apps/tautulli/config.json
Normal file
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "Tautulli",
|
||||
"available": true,
|
||||
"port": 8181,
|
||||
"id": "tautulli",
|
||||
"description": "Tautulli is a 3rd party application that you can run alongside your Plex Media Server to monitor activity and track various statistics. Most importantly, these statistics include what has been watched, who watched it, when and where they watched it, and how it was watched. The only thing missing is \"why they watched it\", but who am I to question your 42 plays of Frozen. All statistics are presented in a nice and clean interface with many tables and graphs, which makes it easy to brag about your server to everyone else.",
|
||||
"short_desc": "A Python based monitoring and tracking tool for Plex Media Server.",
|
||||
"author": "JonnyWong16",
|
||||
"source": "https://github.com/Tautulli/Tautulli",
|
||||
"image": "https://tautulli.com/images/logo-circle.png",
|
||||
"form_fields": {}
|
||||
}
|
16
apps/tautulli/docker-compose.yml
Normal file
16
apps/tautulli/docker-compose.yml
Normal file
|
@ -0,0 +1,16 @@
|
|||
version: "2.1"
|
||||
services:
|
||||
tautulli:
|
||||
container_name: tautulli
|
||||
image: lscr.io/linuxserver/tautulli:latest
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
- TZ=${TZ} # Can use any env variable. List in runtipi/templates/env-sample
|
||||
volumes:
|
||||
- ${APP_DATA_DIR}/data/config:/config
|
||||
ports:
|
||||
- ${APP_PORT}:8181
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- tipi_main_network
|
|
@ -3,6 +3,8 @@ services:
|
|||
transmission:
|
||||
image: lscr.io/linuxserver/transmission
|
||||
container_name: transmission
|
||||
dns:
|
||||
- ${DNS_IP}
|
||||
environment:
|
||||
- PUID=1000
|
||||
- PGID=1000
|
||||
|
@ -16,7 +18,6 @@ services:
|
|||
volumes:
|
||||
- ${APP_DATA_DIR}/data/config:/config
|
||||
- ${ROOT_FOLDER_HOST}/media/torrents:/downloads
|
||||
- ${ROOT_FOLDER_HOST}/media/torrents/watch:/watch
|
||||
ports:
|
||||
- ${APP_PORT}:9091
|
||||
- 51413:51413
|
||||
|
|
|
@ -19,6 +19,7 @@ services:
|
|||
- TIPI_VERSION=${TIPI_VERSION}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST}
|
||||
- NGINX_PORT=${NGINX_PORT}
|
||||
networks:
|
||||
- tipi_main_network
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ services:
|
|||
- TIPI_VERSION=${TIPI_VERSION}
|
||||
- JWT_SECRET=${JWT_SECRET}
|
||||
- ROOT_FOLDER_HOST=${ROOT_FOLDER_HOST}
|
||||
- NGINX_PORT=${NGINX_PORT}
|
||||
networks:
|
||||
- tipi_main_network
|
||||
|
||||
|
|
7
jest.config.js
Normal file
7
jest.config.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
|
||||
module.exports = {
|
||||
preset: "ts-jest",
|
||||
testEnvironment: "node",
|
||||
testMatch: ["**/__tests__/**/*.test.ts"],
|
||||
testPathIgnorePatterns: ["/node_modules/", "/packages/"],
|
||||
};
|
13
package.json
13
package.json
|
@ -1,8 +1,9 @@
|
|||
{
|
||||
"name": "runtipi",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"description": "A homeserver for everyone",
|
||||
"scripts": {
|
||||
"test": "jest",
|
||||
"prepare": "husky install",
|
||||
"act:test-install": "act --container-architecture linux/amd64 -j test-install",
|
||||
"act:docker": "act --container-architecture linux/amd64 --secret-file github.secrets -j docker",
|
||||
|
@ -10,9 +11,15 @@
|
|||
"start:rc": "docker-compose -f docker-compose.rc.yml --env-file .env up --build",
|
||||
"start:prod": "docker-compose --env-file .env up --build"
|
||||
},
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"husky": "^8.0.1"
|
||||
"@types/jest": "^27.5.0",
|
||||
"@types/js-yaml": "^4.0.5",
|
||||
"@types/node": "17.0.31",
|
||||
"husky": "^8.0.1",
|
||||
"jest": "^28.1.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"ts-jest": "^28.0.2",
|
||||
"typescript": "4.6.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "dashboard",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
|
|
@ -1,27 +1,69 @@
|
|||
import validator from 'validator';
|
||||
import { AppConfig, FieldTypes } from '../../core/types';
|
||||
|
||||
const validateField = (field: AppConfig['form_fields'][0], value: string): string | undefined => {
|
||||
if (field.required && !value) {
|
||||
return `${field.label} is required`;
|
||||
}
|
||||
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (field.type) {
|
||||
case FieldTypes.text:
|
||||
if (field.max && value.length > field.max) {
|
||||
return `${field.label} must be less than ${field.max} characters`;
|
||||
}
|
||||
if (field.min && value.length < field.min) {
|
||||
return `${field.label} must be at least ${field.min} characters`;
|
||||
}
|
||||
break;
|
||||
case FieldTypes.password:
|
||||
if (!validator.isLength(value, { min: field.min, max: field.max })) {
|
||||
return `${field.label} must be between ${field.min} and ${field.max} characters`;
|
||||
}
|
||||
break;
|
||||
case FieldTypes.email:
|
||||
if (!validator.isEmail(value)) {
|
||||
return `${field.label} must be a valid email address`;
|
||||
}
|
||||
break;
|
||||
case FieldTypes.number:
|
||||
if (!validator.isNumeric(value)) {
|
||||
return `${field.label} must be a number`;
|
||||
}
|
||||
break;
|
||||
case FieldTypes.fqdn:
|
||||
if (!validator.isFQDN(value)) {
|
||||
return `${field.label} must be a valid domain`;
|
||||
}
|
||||
break;
|
||||
case FieldTypes.ip:
|
||||
if (!validator.isIP(value)) {
|
||||
return `${field.label} must be a valid IP address`;
|
||||
}
|
||||
break;
|
||||
case FieldTypes.fqdnip:
|
||||
if (!validator.isFQDN(value || '') && !validator.isIP(value)) {
|
||||
return `${field.label} must be a valid domain or IP address`;
|
||||
}
|
||||
break;
|
||||
case FieldTypes.url:
|
||||
if (!validator.isURL(value)) {
|
||||
return `${field.label} must be a valid URL`;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
||||
export const validateAppConfig = (values: Record<string, string>, fields: (AppConfig['form_fields'][0] & { id: string })[]) => {
|
||||
const errors: any = {};
|
||||
|
||||
fields.forEach((field) => {
|
||||
if (field.required && !values[field.id]) {
|
||||
errors[field.id] = 'Field required';
|
||||
} else if (values[field.id] && field.min && values[field.id].length < field.min) {
|
||||
errors[field.id] = `Field must be at least ${field.min} characters long`;
|
||||
} else if (values[field.id] && field.max && values[field.id].length > field.max) {
|
||||
errors[field.id] = `Field must be at most ${field.max} characters long`;
|
||||
} else if (values[field.id] && field.type === FieldTypes.number && !validator.isNumeric(values[field.id])) {
|
||||
errors[field.id] = 'Field must be a number';
|
||||
} else if (values[field.id] && field.type === FieldTypes.email && !validator.isEmail(values[field.id])) {
|
||||
errors[field.id] = 'Field must be a valid email';
|
||||
} else if (values[field.id] && field.type === FieldTypes.fqdn && !validator.isFQDN(values[field.id] || '')) {
|
||||
errors[field.id] = 'Field must be a valid domain';
|
||||
} else if (values[field.id] && field.type === FieldTypes.ip && !validator.isIP(values[field.id])) {
|
||||
errors[field.id] = 'Field must be a valid IP address';
|
||||
} else if (values[field.id] && field.type === FieldTypes.fqdnip && !validator.isFQDN(values[field.id] || '') && !validator.isIP(values[field.id])) {
|
||||
errors[field.id] = 'Field must be a valid domain or IP address';
|
||||
}
|
||||
errors[field.id] = validateField(field, values[field.id]);
|
||||
});
|
||||
|
||||
return errors;
|
||||
|
|
|
@ -6,6 +6,7 @@ export enum FieldTypes {
|
|||
fqdn = 'fqdn',
|
||||
ip = 'ip',
|
||||
fqdnip = 'fqdnip',
|
||||
url = 'url',
|
||||
}
|
||||
|
||||
interface FormField {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "system-api",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"description": "",
|
||||
"exports": "./dist/server.js",
|
||||
"type": "module",
|
||||
|
|
282
pnpm-lock.yaml
generated
282
pnpm-lock.yaml
generated
|
@ -4,9 +4,23 @@ importers:
|
|||
|
||||
.:
|
||||
specifiers:
|
||||
'@types/jest': ^27.5.0
|
||||
'@types/js-yaml': ^4.0.5
|
||||
'@types/node': 17.0.31
|
||||
husky: ^8.0.1
|
||||
jest: ^28.1.0
|
||||
js-yaml: ^4.1.0
|
||||
ts-jest: ^28.0.2
|
||||
typescript: 4.6.4
|
||||
devDependencies:
|
||||
'@types/jest': 27.5.0
|
||||
'@types/js-yaml': 4.0.5
|
||||
'@types/node': 17.0.31
|
||||
husky: 8.0.1
|
||||
jest: 28.1.0_@types+node@17.0.31
|
||||
js-yaml: 4.1.0
|
||||
ts-jest: 28.0.2_z3fx76c5ksuwr36so7o5uc2kcy
|
||||
typescript: 4.6.4
|
||||
|
||||
packages/dashboard:
|
||||
specifiers:
|
||||
|
@ -78,7 +92,7 @@ importers:
|
|||
eslint: 8.12.0
|
||||
eslint-config-airbnb-typescript: 17.0.0_r46exuh3jlhq2wmrnqx2ufqspa
|
||||
eslint-config-next: 12.1.4_e6a2zi6fqdwfehht5cxvkmo3zu
|
||||
eslint-plugin-import: 2.26.0_eslint@8.12.0
|
||||
eslint-plugin-import: 2.26.0_hhyjdrupy4c2vgtpytri6cjwoy
|
||||
postcss: 8.4.13
|
||||
tailwindcss: 3.0.24
|
||||
typescript: 4.6.4
|
||||
|
@ -171,7 +185,7 @@ importers:
|
|||
eslint: 8.15.0
|
||||
eslint-config-airbnb-typescript: 17.0.0_c2ouaf3l4ivgkc6ae4nebvztom
|
||||
eslint-config-prettier: 8.5.0_eslint@8.15.0
|
||||
eslint-plugin-import: 2.26.0_eslint@8.15.0
|
||||
eslint-plugin-import: 2.26.0_6nacgdzqm4zbhelsxkmd2vkvxy
|
||||
eslint-plugin-prettier: 4.0.0_iqftbjqlxzn3ny5nablrkczhqi
|
||||
jest: 28.1.0
|
||||
nodemon: 2.0.16
|
||||
|
@ -2104,6 +2118,10 @@ packages:
|
|||
resolution: {integrity: sha512-6+0ekgfusHftJNYpihfkMu8BWdeHs9EOJuGcSofErjstGPfPGEu9yTu4t460lTzzAMl2cM5zngQJqPMHbbnvYA==}
|
||||
dev: true
|
||||
|
||||
/@types/js-yaml/4.0.5:
|
||||
resolution: {integrity: sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==}
|
||||
dev: true
|
||||
|
||||
/@types/json-buffer/3.0.0:
|
||||
resolution: {integrity: sha512-3YP80IxxFJB4b5tYC2SUPwkg0XQLiu0nWvhRgEatgjf+29IcWO9X1k8xRv5DGssJ/lCrjYTjQPcobJr2yWIVuQ==}
|
||||
dev: false
|
||||
|
@ -3299,6 +3317,11 @@ packages:
|
|||
|
||||
/debug/2.6.9:
|
||||
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
|
||||
peerDependencies:
|
||||
supports-color: '*'
|
||||
peerDependenciesMeta:
|
||||
supports-color:
|
||||
optional: true
|
||||
dependencies:
|
||||
ms: 2.0.0
|
||||
|
||||
|
@ -3826,7 +3849,7 @@ packages:
|
|||
dependencies:
|
||||
confusing-browser-globals: 1.0.11
|
||||
eslint: 8.15.0
|
||||
eslint-plugin-import: 2.26.0_eslint@8.15.0
|
||||
eslint-plugin-import: 2.26.0_6nacgdzqm4zbhelsxkmd2vkvxy
|
||||
object.assign: 4.1.2
|
||||
object.entries: 1.1.5
|
||||
semver: 6.3.0
|
||||
|
@ -3841,7 +3864,7 @@ packages:
|
|||
dependencies:
|
||||
confusing-browser-globals: 1.0.11
|
||||
eslint: 8.12.0
|
||||
eslint-plugin-import: 2.26.0_eslint@8.12.0
|
||||
eslint-plugin-import: 2.26.0_hhyjdrupy4c2vgtpytri6cjwoy
|
||||
object.assign: 4.1.2
|
||||
object.entries: 1.1.5
|
||||
semver: 6.3.0
|
||||
|
@ -3859,7 +3882,7 @@ packages:
|
|||
'@typescript-eslint/parser': 5.22.0_hcfsmds2fshutdssjqluwm76uu
|
||||
eslint: 8.15.0
|
||||
eslint-config-airbnb-base: 15.0.0_gwd37gqv3vjv3xlpl7ju3ag2qu
|
||||
eslint-plugin-import: 2.26.0_eslint@8.15.0
|
||||
eslint-plugin-import: 2.26.0_6nacgdzqm4zbhelsxkmd2vkvxy
|
||||
dev: true
|
||||
|
||||
/eslint-config-airbnb-typescript/17.0.0_r46exuh3jlhq2wmrnqx2ufqspa:
|
||||
|
@ -3874,7 +3897,7 @@ packages:
|
|||
'@typescript-eslint/parser': 5.22.0_uhoeudlwl7kc47h4kncsfowede
|
||||
eslint: 8.12.0
|
||||
eslint-config-airbnb-base: 15.0.0_m4t3vvrby3btqwe437vnsnvyim
|
||||
eslint-plugin-import: 2.26.0_eslint@8.12.0
|
||||
eslint-plugin-import: 2.26.0_hhyjdrupy4c2vgtpytri6cjwoy
|
||||
dev: true
|
||||
|
||||
/eslint-config-next/12.1.4_e6a2zi6fqdwfehht5cxvkmo3zu:
|
||||
|
@ -3893,13 +3916,14 @@ packages:
|
|||
eslint: 8.12.0
|
||||
eslint-import-resolver-node: 0.3.4
|
||||
eslint-import-resolver-typescript: 2.4.0_l3k33lf43msdtqtpwrwceacqke
|
||||
eslint-plugin-import: 2.25.2_eslint@8.12.0
|
||||
eslint-plugin-import: 2.25.2_svocbphju65ulgskrkawser2je
|
||||
eslint-plugin-jsx-a11y: 6.5.1_eslint@8.12.0
|
||||
eslint-plugin-react: 7.29.1_eslint@8.12.0
|
||||
eslint-plugin-react-hooks: 4.3.0_eslint@8.12.0
|
||||
next: 12.1.6_talmm3uuvp6ssixt2qevhfgvue
|
||||
typescript: 4.6.4
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
|
@ -3935,7 +3959,7 @@ packages:
|
|||
dependencies:
|
||||
debug: 4.3.4
|
||||
eslint: 8.12.0
|
||||
eslint-plugin-import: 2.25.2_eslint@8.12.0
|
||||
eslint-plugin-import: 2.25.2_svocbphju65ulgskrkawser2je
|
||||
glob: 7.2.0
|
||||
is-glob: 4.0.3
|
||||
resolve: 1.22.0
|
||||
|
@ -3944,27 +3968,69 @@ packages:
|
|||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-module-utils/2.7.3:
|
||||
/eslint-module-utils/2.7.3_sysdrzuw2ki4kxpuwc4tznw2ha:
|
||||
resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': '*'
|
||||
eslint-import-resolver-node: '*'
|
||||
eslint-import-resolver-typescript: '*'
|
||||
eslint-import-resolver-webpack: '*'
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
eslint-import-resolver-node:
|
||||
optional: true
|
||||
eslint-import-resolver-typescript:
|
||||
optional: true
|
||||
eslint-import-resolver-webpack:
|
||||
optional: true
|
||||
dependencies:
|
||||
debug: 3.2.7
|
||||
find-up: 2.1.0
|
||||
'@typescript-eslint/parser': 5.10.1_uhoeudlwl7kc47h4kncsfowede
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-import-resolver-typescript: 2.4.0_l3k33lf43msdtqtpwrwceacqke
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.25.2_eslint@8.12.0:
|
||||
/eslint-module-utils/2.7.3_wex3ustmkv4ospy3s77r6ihlwq:
|
||||
resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': '*'
|
||||
eslint-import-resolver-node: '*'
|
||||
eslint-import-resolver-typescript: '*'
|
||||
eslint-import-resolver-webpack: '*'
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
eslint-import-resolver-node:
|
||||
optional: true
|
||||
eslint-import-resolver-typescript:
|
||||
optional: true
|
||||
eslint-import-resolver-webpack:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.22.0_uhoeudlwl7kc47h4kncsfowede
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.25.2_svocbphju65ulgskrkawser2je:
|
||||
resolution: {integrity: sha512-qCwQr9TYfoBHOFcVGKY9C9unq05uOxxdklmBXLVvcwo68y5Hta6/GzCZEMx2zQiu0woKNEER0LE7ZgaOfBU14g==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': '*'
|
||||
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.10.1_uhoeudlwl7kc47h4kncsfowede
|
||||
array-includes: 3.1.5
|
||||
array.prototype.flat: 1.3.0
|
||||
debug: 2.6.9
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.12.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-module-utils: 2.7.3
|
||||
eslint-module-utils: 2.7.3_sysdrzuw2ki4kxpuwc4tznw2ha
|
||||
has: 1.0.3
|
||||
is-core-module: 2.9.0
|
||||
is-glob: 4.0.3
|
||||
|
@ -3972,43 +4038,30 @@ packages:
|
|||
object.values: 1.1.5
|
||||
resolve: 1.22.0
|
||||
tsconfig-paths: 3.14.1
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.26.0_eslint@8.12.0:
|
||||
resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8
|
||||
dependencies:
|
||||
array-includes: 3.1.5
|
||||
array.prototype.flat: 1.3.0
|
||||
debug: 2.6.9
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.12.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-module-utils: 2.7.3
|
||||
has: 1.0.3
|
||||
is-core-module: 2.9.0
|
||||
is-glob: 4.0.3
|
||||
minimatch: 3.1.2
|
||||
object.values: 1.1.5
|
||||
resolve: 1.22.0
|
||||
tsconfig-paths: 3.14.1
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.26.0_eslint@8.15.0:
|
||||
/eslint-plugin-import/2.26.0_6nacgdzqm4zbhelsxkmd2vkvxy:
|
||||
resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': '*'
|
||||
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.22.0_hcfsmds2fshutdssjqluwm76uu
|
||||
array-includes: 3.1.5
|
||||
array.prototype.flat: 1.3.0
|
||||
debug: 2.6.9
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.15.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-module-utils: 2.7.3
|
||||
eslint-module-utils: 2.7.3_wex3ustmkv4ospy3s77r6ihlwq
|
||||
has: 1.0.3
|
||||
is-core-module: 2.9.0
|
||||
is-glob: 4.0.3
|
||||
|
@ -4016,6 +4069,41 @@ packages:
|
|||
object.values: 1.1.5
|
||||
resolve: 1.22.0
|
||||
tsconfig-paths: 3.14.1
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-import/2.26.0_hhyjdrupy4c2vgtpytri6cjwoy:
|
||||
resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==}
|
||||
engines: {node: '>=4'}
|
||||
peerDependencies:
|
||||
'@typescript-eslint/parser': '*'
|
||||
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8
|
||||
peerDependenciesMeta:
|
||||
'@typescript-eslint/parser':
|
||||
optional: true
|
||||
dependencies:
|
||||
'@typescript-eslint/parser': 5.22.0_uhoeudlwl7kc47h4kncsfowede
|
||||
array-includes: 3.1.5
|
||||
array.prototype.flat: 1.3.0
|
||||
debug: 2.6.9
|
||||
doctrine: 2.1.0
|
||||
eslint: 8.12.0
|
||||
eslint-import-resolver-node: 0.3.6
|
||||
eslint-module-utils: 2.7.3_wex3ustmkv4ospy3s77r6ihlwq
|
||||
has: 1.0.3
|
||||
is-core-module: 2.9.0
|
||||
is-glob: 4.0.3
|
||||
minimatch: 3.1.2
|
||||
object.values: 1.1.5
|
||||
resolve: 1.22.0
|
||||
tsconfig-paths: 3.14.1
|
||||
transitivePeerDependencies:
|
||||
- eslint-import-resolver-typescript
|
||||
- eslint-import-resolver-webpack
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/eslint-plugin-jsx-a11y/6.5.1_eslint@8.12.0:
|
||||
|
@ -4422,13 +4510,6 @@ packages:
|
|||
resolution: {integrity: sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==}
|
||||
dev: false
|
||||
|
||||
/find-up/2.1.0:
|
||||
resolution: {integrity: sha1-RdG35QbHF93UgndaK3eSCjwMV6c=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
locate-path: 2.0.0
|
||||
dev: true
|
||||
|
||||
/find-up/4.1.0:
|
||||
resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==}
|
||||
engines: {node: '>=8'}
|
||||
|
@ -5226,6 +5307,34 @@ packages:
|
|||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jest-cli/28.1.0_@types+node@17.0.31:
|
||||
resolution: {integrity: sha512-fDJRt6WPRriHrBsvvgb93OxgajHHsJbk4jZxiPqmZbMDRcHskfJBBfTyjFko0jjfprP544hOktdSi9HVgl4VUQ==}
|
||||
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
|
||||
peerDependenciesMeta:
|
||||
node-notifier:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@jest/core': 28.1.0
|
||||
'@jest/test-result': 28.1.0
|
||||
'@jest/types': 28.1.0
|
||||
chalk: 4.1.2
|
||||
exit: 0.1.2
|
||||
graceful-fs: 4.2.10
|
||||
import-local: 3.1.0
|
||||
jest-config: 28.1.0_@types+node@17.0.31
|
||||
jest-util: 28.1.0
|
||||
jest-validate: 28.1.0
|
||||
prompts: 2.4.2
|
||||
yargs: 17.4.1
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- supports-color
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jest-config/28.1.0:
|
||||
resolution: {integrity: sha512-aOV80E9LeWrmflp7hfZNn/zGA4QKv/xsn2w8QCBP0t0+YqObuCWTSgNbHJ0j9YsTuCO08ZR/wsvlxqqHX20iUA==}
|
||||
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
|
||||
|
@ -5631,6 +5740,25 @@ packages:
|
|||
- ts-node
|
||||
dev: true
|
||||
|
||||
/jest/28.1.0_@types+node@17.0.31:
|
||||
resolution: {integrity: sha512-TZR+tHxopPhzw3c3560IJXZWLNHgpcz1Zh0w5A65vynLGNcg/5pZ+VildAd7+XGOu6jd58XMY/HNn0IkZIXVXg==}
|
||||
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0
|
||||
peerDependenciesMeta:
|
||||
node-notifier:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@jest/core': 28.1.0
|
||||
import-local: 3.1.0
|
||||
jest-cli: 28.1.0_@types+node@17.0.31
|
||||
transitivePeerDependencies:
|
||||
- '@types/node'
|
||||
- supports-color
|
||||
- ts-node
|
||||
dev: true
|
||||
|
||||
/js-cookie/3.0.1:
|
||||
resolution: {integrity: sha512-+0rgsUXZu4ncpPxRL+lNEptWMOWl9etvPHc/koSRp6MPwpRYAhmk0dUG00J4bxVV3r9uUzfo24wW0knS07SKSw==}
|
||||
engines: {node: '>=12'}
|
||||
|
@ -5787,14 +5915,6 @@ packages:
|
|||
/lines-and-columns/1.2.4:
|
||||
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
|
||||
|
||||
/locate-path/2.0.0:
|
||||
resolution: {integrity: sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
p-locate: 2.0.0
|
||||
path-exists: 3.0.0
|
||||
dev: true
|
||||
|
||||
/locate-path/5.0.0:
|
||||
resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==}
|
||||
engines: {node: '>=8'}
|
||||
|
@ -6289,13 +6409,6 @@ packages:
|
|||
engines: {node: '>=8.0.0'}
|
||||
dev: false
|
||||
|
||||
/p-limit/1.3.0:
|
||||
resolution: {integrity: sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
p-try: 1.0.0
|
||||
dev: true
|
||||
|
||||
/p-limit/2.3.0:
|
||||
resolution: {integrity: sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==}
|
||||
engines: {node: '>=6'}
|
||||
|
@ -6303,13 +6416,6 @@ packages:
|
|||
p-try: 2.2.0
|
||||
dev: true
|
||||
|
||||
/p-locate/2.0.0:
|
||||
resolution: {integrity: sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
p-limit: 1.3.0
|
||||
dev: true
|
||||
|
||||
/p-locate/4.1.0:
|
||||
resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==}
|
||||
engines: {node: '>=8'}
|
||||
|
@ -6324,11 +6430,6 @@ packages:
|
|||
p-finally: 1.0.0
|
||||
dev: false
|
||||
|
||||
/p-try/1.0.0:
|
||||
resolution: {integrity: sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/p-try/2.2.0:
|
||||
resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==}
|
||||
engines: {node: '>=6'}
|
||||
|
@ -6391,11 +6492,6 @@ packages:
|
|||
pause: 0.0.1
|
||||
dev: false
|
||||
|
||||
/path-exists/3.0.0:
|
||||
resolution: {integrity: sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=}
|
||||
engines: {node: '>=4'}
|
||||
dev: true
|
||||
|
||||
/path-exists/4.0.0:
|
||||
resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==}
|
||||
engines: {node: '>=8'}
|
||||
|
@ -7374,6 +7470,40 @@ packages:
|
|||
yargs-parser: 20.2.9
|
||||
dev: true
|
||||
|
||||
/ts-jest/28.0.2_z3fx76c5ksuwr36so7o5uc2kcy:
|
||||
resolution: {integrity: sha512-IOZMb3D0gx6IHO9ywPgiQxJ3Zl4ECylEFwoVpENB55aTn5sdO0Ptyx/7noNBxAaUff708RqQL4XBNxxOVjY0vQ==}
|
||||
engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}
|
||||
hasBin: true
|
||||
peerDependencies:
|
||||
'@babel/core': '>=7.0.0-beta.0 <8'
|
||||
'@types/jest': ^27.0.0
|
||||
babel-jest: ^28.0.0
|
||||
esbuild: '*'
|
||||
jest: ^28.0.0
|
||||
typescript: '>=4.3'
|
||||
peerDependenciesMeta:
|
||||
'@babel/core':
|
||||
optional: true
|
||||
'@types/jest':
|
||||
optional: true
|
||||
babel-jest:
|
||||
optional: true
|
||||
esbuild:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@types/jest': 27.5.0
|
||||
bs-logger: 0.2.6
|
||||
fast-json-stable-stringify: 2.1.0
|
||||
jest: 28.1.0_@types+node@17.0.31
|
||||
jest-util: 28.1.0
|
||||
json5: 2.2.1
|
||||
lodash.memoize: 4.1.2
|
||||
make-error: 1.3.6
|
||||
semver: 7.3.7
|
||||
typescript: 4.6.4
|
||||
yargs-parser: 20.2.9
|
||||
dev: true
|
||||
|
||||
/tsconfig-paths/3.14.1:
|
||||
resolution: {integrity: sha512-fxDhWnFSLt3VuTwtvJt5fpwxBHg5AdKWMsgcPOOIilyjymcYVZoCQF8fvFRezCNfblEXmi+PcM1eYHeOAgXCOQ==}
|
||||
dependencies:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
|
||||
ROOT_FOLDER="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
|
||||
ROOT_FOLDER="$(readlink -f "$(dirname "${BASH_SOURCE[0]}")"/..)"
|
||||
|
||||
echo
|
||||
echo "======================================"
|
||||
|
@ -14,45 +14,19 @@ echo "=============== TIPI ================="
|
|||
echo "======================================"
|
||||
echo
|
||||
|
||||
ID="$(grep -E '^ID=' /etc/os-release | awk -F'=' '{print $2}')"
|
||||
if [[ $ID == 'debian' || $ID == 'ubuntu' ]]; then
|
||||
sudo wget -O "${ROOT_FOLDER}"/scripts/pacapt https://github.com/icy/pacapt/raw/ng/pacapt
|
||||
sudo chmod 755 "${ROOT_FOLDER}"/scripts/pacapt
|
||||
sudo "${ROOT_FOLDER}"/scripts/pacapt -Sy
|
||||
yes | sudo "${ROOT_FOLDER}"/scripts/pacapt -S docker docker-compose jq coreutils curl lsb-release
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y jq coreutils ca-certificates curl gnupg lsb-release
|
||||
LSB="$(lsb_release -is)"
|
||||
|
||||
LSB="$(lsb_release -is)"
|
||||
systemctl start docker.service
|
||||
systemctl enable docker.service
|
||||
|
||||
# Add docker gpg key (Debian)
|
||||
if [[ "${LSB}" == "Debian" ]]; then
|
||||
curl -fsSL https://download.docker.com/linux/debian/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
fi
|
||||
# if [[ "${LSB}" == "Arch" ]]; then
|
||||
# sudo "${ROOT_FOLDER}"/scripts/pacapt -S hostname -y
|
||||
# fi
|
||||
|
||||
# Add docker gpg key (Ubuntu)
|
||||
if [[ "${LSB}" == "Ubuntu" ]]; then
|
||||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
|
||||
fi
|
||||
|
||||
# Add deb repo for docker (Debian)
|
||||
if [[ "${LSB}" == "Debian" ]]; then
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
|
||||
fi
|
||||
|
||||
# Add deb repo for docker (Ubuntu)
|
||||
if [[ "${LSB}" == "Ubuntu" ]]; then
|
||||
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
|
||||
fi
|
||||
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y docker-ce docker-ce-cli containerd.io
|
||||
|
||||
# Install docker compose if not here
|
||||
if ! command -v docker-compose >/dev/null; then
|
||||
sudo curl -L "https://github.com/docker/compose/releases/download/v2.3.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
|
||||
sudo chmod +x /usr/local/bin/docker-compose
|
||||
fi
|
||||
else
|
||||
curl -LO https://github.com/icy/pacapt/raw/ng/pacapt && sudo bash pacapt -Sy docker docker-compose && rm pacapt && echo done
|
||||
fi
|
||||
sudo usermod -aG docker $USER
|
||||
# Create configured status
|
||||
touch "${ROOT_FOLDER}/state/configured"
|
||||
|
|
|
@ -62,6 +62,11 @@ host_check
|
|||
ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
|
||||
STATE_FOLDER="${ROOT_FOLDER}/state"
|
||||
SED_ROOT_FOLDER="$(echo $ROOT_FOLDER | sed 's/\//\\\//g')"
|
||||
|
||||
NETWORK_INTERFACE="$(ip route | grep default | awk '{print $5}')"
|
||||
INTERNAL_IP="$(ip addr show "${NETWORK_INTERFACE}" | grep "inet " | awk '{print $2}' | cut -d/ -f1)"
|
||||
# INTERNAL_IP="$(hostname -I | awk '{print $1}')"
|
||||
|
||||
DNS_IP=9.9.9.9 # Default to Quad9 DNS
|
||||
ARCHITECTURE="$(uname -m)"
|
||||
|
||||
|
@ -104,8 +109,6 @@ function derive_entropy() {
|
|||
printf "%s" "${identifier}" | openssl dgst -sha256 -hmac "${tipi_seed}" | sed 's/^.* //'
|
||||
}
|
||||
|
||||
PUID="$(id -u)"
|
||||
PGID="$(id -g)"
|
||||
TZ="$(cat /etc/timezone | sed 's/\//\\\//g' || echo "Europe/Berlin")"
|
||||
|
||||
# Copy the app state if it isn't here
|
||||
|
@ -120,17 +123,12 @@ fi
|
|||
|
||||
# Get current dns from host
|
||||
if [[ -f "/etc/resolv.conf" ]]; then
|
||||
TEMP=$(cat /etc/resolv.conf | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | head -n 1)
|
||||
TEMP=$(grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' /etc/resolv.conf | head -n 1)
|
||||
fi
|
||||
|
||||
# Get dns ip if pihole is installed
|
||||
str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
|
||||
|
||||
# if pihole is present in str add it as DNS
|
||||
# if [[ $str = *"pihole"* ]]; then
|
||||
# DNS_IP=10.21.21.201
|
||||
# fi
|
||||
|
||||
# Create seed file with cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
|
||||
if [[ ! -f "${STATE_FOLDER}/seed" ]]; then
|
||||
echo "Generating seed..."
|
||||
|
@ -153,11 +151,9 @@ ENV_FILE=$(mktemp)
|
|||
|
||||
JWT_SECRET=$(derive_entropy "jwt")
|
||||
|
||||
for template in "${ENV_FILE}"; do
|
||||
for template in ${ENV_FILE}; do
|
||||
sed -i "s/<dns_ip>/${DNS_IP}/g" "${template}"
|
||||
sed -i "s/<internal_ip>/${INTERNAL_IP}/g" "${template}"
|
||||
sed -i "s/<puid>/${PUID}/g" "${template}"
|
||||
sed -i "s/<pgid>/${PGID}/g" "${template}"
|
||||
sed -i "s/<tz>/${TZ}/g" "${template}"
|
||||
sed -i "s/<jwt_secret>/${JWT_SECRET}/g" "${template}"
|
||||
sed -i "s/<root_folder>/${SED_ROOT_FOLDER}/g" "${template}"
|
||||
|
@ -173,6 +169,12 @@ mv -f "$ENV_FILE" "$ROOT_FOLDER/.env"
|
|||
echo "Running system-info.sh..."
|
||||
bash "${ROOT_FOLDER}/scripts/system-info.sh"
|
||||
|
||||
# Add crontab to run system-info.sh every minute
|
||||
! (crontab -l | grep -q "${ROOT_FOLDER}/scripts/system-info.sh") && (
|
||||
crontab -l
|
||||
echo "* * * * * ${ROOT_FOLDER}/scripts/system-info.sh"
|
||||
) | crontab -
|
||||
|
||||
## Don't run if config-only
|
||||
if [[ ! $ci == "true" ]]; then
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
# It will be overwritten on update.
|
||||
|
||||
TZ=<tz>
|
||||
PUID=<puid>
|
||||
PGID=<pgid>
|
||||
INTERNAL_IP=<internal_ip>
|
||||
DNS_IP=<dns_ip>
|
||||
ARCHITECTURE=<architecture>
|
||||
|
|
19
tsconfig.json
Normal file
19
tsconfig.json
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "commonjs",
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": false,
|
||||
"jsx": "preserve",
|
||||
"incremental": true
|
||||
},
|
||||
"include": ["apps/**/*.ts"]
|
||||
}
|
Loading…
Add table
Reference in a new issue