Browse Source

Merge branch 'master' into develop

Nicolas Meienberger 1 year ago
parent
commit
c3ea3e8cdc

+ 4 - 1
.github/workflows/release.yml

@@ -106,6 +106,9 @@ jobs:
     outputs:
       tagname: ${{ steps.create_tag.outputs.tagname }}
     steps:
+      - name: Checkout code
+        uses: actions/checkout@v3
+
       - name: Create Tag
         id: create_tag
         uses: butlerlogic/action-autotag@stable
@@ -126,7 +129,7 @@ jobs:
           name: cli
           path: cli
 
-      - name: Create beta release
+      - name: Create release
         id: create_release
         uses: actions/create-release@v1
         env:

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "runtipi",
-  "version": "2.0.3",
+  "version": "2.0.5",
   "description": "A homeserver for everyone",
   "scripts": {
     "knip": "knip",

+ 1 - 1
packages/cli/package.json

@@ -1,6 +1,6 @@
 {
   "name": "@runtipi/cli",
-  "version": "2.0.3",
+  "version": "2.0.5",
   "description": "",
   "main": "index.js",
   "bin": "dist/index.js",

+ 1 - 4
packages/cli/src/executors/app/app.executors.ts

@@ -2,8 +2,6 @@
 /* eslint-disable no-restricted-syntax */
 import fs from 'fs';
 import path from 'path';
-import { exec } from 'child_process';
-import { promisify } from 'util';
 import pg from 'pg';
 import { getEnv } from '@/utils/environment/environment';
 import { pathExists } from '@/utils/fs-helpers';
@@ -11,8 +9,7 @@ import { compose } from '@/utils/docker-helpers';
 import { copyDataDir, generateEnvFile } from './app.helpers';
 import { fileLogger } from '@/utils/logger/file-logger';
 import { TerminalSpinner } from '@/utils/logger/terminal-spinner';
-
-const execAsync = promisify(exec);
+import { execAsync } from '@/utils/exec-async/execAsync';
 
 const getDbClient = async () => {
   const { postgresDatabase, postgresUsername, postgresPassword, postgresPort } = getEnv();

+ 1 - 4
packages/cli/src/executors/app/app.helpers.ts

@@ -2,13 +2,10 @@ import crypto from 'crypto';
 import fs from 'fs';
 import path from 'path';
 import { appInfoSchema, envMapToString, envStringToMap } from '@runtipi/shared';
-import { exec } from 'child_process';
-import { promisify } from 'util';
 import { getEnv } from '@/utils/environment/environment';
 import { generateVapidKeys, getAppEnvMap } from './env.helpers';
 import { pathExists } from '@/utils/fs-helpers';
-
-const execAsync = promisify(exec);
+import { execAsync } from '@/utils/exec-async/execAsync';
 
 /**
  *  This function generates a random string of the provided length by using the SHA-256 hash algorithm.

+ 1 - 4
packages/cli/src/executors/repo/repo.executors.ts

@@ -1,12 +1,9 @@
 import { getEnv } from 'src/utils/environment/environment';
 import path from 'path';
-import { promisify } from 'util';
-import { exec } from 'child_process';
 import { pathExists } from '@/utils/fs-helpers';
 import { getRepoHash } from './repo.helpers';
 import { fileLogger } from '@/utils/logger/file-logger';
-
-const execAsync = promisify(exec);
+import { execAsync } from '@/utils/exec-async/execAsync';
 
 export class RepoExecutors {
   private readonly logger;

+ 2 - 4
packages/cli/src/executors/system/system.executors.ts

@@ -7,10 +7,9 @@ import semver from 'semver';
 import axios from 'axios';
 import boxen from 'boxen';
 import path from 'path';
-import { exec, spawn } from 'child_process';
+import { spawn } from 'child_process';
 import si from 'systeminformation';
 import { Stream } from 'stream';
-import { promisify } from 'util';
 import dotenv from 'dotenv';
 import { SystemEvent } from '@runtipi/shared';
 import chalk from 'chalk';
@@ -23,8 +22,7 @@ import { getEnv } from '@/utils/environment/environment';
 import { fileLogger } from '@/utils/logger/file-logger';
 import { runPostgresMigrations } from '@/utils/migrations/run-migration';
 import { getUserIds } from '@/utils/environment/user';
-
-const execAsync = promisify(exec);
+import { execAsync } from '@/utils/exec-async/execAsync';
 
 export class SystemExecutors {
   private readonly rootFolder: string;

+ 1 - 4
packages/cli/src/executors/system/system.helpers.ts

@@ -3,12 +3,11 @@ import fs from 'fs';
 import path from 'path';
 import os from 'os';
 import { envMapToString, envStringToMap, settingsSchema } from '@runtipi/shared';
-import { exec } from 'child_process';
-import { promisify } from 'util';
 import chalk from 'chalk';
 import { pathExists } from '@/utils/fs-helpers';
 import { getRepoHash } from '../repo/repo.helpers';
 import { fileLogger } from '@/utils/logger/file-logger';
+import { execAsync } from '@/utils/exec-async/execAsync';
 
 type EnvKeys =
   | 'APPS_REPO_ID'
@@ -38,8 +37,6 @@ type EnvKeys =
   // eslint-disable-next-line @typescript-eslint/ban-types
   | (string & {});
 
-const execAsync = promisify(exec);
-
 const DEFAULT_REPO_URL = 'https://github.com/meienberger/runtipi-appstore';
 
 /**

+ 1 - 4
packages/cli/src/services/watcher/watcher.ts

@@ -1,13 +1,10 @@
 import { eventSchema } from '@runtipi/shared';
 import { Worker } from 'bullmq';
-import { exec } from 'child_process';
-import { promisify } from 'util';
 import { AppExecutors, RepoExecutors, SystemExecutors } from '@/executors';
 import { getEnv } from '@/utils/environment/environment';
 import { getUserIds } from '@/utils/environment/user';
 import { fileLogger } from '@/utils/logger/file-logger';
-
-const execAsync = promisify(exec);
+import { execAsync } from '@/utils/exec-async/execAsync';
 
 const runCommand = async (jobData: unknown) => {
   const { gid, uid } = getUserIds();

+ 1 - 4
packages/cli/src/utils/docker-helpers/docker-helpers.ts

@@ -1,11 +1,8 @@
 import path from 'path';
-import { promisify } from 'util';
-import { exec } from 'child_process';
 import { getEnv } from '../environment/environment';
 import { pathExists } from '../fs-helpers/fs-helpers';
 import { fileLogger } from '../logger/file-logger';
-
-const execAsync = promisify(exec);
+import { execAsync } from '../exec-async/execAsync';
 
 const composeUp = async (args: string[]) => {
   fileLogger.info(`Running docker compose with args ${args.join(' ')}`);

+ 19 - 0
packages/cli/src/utils/exec-async/execAsync.tsx

@@ -0,0 +1,19 @@
+import { exec } from 'child_process';
+import { promisify } from 'util';
+
+type ExecAsyncParams = [command: string];
+
+type ExecResult = { stdout: string; stderr: string };
+
+export const execAsync = async (...args: ExecAsyncParams): Promise<ExecResult> => {
+  try {
+    const { stdout, stderr } = await promisify(exec)(...args);
+    return { stdout, stderr };
+  } catch (error) {
+    if (error instanceof Error) {
+      return { stderr: error.message, stdout: '' };
+    }
+
+    return { stderr: String(error), stdout: '' };
+  }
+};

+ 18 - 14
pnpm-lock.yaml

@@ -2019,7 +2019,7 @@ packages:
     engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
     dependencies:
       '@jest/types': 29.6.0
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       chalk: 4.1.2
       jest-message-util: 29.6.0
       jest-util: 29.5.0
@@ -2265,7 +2265,7 @@ packages:
       '@jest/transform': 29.5.0
       '@jest/types': 29.6.0
       '@jridgewell/trace-mapping': 0.3.17
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       chalk: 4.1.2
       collect-v8-coverage: 1.0.1
       exit: 0.1.2
@@ -2443,7 +2443,7 @@ packages:
       '@jest/schemas': 29.6.0
       '@types/istanbul-lib-coverage': 2.0.4
       '@types/istanbul-reports': 3.0.1
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       '@types/yargs': 17.0.22
       chalk: 4.1.2
     dev: true
@@ -3824,7 +3824,7 @@ packages:
   /@types/graceful-fs@4.1.6:
     resolution: {integrity: sha512-Sig0SNORX9fdW+bQuTEovKj3uHcUL6LQKbCrrqb1X7J6/ReAbhCXRAhc+SMejhLELFj2QcyuxmUooZ4bt5ReSw==}
     dependencies:
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
     dev: true
 
   /@types/hast@2.3.4:
@@ -3839,6 +3839,10 @@ packages:
       '@types/unist': 2.0.6
     dev: false
 
+  /@types/http-errors@2.0.2:
+    resolution: {integrity: sha512-lPG6KlZs88gef6aD85z3HNkztpj7w2R7HmR3gygjfXCQmsLloWNARFkMuzKiiY8FGdh1XDpgBdrSf4aKDiA7Kg==}
+    dev: true
+
   /@types/isomorphic-fetch@0.0.36:
     resolution: {integrity: sha512-ulw4d+vW1HKn4oErSmNN2HYEcHGq0N1C5exlrMM0CRqX1UUpFhGb5lwiom5j9KN3LBJJDLRmYIZz1ghm7FIzZw==}
     dev: true
@@ -3997,7 +4001,7 @@ packages:
   /@types/set-cookie-parser@2.4.2:
     resolution: {integrity: sha512-fBZgytwhYAUkj/jC/FAV4RQ5EerRup1YQsXQCh8rZfiHkc4UahC192oH0smGwsXol3cL3A5oETuAHeQHmhXM4w==}
     dependencies:
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
     dev: true
 
   /@types/stack-utils@2.0.1:
@@ -4595,7 +4599,7 @@ packages:
     resolution: {integrity: sha512-xcLxITLe2HYa1cnYnwCjkOO1PqUHQpozB8x9AR0OgWN2woOBi5kSDVxKfd0b7sb1hw5qFeJhXm9H1nu3xSfLeQ==}
     engines: {node: '>=10'}
     dependencies:
-      tslib: 2.5.3
+      tslib: 2.6.2
     dev: false
 
   /aria-query@5.1.3:
@@ -7970,7 +7974,7 @@ packages:
       '@jest/expect': 29.5.0
       '@jest/test-result': 29.5.0
       '@jest/types': 29.6.0
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       chalk: 4.1.2
       co: 4.6.0
       dedent: 0.7.0
@@ -8264,7 +8268,7 @@ packages:
       '@jest/environment': 29.5.0
       '@jest/fake-timers': 29.5.0
       '@jest/types': 29.6.0
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       jest-mock: 29.5.0
       jest-util: 29.5.0
     dev: true
@@ -8304,7 +8308,7 @@ packages:
     dependencies:
       '@jest/types': 29.6.0
       '@types/graceful-fs': 4.1.6
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       anymatch: 3.1.3
       fb-watchman: 2.0.2
       graceful-fs: 4.2.10
@@ -8522,7 +8526,7 @@ packages:
       '@jest/test-result': 29.5.0
       '@jest/transform': 29.5.0
       '@jest/types': 29.6.0
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       chalk: 4.1.2
       emittery: 0.13.1
       graceful-fs: 4.2.10
@@ -8583,7 +8587,7 @@ packages:
       '@jest/test-result': 29.5.0
       '@jest/transform': 29.5.0
       '@jest/types': 29.6.0
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       chalk: 4.1.2
       cjs-module-lexer: 1.2.2
       collect-v8-coverage: 1.0.1
@@ -8732,7 +8736,7 @@ packages:
     dependencies:
       '@jest/test-result': 29.5.0
       '@jest/types': 29.6.0
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       ansi-escapes: 4.3.2
       chalk: 4.1.2
       emittery: 0.13.1
@@ -8753,7 +8757,7 @@ packages:
     resolution: {integrity: sha512-NcrQnevGoSp4b5kg+akIpthoAFHxPBcb5P6mYPY0fUNT+sSvmtu6jlkEle3anczUKIKEbMxFimk9oTP/tpIPgA==}
     engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
     dependencies:
-      '@types/node': 18.6.2
+      '@types/node': 20.3.2
       jest-util: 29.5.0
       merge-stream: 2.0.0
       supports-color: 8.1.1
@@ -11001,7 +11005,7 @@ packages:
       react: 18.2.0
       react-remove-scroll-bar: 2.3.4(@types/react@18.2.14)(react@18.2.0)
       react-style-singleton: 2.2.1(@types/react@18.2.14)(react@18.2.0)
-      tslib: 2.5.3
+      tslib: 2.6.2
       use-callback-ref: 1.3.0(@types/react@18.2.14)(react@18.2.0)
       use-sidecar: 1.1.2(@types/react@18.2.14)(react@18.2.0)
     dev: false

+ 4 - 4
scripts/install.sh

@@ -8,8 +8,8 @@ echo "Installing runtipi..."
 ARCHITECTURE="$(uname -m)"
 # Not supported on 32 bits systems
 if [[ "$ARCHITECTURE" == "armv7"* ]] || [[ "$ARCHITECTURE" == "i686" ]] || [[ "$ARCHITECTURE" == "i386" ]]; then
-    echo "runtipi is not supported on 32 bits systems"
-    exit 1
+  echo "runtipi is not supported on 32 bits systems"
+  exit 1
 fi
 
 ### --------------------------------
@@ -178,8 +178,8 @@ fi
 URL="https://github.com/meienberger/runtipi/releases/download/$VERSION/$ASSET"
 
 if [[ "${UPDATE}" == "false" ]]; then
-    mkdir -p runtipi
-    cd runtipi || exit
+  mkdir -p runtipi
+  cd runtipi || exit
 fi
 
 curl --location "$URL" -o ./runtipi-cli

+ 1 - 1
src/client/messages/pt-PT.json

@@ -1,7 +1,7 @@
 {
   "server-messages": {
     "errors": {
-      "invalid-credentials": "Invalid credentials",
+      "invalid-credentials": "Credenciais inválidas",
       "admin-already-exists": "There is already an admin user. Please login to create a new user from the admin panel.",
       "missing-email-or-password": "Missing email or password",
       "invalid-username": "Invalid username",