From 5070e859765dbcdaa9d1f3799fc2970f9c07b1d3 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 11:30:07 -0600 Subject: [PATCH 01/25] add ci --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..d6ec42d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,61 @@ +name: CI for Fedired + +on: + push: + branches: + - main + - nvus + pull_request: + branches: + - main + - nvus + +jobs: + build-and-test: + runs-on: ubuntu-latest + + services: + # Configura PostgreSQL para tus pruebas y migraciones + postgres: + image: postgres:latest + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: password + POSTGRES_DB: fedired_test + ports: + - 5432:5432 + options: >- + --health-cmd="pg_isready -U postgres" + --health-interval=10s + --health-timeout=5s + --health-retries=5 + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up pnpm + uses: pnpm/action-setup@v2.2.4 + with: + version: 9.9.0 + + - name: Install dependencies with pnpm + run: pnpm install + + - name: Build the project + run: pnpm run build + + - name: Run TypeScript tests + run: pnpm run test:ts + + - name: Run Rust tests + run: pnpm run test:rs + + - name: Run Rust Miri tests + run: pnpm run test:rs:miri + + - name: Run linters for TypeScript and Rust + run: pnpm run lint + + - name: Clean up build files + run: pnpm run clean From 90f8ded95878202a7b8718ac0e37f79cd4162693 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 12:01:36 -0600 Subject: [PATCH 02/25] add github yml --- .github/fedired/test.yml | 16 ++++++++++ .github/labeler.yml | 15 +++++++++ .github/workflows/ci.yml | 59 +++++++---------------------------- .github/workflows/labeler.yml | 0 4 files changed, 42 insertions(+), 48 deletions(-) create mode 100644 .github/fedired/test.yml create mode 100644 .github/labeler.yml create mode 100644 .github/workflows/labeler.yml diff --git a/.github/fedired/test.yml b/.github/fedired/test.yml new file mode 100644 index 0000000..1b807bc --- /dev/null +++ b/.github/fedired/test.yml @@ -0,0 +1,16 @@ +url: 'http://fedired.local' + +setupPassword: example_password_please_change_this_or_you_will_get_hacked + +port: 61812 + +db: + host: 127.0.0.1 + port: 54312 + db: test-fedired + user: postgres + pass: '' +redis: + host: 127.0.0.1 + port: 56312 +id: aidx \ No newline at end of file diff --git a/.github/labeler.yml b/.github/labeler.yml new file mode 100644 index 0000000..27947ea --- /dev/null +++ b/.github/labeler.yml @@ -0,0 +1,15 @@ +# .github/labeler.yml + +version: 2 + +pull_request: + 'packages/backend/**': + - backend + 'packages/backend-rs/**': + - backend-rust + 'packages/client/**': + - client + 'packages/sw/**': + - service-worker + 'packages/fedired-js/**': + - frontend diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6ec42d..b2e4cea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,61 +1,24 @@ -name: CI for Fedired +name: CI on: push: - branches: - - main - - nvus - pull_request: branches: - main - - nvus jobs: - build-and-test: + build: runs-on: ubuntu-latest - - services: - # Configura PostgreSQL para tus pruebas y migraciones - postgres: - image: postgres:latest - env: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: password - POSTGRES_DB: fedired_test - ports: - - 5432:5432 - options: >- - --health-cmd="pg_isready -U postgres" - --health-interval=10s - --health-timeout=5s - --health-retries=5 - steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v2 - - name: Set up pnpm - uses: pnpm/action-setup@v2.2.4 - with: - version: 9.9.0 - - - name: Install dependencies with pnpm - run: pnpm install + - name: Set npm registry + run: npm config set registry https://registry.npmjs.org/ - - name: Build the project - run: pnpm run build + - name: Install pnpm + run: npm install -g pnpm - - name: Run TypeScript tests - run: pnpm run test:ts - - - name: Run Rust tests - run: pnpm run test:rs - - - name: Run Rust Miri tests - run: pnpm run test:rs:miri - - - name: Run linters for TypeScript and Rust - run: pnpm run lint + - name: Install dependencies + run: pnpm install - - name: Clean up build files - run: pnpm run clean + # Otros pasos de tu CI diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml new file mode 100644 index 0000000..e69de29 From 79903875f6d57f79d3643f21855901bf3f64163c Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 12:16:39 -0600 Subject: [PATCH 03/25] update ci --- .github/workflows/ci.yml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b2e4cea..87a285b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,22 +3,34 @@ name: CI on: push: branches: - - main + - main + - nvus + pull_request: + branches: + - main + - nvus jobs: build: runs-on: ubuntu-latest + steps: - name: Checkout code uses: actions/checkout@v2 - - name: Set npm registry - run: npm config set registry https://registry.npmjs.org/ + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '20' + + - name: Install PNPM + uses: pnpm/action-setup@v2.2.5 - - name: Install pnpm - run: npm install -g pnpm + - name: Install Dependencies + run: pnpm install - - name: Install dependencies - run: pnpm install + - name: Run Tests + run: pnpm test - # Otros pasos de tu CI + - name: Build Packages + run: pnpm run build From 8e2c336a9d668c5e824c5c39fe447e28e4411cb0 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 12:19:00 -0600 Subject: [PATCH 04/25] update ci --- .github/workflows/ci.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87a285b..e48a62f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,12 @@ name: CI on: push: branches: - - main - - nvus + - main # Se ejecuta en la rama main + - nvus # Se ejecuta en la rama nvus pull_request: branches: - - main - - nvus + - main # Se ejecuta para pull requests a la rama main + - nvus # Se ejecuta para pull requests a la rama nvus jobs: build: @@ -21,10 +21,10 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v2 with: - node-version: '20' + node-version: '20' - name: Install PNPM - uses: pnpm/action-setup@v2.2.5 + uses: pnpm/action-setup@v2.0.0 - name: Install Dependencies run: pnpm install From 2192f0f8d6a8939b3e9be258580d4bf54246adda Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 12:22:09 -0600 Subject: [PATCH 05/25] update error ci --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++---------------- 1 file changed, 36 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e48a62f..00d4401 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,36 +1,49 @@ -name: CI +name: Test (production install and build) on: push: branches: - - main # Se ejecuta en la rama main - - nvus # Se ejecuta en la rama nvus + - main # Cambia a main en lugar de master + - nvus # Mantén la rama nvus pull_request: branches: - - main # Se ejecuta para pull requests a la rama main - - nvus # Se ejecuta para pull requests a la rama nvus + - main + - nvus + +env: + NODE_ENV: production jobs: - build: + production: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 + strategy: + matrix: + node-version: [20.16.0] - - name: Setup Node.js - uses: actions/setup-node@v2 + steps: + - uses: actions/checkout@v4.1.1 with: - node-version: '20' - - - name: Install PNPM - uses: pnpm/action-setup@v2.0.0 + submodules: true + + - name: Install pnpm + uses: pnpm/action-setup@v4 - - name: Install Dependencies - run: pnpm install - - - name: Run Tests - run: pnpm test - - - name: Build Packages - run: pnpm run build + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4.0.4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - run: corepack enable + + - run: pnpm i --frozen-lockfile + + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + + - name: Copy Configure + run: cp .github/fedired/test.yml .config/default.yml + + - name: Build + run: pnpm build From f45cc70bfb9841e8321f1d6d20784356e9e7eafe Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 12:26:32 -0600 Subject: [PATCH 06/25] update --- .github/workflows/ci.yml | 50 ++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00d4401..8d604cb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,12 +3,9 @@ name: Test (production install and build) on: push: branches: - - main # Cambia a main en lugar de master - - nvus # Mantén la rama nvus + - master + - develop pull_request: - branches: - - main - - nvus env: NODE_ENV: production @@ -22,28 +19,21 @@ jobs: node-version: [20.16.0] steps: - - uses: actions/checkout@v4.1.1 - with: - submodules: true - - - name: Install pnpm - uses: pnpm/action-setup@v4 - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4.0.4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - - run: corepack enable - - - run: pnpm i --frozen-lockfile - - - name: Check pnpm-lock.yaml - run: git diff --exit-code pnpm-lock.yaml - - - name: Copy Configure - run: cp .github/fedired/test.yml .config/default.yml - - - name: Build - run: pnpm build + - uses: actions/checkout@v4.1.1 + with: + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4.0.4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --no-frozen-lockfile # Cambiado aquí + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .github/fedired/test.yml .config/default.yml + - name: Build + run: pnpm build From 934600ceb34adb5f8707a2c149c3fcc7c37339ae Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 13:45:36 -0600 Subject: [PATCH 07/25] resolver issue #6 --- .github/workflows/labeler.yml | 16 ++++++++++++++++ .../backend/src/remote/activitypub/resolver.ts | 11 ++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index e69de29..cab313b 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -0,0 +1,16 @@ +name: "Pull Request Labeler" +on: + pull_request_target: + branches-ignore: + - 'l10n_develop' + +jobs: + triage: + permissions: + contents: read + pull-requests: write + runs-on: ubuntu-latest + steps: + - uses: actions/labeler@v5 + with: + repo-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/packages/backend/src/remote/activitypub/resolver.ts b/packages/backend/src/remote/activitypub/resolver.ts index 7e6e223..5d0cacd 100644 --- a/packages/backend/src/remote/activitypub/resolver.ts +++ b/packages/backend/src/remote/activitypub/resolver.ts @@ -1,4 +1,5 @@ import { config } from "@/config.js"; +const allowedContexts = ["https://www.w3.org/ns/activitystreams"]; import type { ILocalUser } from "@/models/entities/user.js"; import { extractHost, @@ -125,10 +126,10 @@ export default class Resolver { if ( object == null || (Array.isArray(object["@context"]) - ? !(object["@context"] as unknown[]).includes( - "https://www.w3.org/ns/activitystreams", - ) - : object["@context"] !== "https://www.w3.org/ns/activitystreams") + ? !((object["@context"] as unknown[]).every( + (ctx) => allowedContexts.includes(ctx) + )) + : !allowedContexts.includes(object["@context"])) ) { throw new Error("invalid response"); } @@ -219,4 +220,4 @@ export default class Resolver { throw new Error(`resolveLocal: type ${parsed.type} unhandled`); } } -} +} \ No newline at end of file From 391700a4956e26437dc7897d9db5016ddf66c2e8 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 14:33:30 -0600 Subject: [PATCH 08/25] ci --- .github/fedired/test.yml | 111 ++++++++++++++++++++++++++++++++++----- 1 file changed, 98 insertions(+), 13 deletions(-) diff --git a/.github/fedired/test.yml b/.github/fedired/test.yml index 1b807bc..2302820 100644 --- a/.github/fedired/test.yml +++ b/.github/fedired/test.yml @@ -1,16 +1,101 @@ -url: 'http://fedired.local' +name: CI for Fedired -setupPassword: example_password_please_change_this_or_you_will_get_hacked +on: + push: + branches: + - main # Cambia 'main' por la rama principal de tu repositorio si es diferente + - develop + paths: + - packages/backend/** + - packages/backend-rs/** + - packages/client/** + - packages/sw/** + - packages/fedired-js/** + - packages/shared/eslint.config.js + - .github/workflows/ci.yml + pull_request: + paths: + - packages/backend/** + - packages/backend-rs/** + - packages/client/** + - packages/sw/** + - packages/fedired-js/** + - packages/shared/eslint.config.js + - .github/workflows/ci.yml -port: 61812 +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.node-version' + cache: 'pnpm' + + - name: Enable corepack + run: corepack enable + + - name: Install dependencies + run: pnpm install --frozen-lockfile -db: - host: 127.0.0.1 - port: 54312 - db: test-fedired - user: postgres - pass: '' -redis: - host: 127.0.0.1 - port: 56312 -id: aidx \ No newline at end of file + lint: + needs: [install] + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + workspace: + - backend + - backend-rs + - client + - sw + - fedired-js + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Restore ESLint cache + uses: actions/cache@v4 + with: + path: node_modules/.cache/eslint-${{ matrix.workspace }} + key: eslint-${{ github.sha }}-${{ matrix.workspace }} + restore-keys: eslint-${{ matrix.workspace }}- + + - name: Run ESLint + run: pnpm --filter ${{ matrix.workspace }} run lint --cache --cache-location node_modules/.cache/eslint-${{ matrix.workspace }} + + typecheck: + needs: [install] + runs-on: ubuntu-latest + continue-on-error: true + strategy: + matrix: + workspace: + - backend + - backend-rs + - fedired-js + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Run TypeScript type check + run: pnpm --filter ${{ matrix.workspace }} run typecheck From 73ff5c83c6f8f6b686da07485dcc122209b5c5df Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 14:42:01 -0600 Subject: [PATCH 09/25] udpate ci --- .github/workflows/ci.yml | 68 ++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d604cb..11beb1e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,17 +1,19 @@ -name: Test (production install and build) +name: Test (fedired.js) on: push: - branches: - - master - - develop + branches: [ develop ] + paths: + - packages/fedired-js/** + - .github/workflows/ci.yml pull_request: - -env: - NODE_ENV: production - + branches: [ develop ] + paths: + - packages/fedired-js/** + - .github/workflows/ci.yml jobs: - production: + test: + runs-on: ubuntu-latest strategy: @@ -19,21 +21,33 @@ jobs: node-version: [20.16.0] steps: - - uses: actions/checkout@v4.1.1 - with: - submodules: true - - name: Install pnpm - uses: pnpm/action-setup@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4.0.4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - run: corepack enable - - run: pnpm i --no-frozen-lockfile # Cambiado aquí - - name: Check pnpm-lock.yaml - run: git diff --exit-code pnpm-lock.yaml - - name: Copy Configure - run: cp .github/fedired/test.yml .config/default.yml - - name: Build - run: pnpm build + - name: Checkout + uses: actions/checkout@v4.1.1 + + - run: corepack enable + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4.0.4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm i --frozen-lockfile + + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + + - name: Build + run: pnpm --filter fedired-js build + + - name: Test + run: pnpm --filter fedired-js test + env: + CI: true + + - name: Upload Coverage + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: ./packages/fedired-js/coverage/coverage-final.json \ No newline at end of file From e252bc89c3385175191f6547acb5c9db2fc98d55 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 15:16:10 -0600 Subject: [PATCH 10/25] update ci --- .github/labeler.yml | 15 ------------ .github/workflows/build_memory.yml | 23 ++++++++++++++++++ .github/workflows/labeler.yml | 16 ------------- .github/workflows/nodejs.yml | 38 ++++++++++++++++++++++++++++++ 4 files changed, 61 insertions(+), 31 deletions(-) delete mode 100644 .github/labeler.yml create mode 100644 .github/workflows/build_memory.yml delete mode 100644 .github/workflows/labeler.yml create mode 100644 .github/workflows/nodejs.yml diff --git a/.github/labeler.yml b/.github/labeler.yml deleted file mode 100644 index 27947ea..0000000 --- a/.github/labeler.yml +++ /dev/null @@ -1,15 +0,0 @@ -# .github/labeler.yml - -version: 2 - -pull_request: - 'packages/backend/**': - - backend - 'packages/backend-rs/**': - - backend-rust - 'packages/client/**': - - client - 'packages/sw/**': - - service-worker - 'packages/fedired-js/**': - - frontend diff --git a/.github/workflows/build_memory.yml b/.github/workflows/build_memory.yml new file mode 100644 index 0000000..fca34c9 --- /dev/null +++ b/.github/workflows/build_memory.yml @@ -0,0 +1,23 @@ +name: Build with 1GB + +on: [push] + +jobs: + build_and_test: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [20.x] + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4.0.0 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: NODE_ENV=production pnpm i --frozen-lockfile + - run: NODE_ENV=production NODE_OPTIONS=--max-old-space-size=464 pnpm run build + - run: ls built/meta.json diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml deleted file mode 100644 index cab313b..0000000 --- a/.github/workflows/labeler.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: "Pull Request Labeler" -on: - pull_request_target: - branches-ignore: - - 'l10n_develop' - -jobs: - triage: - permissions: - contents: read - pull-requests: write - runs-on: ubuntu-latest - steps: - - uses: actions/labeler@v5 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" \ No newline at end of file diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml new file mode 100644 index 0000000..e4026a4 --- /dev/null +++ b/.github/workflows/nodejs.yml @@ -0,0 +1,38 @@ +name: Node.js CI + +on: [push] + +jobs: + build_and_test: + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x] + + services: + mongo: + image: mongo:4.4-bionic + ports: + - 57010:27017 + redis: + image: redis:6.2-alpine + ports: + - 56310:6379 + + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4.0.0 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: node cli/diag-environment.js + - run: sudo apt-get update -y + - run: sudo apt-get install -y --no-install-recommends ffmpeg + - run: pnpm i --frozen-lockfile + - run: pnpm build + - run: ls built/meta.json + - run: cp test/test.yml .config/ + - run: pnpm test \ No newline at end of file From cf8de81a2aaa3a72b0adc9a0ca2b0b61c659ffea Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 15:20:25 -0600 Subject: [PATCH 11/25] a --- .github/workflows/build_memory.yml | 2 +- .github/workflows/ci.yml | 4 ++-- .github/workflows/nodejs.yml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_memory.yml b/.github/workflows/build_memory.yml index fca34c9..bf3dc44 100644 --- a/.github/workflows/build_memory.yml +++ b/.github/workflows/build_memory.yml @@ -16,7 +16,7 @@ jobs: - uses: pnpm/action-setup@v4.0.0 - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'pnpm' - run: NODE_ENV=production pnpm i --frozen-lockfile - run: NODE_ENV=production NODE_OPTIONS=--max-old-space-size=464 pnpm run build diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 11beb1e..229e855 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,10 +26,10 @@ jobs: - run: corepack enable - - name: Setup Node.js ${{ matrix.node-version }} + - name: Setup Node.js 20 uses: actions/setup-node@v4.0.4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'pnpm' - name: Install dependencies diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index e4026a4..867828b 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -26,7 +26,7 @@ jobs: - uses: pnpm/action-setup@v4.0.0 - uses: actions/setup-node@v4 with: - node-version: ${{ matrix.node-version }} + node-version: 20 cache: 'pnpm' - run: node cli/diag-environment.js - run: sudo apt-get update -y From e4cf95b8ae539b62d738b3cce842b636840c47cc Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 18:21:18 -0600 Subject: [PATCH 12/25] add github integration and update mknote --- packages/backend/src/models/entities/meta.ts | 17 + .../src/server/api/endpoints/admin/meta.ts | 5 + .../server/api/endpoints/admin/update-meta.ts | 3 + .../backend/src/server/api/endpoints/meta.ts | 5 + .../backend/src/server/api/service/github.ts | 295 ++++++++++++++++++ packages/client/src/components/MkSignin.vue | 12 + .../src/components/note/MkNoteHeader.vue | 39 +-- .../src/pages/admin/integrations.github.vue | 69 ++++ .../client/src/pages/settings/integration.vue | 67 ++++ packages/fedired-js/src/entities.ts | 1 + 10 files changed, 488 insertions(+), 25 deletions(-) create mode 100644 packages/backend/src/server/api/service/github.ts create mode 100644 packages/client/src/pages/admin/integrations.github.vue create mode 100644 packages/client/src/pages/settings/integration.vue diff --git a/packages/backend/src/models/entities/meta.ts b/packages/backend/src/models/entities/meta.ts index b6a32e3..73a495f 100644 --- a/packages/backend/src/models/entities/meta.ts +++ b/packages/backend/src/models/entities/meta.ts @@ -348,6 +348,23 @@ export class Meta { length: 128, nullable: true, }) + public enableGithubIntegration: boolean; + + @Column("varchar", { + length: 128, + nullable: true, + }) + public githubClientId: string | null; + + @Column("varchar", { + length: 128, + nullable: true, + }) + public githubClientSecret: string | null; + + @Column("boolean", { + default: false, + }) public deeplAuthKey: string | null; @Column("boolean", { diff --git a/packages/backend/src/server/api/endpoints/admin/meta.ts b/packages/backend/src/server/api/endpoints/admin/meta.ts index 674262c..6eaca6c 100644 --- a/packages/backend/src/server/api/endpoints/admin/meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/meta.ts @@ -178,6 +178,11 @@ export const meta = { optional: false, nullable: false, }, + enableGithubIntegration: { + type: "boolean", + optional: false, + nullable: false, + }, enableServiceWorker: { type: "boolean", optional: false, diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 210b5d2..01f1fe2 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -126,6 +126,9 @@ export const paramDef = { deeplIsPro: { type: "boolean" }, libreTranslateApiUrl: { type: "string", nullable: true }, libreTranslateApiKey: { type: "string", nullable: true }, + enableGithubIntegration: { type: "boolean" }, + githubClientId: { type: "string", nullable: true }, + githubClientSecret: { type: "string", nullable: true }, enableEmail: { type: "boolean" }, email: { type: "string", nullable: true }, smtpSecure: { type: "boolean" }, diff --git a/packages/backend/src/server/api/endpoints/meta.ts b/packages/backend/src/server/api/endpoints/meta.ts index efce27f..c05b00f 100644 --- a/packages/backend/src/server/api/endpoints/meta.ts +++ b/packages/backend/src/server/api/endpoints/meta.ts @@ -287,6 +287,11 @@ export const meta = { optional: false, nullable: false, }, + enableGithubIntegration: { + type: "boolean", + optional: false, + nullable: false, + }, enableServiceWorker: { type: "boolean", optional: false, diff --git a/packages/backend/src/server/api/service/github.ts b/packages/backend/src/server/api/service/github.ts new file mode 100644 index 0000000..d829997 --- /dev/null +++ b/packages/backend/src/server/api/service/github.ts @@ -0,0 +1,295 @@ +import type Koa from "koa"; +import Router from "@koa/router"; +import { OAuth2 } from "oauth"; +import { v4 as uuid } from "uuid"; +import { IsNull } from "typeorm"; +import { getJson } from "@/misc/fetch.js"; +import config from "@/config/index.js"; +import { publishMainStream } from "@/services/stream.js"; +import { fetchMeta } from "@/misc/fetch-meta.js"; +import { Users, UserProfiles } from "@/models/index.js"; +import type { ILocalUser } from "@/models/entities/user.js"; +import { redisClient } from "../../../db/redis.js"; +import signin from "../common/signin.js"; + +function getUserToken(ctx: Koa.BaseContext): string | null { + return ((ctx.headers["cookie"] || "").match(/igi=(\w+)/) || [null, null])[1]; +} + +function compareOrigin(ctx: Koa.BaseContext): boolean { + function normalizeUrl(url?: string): string { + return url ? (url.endsWith("/") ? url.slice(0, url.length - 1) : url) : ""; + } + + const referer = ctx.headers["referer"]; + + return normalizeUrl(referer) === normalizeUrl(config.url); +} + +// Init router +const router = new Router(); + +router.get("/disconnect/github", async (ctx) => { + if (!compareOrigin(ctx)) { + ctx.throw(400, "invalid origin"); + return; + } + + const userToken = getUserToken(ctx); + if (!userToken) { + ctx.throw(400, "signin required"); + return; + } + + const user = await Users.findOneByOrFail({ + host: IsNull(), + token: userToken, + }); + + const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); + + profile.integrations.github = undefined; + + await UserProfiles.update(user.id, { + integrations: profile.integrations, + }); + + ctx.body = "El enlace de GitHub ha sido cancelado. :v:"; + + // Publish i updated event + publishMainStream( + user.id, + "meUpdated", + await Users.pack(user, user, { + detail: true, + includeSecrets: true, + }), + ); +}); + +async function getOath2() { + const meta = await fetchMeta(true); + + if ( + meta.enableGithubIntegration && + meta.githubClientId && + meta.githubClientSecret + ) { + return new OAuth2( + meta.githubClientId, + meta.githubClientSecret, + "https://github.com/", + "login/oauth/authorize", + "login/oauth/access_token", + ); + } else { + return null; + } +} + +router.get("/connect/github", async (ctx) => { + if (!compareOrigin(ctx)) { + ctx.throw(400, "invalid origin"); + return; + } + + const userToken = getUserToken(ctx); + if (!userToken) { + ctx.throw(400, "signin required"); + return; + } + + const params = { + redirect_uri: `${config.url}/api/gh/cb`, + scope: ["read:user"], + state: uuid(), + }; + + redisClient.set(userToken, JSON.stringify(params)); + + const oauth2 = await getOath2(); + ctx.redirect(oauth2!.getAuthorizeUrl(params)); +}); + +router.get("/signin/github", async (ctx) => { + const sessid = uuid(); + + const params = { + redirect_uri: `${config.url}/api/gh/cb`, + scope: ["read:user"], + state: uuid(), + }; + + ctx.cookies.set("signin_with_github_sid", sessid, { + path: "/", + secure: config.url.startsWith("https"), + httpOnly: true, + }); + + redisClient.set(sessid, JSON.stringify(params)); + + const oauth2 = await getOath2(); + ctx.redirect(oauth2!.getAuthorizeUrl(params)); +}); + +router.get("/gh/cb", async (ctx) => { + const userToken = getUserToken(ctx); + + const oauth2 = await getOath2(); + + if (!userToken) { + const sessid = ctx.cookies.get("signin_with_github_sid"); + + if (!sessid) { + ctx.throw(400, "invalid session"); + return; + } + + const code = ctx.query.code; + + if (!code || typeof code !== "string") { + ctx.throw(400, "invalid session"); + return; + } + + const { redirect_uri, state } = await new Promise((res, rej) => { + redisClient.get(sessid, async (_, state) => { + res(JSON.parse(state)); + }); + }); + + if (ctx.query.state !== state) { + ctx.throw(400, "invalid session"); + return; + } + + const { accessToken } = await new Promise((res, rej) => + oauth2!.getOAuthAccessToken( + code, + { + redirect_uri, + }, + (err, accessToken, refresh, result) => { + if (err) { + rej(err); + } else if (result.error) { + rej(result.error); + } else { + res({ accessToken }); + } + }, + ), + ); + + const { login, id } = (await getJson( + "https://api.github.com/user", + "application/vnd.github.v3+json", + 10 * 1000, + { + Authorization: `bearer ${accessToken}`, + }, + )) as Record; + if (typeof login !== "string" || typeof id !== "string") { + ctx.throw(400, "invalid session"); + return; + } + + const link = await UserProfiles.createQueryBuilder() + .where("\"integrations\"->'github'->>'id' = :id", { id: id }) + .andWhere('"userHost" IS NULL') + .getOne(); + + if (link == null) { + ctx.throw( + 404, + `@${login}No había ninguna cuenta de Fedired vinculada con...`, + ); + return; + } + + signin( + ctx, + (await Users.findOneBy({ id: link.userId })) as ILocalUser, + true, + ); + } else { + const code = ctx.query.code; + + if (!code || typeof code !== "string") { + ctx.throw(400, "invalid session"); + return; + } + + const { redirect_uri, state } = await new Promise((res, rej) => { + redisClient.get(userToken, async (_, state) => { + res(JSON.parse(state)); + }); + }); + + if (ctx.query.state !== state) { + ctx.throw(400, "invalid session"); + return; + } + + const { accessToken } = await new Promise((res, rej) => + oauth2!.getOAuthAccessToken( + code, + { redirect_uri }, + (err, accessToken, refresh, result) => { + if (err) { + rej(err); + } else if (result.error) { + rej(result.error); + } else { + res({ accessToken }); + } + }, + ), + ); + + const { login, id } = (await getJson( + "https://api.github.com/user", + "application/vnd.github.v3+json", + 10 * 1000, + { + Authorization: `bearer ${accessToken}`, + }, + )) as Record; + + if (typeof login !== "string" || typeof id !== "string") { + ctx.throw(400, "invalid session"); + return; + } + + const user = await Users.findOneByOrFail({ + host: IsNull(), + token: userToken, + }); + + const profile = await UserProfiles.findOneByOrFail({ userId: user.id }); + + await UserProfiles.update(user.id, { + integrations: { + ...profile.integrations, + github: { + accessToken: accessToken, + id: id, + login: login, + }, + }, + }); + + ctx.body = `GitHub: @${login} conectado a Fedired: @${user.username}! `; + // Publish i updated event + publishMainStream( + user.id, + "meUpdated", + await Users.pack(user, user, { + detail: true, + includeSecrets: true, + }), + ); + } +}); + +export default router; diff --git a/packages/client/src/components/MkSignin.vue b/packages/client/src/components/MkSignin.vue index 0f4ec6e..9ba5883 100644 --- a/packages/client/src/components/MkSignin.vue +++ b/packages/client/src/components/MkSignin.vue @@ -130,6 +130,18 @@ + diff --git a/packages/client/src/components/note/MkNoteHeader.vue b/packages/client/src/components/note/MkNoteHeader.vue index 7d4fbe9..56c1e4d 100644 --- a/packages/client/src/components/note/MkNoteHeader.vue +++ b/packages/client/src/components/note/MkNoteHeader.vue @@ -92,14 +92,13 @@ function openServerInfo() { justify-self: flex-end; border-radius: 100px; font-size: 0.8em; - text-shadow: 0 2px 2px var(--shadow); > .avatar { - inline-size: 3.7em; - block-size: 3.7em; - margin-inline-end: 1em; + width: 3.7em; + height: 3.7em; + margin-right: 1em; } > .user-info { - inline-size: 0; + width: 0; flex-grow: 1; line-height: 1.5; display: flex; @@ -107,13 +106,13 @@ function openServerInfo() { > div { &:first-child { flex-grow: 1; - inline-size: 0; + width: 0; overflow: hidden; text-overflow: ellipsis; gap: 0.1em 0; } &:last-child { - max-inline-size: 50%; + max-width: 50%; gap: 0.3em 0.5em; } .article > .main & { @@ -124,17 +123,14 @@ function openServerInfo() { align-items: flex-end; } > * { - max-inline-size: 100%; + max-width: 100%; } } } .name { // flex: 1 1 0px; display: inline; - margin-block-start: 0; - margin-inline-end: 0.5em; - margin-block-end: 0; - margin-inline-start: 0; + margin: 0 0.5em 0 0; padding: 0; overflow: hidden; font-weight: bold; @@ -144,12 +140,8 @@ function openServerInfo() { .mkusername > .is-bot { flex-shrink: 0; align-self: center; - margin-block-start: 0; - margin-inline-end: 0.5em; - margin-block-end: 0; - margin-inline-start: 0; - padding-block: 1px; - padding-inline: 6px; + margin: 0 0.5em 0 0; + padding: 1px 6px; font-size: 80%; border: solid 0.5px var(--divider); border-radius: 3px; @@ -162,10 +154,7 @@ function openServerInfo() { .username { display: inline; - margin-block-start: 0; - margin-inline-end: 0.5em; - margin-block-end: 0; - margin-inline-start: 0; + margin: 0 0.5em 0 0; overflow: hidden; text-overflow: ellipsis; align-self: flex-start; @@ -175,10 +164,10 @@ function openServerInfo() { .info { display: inline-flex; flex-shrink: 0; - margin-inline-start: 0.5em; + margin-left: 0.5em; font-size: 0.9em; .created-at { - max-inline-size: 100%; + max-width: 100%; overflow: hidden; text-overflow: ellipsis; } @@ -186,7 +175,7 @@ function openServerInfo() { .ticker { display: inline-flex; - margin-inline-start: 0.5em; + margin-left: 0.5em; vertical-align: middle; > .name { display: none; diff --git a/packages/client/src/pages/admin/integrations.github.vue b/packages/client/src/pages/admin/integrations.github.vue new file mode 100644 index 0000000..67c57a7 --- /dev/null +++ b/packages/client/src/pages/admin/integrations.github.vue @@ -0,0 +1,69 @@ + + + diff --git a/packages/client/src/pages/settings/integration.vue b/packages/client/src/pages/settings/integration.vue new file mode 100644 index 0000000..2b9b541 --- /dev/null +++ b/packages/client/src/pages/settings/integration.vue @@ -0,0 +1,67 @@ + + + \ No newline at end of file diff --git a/packages/fedired-js/src/entities.ts b/packages/fedired-js/src/entities.ts index 83ebc25..71a4a47 100644 --- a/packages/fedired-js/src/entities.ts +++ b/packages/fedired-js/src/entities.ts @@ -370,6 +370,7 @@ export type LiteInstanceMetadata = { swPublickey: string | null; maxNoteTextLength: number; enableEmail: boolean; + enableGithubIntegration: boolean; enableServiceWorker: boolean; markLocalFilesNsfwByDefault: boolean; emojis: CustomEmoji[]; From 26ce0f8e8781509c42c7807e9cdcc9affca96fc6 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 18:39:25 -0600 Subject: [PATCH 13/25] update --- .github/fedired/test.yml | 101 ----------------------------- .github/workflows/build_memory.yml | 23 ------- .github/workflows/ci.yml | 53 --------------- .github/workflows/nodejs.yml | 38 ----------- .github/workflows/npm-publish.yml | 33 ---------- 5 files changed, 248 deletions(-) delete mode 100644 .github/fedired/test.yml delete mode 100644 .github/workflows/build_memory.yml delete mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/nodejs.yml delete mode 100644 .github/workflows/npm-publish.yml diff --git a/.github/fedired/test.yml b/.github/fedired/test.yml deleted file mode 100644 index 2302820..0000000 --- a/.github/fedired/test.yml +++ /dev/null @@ -1,101 +0,0 @@ -name: CI for Fedired - -on: - push: - branches: - - main # Cambia 'main' por la rama principal de tu repositorio si es diferente - - develop - paths: - - packages/backend/** - - packages/backend-rs/** - - packages/client/** - - packages/sw/** - - packages/fedired-js/** - - packages/shared/eslint.config.js - - .github/workflows/ci.yml - pull_request: - paths: - - packages/backend/** - - packages/backend-rs/** - - packages/client/** - - packages/sw/** - - packages/fedired-js/** - - packages/shared/eslint.config.js - - .github/workflows/ci.yml - -jobs: - install: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version-file: '.node-version' - cache: 'pnpm' - - - name: Enable corepack - run: corepack enable - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - lint: - needs: [install] - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - workspace: - - backend - - backend-rs - - client - - sw - - fedired-js - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Restore ESLint cache - uses: actions/cache@v4 - with: - path: node_modules/.cache/eslint-${{ matrix.workspace }} - key: eslint-${{ github.sha }}-${{ matrix.workspace }} - restore-keys: eslint-${{ matrix.workspace }}- - - - name: Run ESLint - run: pnpm --filter ${{ matrix.workspace }} run lint --cache --cache-location node_modules/.cache/eslint-${{ matrix.workspace }} - - typecheck: - needs: [install] - runs-on: ubuntu-latest - continue-on-error: true - strategy: - matrix: - workspace: - - backend - - backend-rs - - fedired-js - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - submodules: true - - - name: Install dependencies - run: pnpm install --frozen-lockfile - - - name: Run TypeScript type check - run: pnpm --filter ${{ matrix.workspace }} run typecheck diff --git a/.github/workflows/build_memory.yml b/.github/workflows/build_memory.yml deleted file mode 100644 index bf3dc44..0000000 --- a/.github/workflows/build_memory.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Build with 1GB - -on: [push] - -jobs: - build_and_test: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4.0.0 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'pnpm' - - run: NODE_ENV=production pnpm i --frozen-lockfile - - run: NODE_ENV=production NODE_OPTIONS=--max-old-space-size=464 pnpm run build - - run: ls built/meta.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 229e855..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,53 +0,0 @@ -name: Test (fedired.js) - -on: - push: - branches: [ develop ] - paths: - - packages/fedired-js/** - - .github/workflows/ci.yml - pull_request: - branches: [ develop ] - paths: - - packages/fedired-js/** - - .github/workflows/ci.yml -jobs: - test: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.16.0] - - steps: - - name: Checkout - uses: actions/checkout@v4.1.1 - - - run: corepack enable - - - name: Setup Node.js 20 - uses: actions/setup-node@v4.0.4 - with: - node-version: 20 - cache: 'pnpm' - - - name: Install dependencies - run: pnpm i --frozen-lockfile - - - name: Check pnpm-lock.yaml - run: git diff --exit-code pnpm-lock.yaml - - - name: Build - run: pnpm --filter fedired-js build - - - name: Test - run: pnpm --filter fedired-js test - env: - CI: true - - - name: Upload Coverage - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: ./packages/fedired-js/coverage/coverage-final.json \ No newline at end of file diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml deleted file mode 100644 index 867828b..0000000 --- a/.github/workflows/nodejs.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Node.js CI - -on: [push] - -jobs: - build_and_test: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [18.x, 20.x] - - services: - mongo: - image: mongo:4.4-bionic - ports: - - 57010:27017 - redis: - image: redis:6.2-alpine - ports: - - 56310:6379 - - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4.0.0 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: 'pnpm' - - run: node cli/diag-environment.js - - run: sudo apt-get update -y - - run: sudo apt-get install -y --no-install-recommends ffmpeg - - run: pnpm i --frozen-lockfile - - run: pnpm build - - run: ls built/meta.json - - run: cp test/test.yml .config/ - - run: pnpm test \ No newline at end of file diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml deleted file mode 100644 index 2a4766d..0000000 --- a/.github/workflows/npm-publish.yml +++ /dev/null @@ -1,33 +0,0 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages - -name: Node.js Package - -on: - release: - types: [created] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - - run: npm ci - - run: npm test - - publish-npm: - needs: build - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - - run: npm ci - - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.npm_token}} From 301970484f38530c0daa6d445d99f046679abeef Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 19:19:47 -0600 Subject: [PATCH 14/25] update code --- .../server/api/endpoints/admin/update-meta.ts | 12 +++++ .../client/src/pages/admin/integrations.vue | 52 +++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 packages/client/src/pages/admin/integrations.vue diff --git a/packages/backend/src/server/api/endpoints/admin/update-meta.ts b/packages/backend/src/server/api/endpoints/admin/update-meta.ts index 01f1fe2..f31ead3 100644 --- a/packages/backend/src/server/api/endpoints/admin/update-meta.ts +++ b/packages/backend/src/server/api/endpoints/admin/update-meta.ts @@ -400,6 +400,18 @@ export default define(meta, paramDef, async (ps, me) => { set.summalyProxy = ps.summalyProxy; } + + if (ps.enableGithubIntegration !== undefined) { + set.enableGithubIntegration = ps.enableGithubIntegration; + } + + if (ps.githubClientId !== undefined) { + set.githubClientId = ps.githubClientId; + } + + if (ps.githubClientSecret !== undefined) { + set.githubClientSecret = ps.githubClientSecret; + } if (ps.enableEmail !== undefined) { set.enableEmail = ps.enableEmail; } diff --git a/packages/client/src/pages/admin/integrations.vue b/packages/client/src/pages/admin/integrations.vue new file mode 100644 index 0000000..acab68e --- /dev/null +++ b/packages/client/src/pages/admin/integrations.vue @@ -0,0 +1,52 @@ + + + \ No newline at end of file From 19c36c27d6470d947500f972274a3bc976c78ad2 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 19:35:53 -0600 Subject: [PATCH 15/25] update --- packages/client/src/pages/admin/index.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 3f3bf2f..17a699b 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -258,6 +258,12 @@ const menuDef = computed(() => [ to: "/admin/relays", active: currentPage.value?.route.name === "relays", }, + { + icon: "ph-plug ph-bold ph-lg", + text: i18n.ts.integration, + to: "/admin/integrations", + active: currentPage?.route.name === "integrations", + }, { icon: `${icon("ph-prohibit")}`, text: i18n.ts.instanceBlocking, From 0b0fb8cb575babc964f67a3fc39c5b216369080c Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 19:46:55 -0600 Subject: [PATCH 16/25] update --- packages/client/src/pages/admin/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 17a699b..72e38ec 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -259,10 +259,10 @@ const menuDef = computed(() => [ active: currentPage.value?.route.name === "relays", }, { - icon: "ph-plug ph-bold ph-lg", + icon: `${icon("ph-thin ph-plug")}`, text: i18n.ts.integration, to: "/admin/integrations", - active: currentPage?.route.name === "integrations", + active: currentPage.value?.route.name === "integrations", }, { icon: `${icon("ph-prohibit")}`, From 5135f62459b3da40ab99501867ba55c7ef970d8c Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 22:56:02 -0600 Subject: [PATCH 17/25] update integrations --- locales/ar-SA.yml | 2 ++ locales/bg-BG.yml | 2 ++ locales/en-US.yml | 1 + locales/es-ES.yml | 1 + packages/client/src/pages/admin/integrations.vue | 2 +- 5 files changed, 7 insertions(+), 1 deletion(-) diff --git a/locales/ar-SA.yml b/locales/ar-SA.yml index cef6a73..cafb7fa 100644 --- a/locales/ar-SA.yml +++ b/locales/ar-SA.yml @@ -537,6 +537,8 @@ menu: "القائمة" divider: "فاصل" addItem: "إضافة عنصر" relays: "المُرَحلات" +integrations: "Integrations" + addRelay: "إضافة مُرحّل" inboxUrl: "رابط صندوق الوارد" addedRelays: "المرحلات المضافة" diff --git a/locales/bg-BG.yml b/locales/bg-BG.yml index 7f04afb..feced92 100644 --- a/locales/bg-BG.yml +++ b/locales/bg-BG.yml @@ -807,6 +807,8 @@ addItem: Добавяне на елемент visibility: Видимост description: Описание _relayStatus: +integrations: "Integrations" + accepted: Прието other: Други channel: Канали diff --git a/locales/en-US.yml b/locales/en-US.yml index b055dbf..e4dc0b8 100644 --- a/locales/en-US.yml +++ b/locales/en-US.yml @@ -639,6 +639,7 @@ menu: "Menu" divider: "Divider" addItem: "Add Item" relays: "Relays" +integrations: "Integrations" addRelay: "Add Relay" inboxUrl: "Inbox URL" addedRelays: "Added Relays" diff --git a/locales/es-ES.yml b/locales/es-ES.yml index 1f04e26..2d20cac 100644 --- a/locales/es-ES.yml +++ b/locales/es-ES.yml @@ -582,6 +582,7 @@ menu: "Menú" divider: "Divisor" addItem: "Agregar elemento" relays: "Relés" +integrations: "Integrations" addRelay: "Agregar relé" inboxUrl: "Inbox URL" addedRelays: "Relés añadidos" diff --git a/packages/client/src/pages/admin/integrations.vue b/packages/client/src/pages/admin/integrations.vue index acab68e..937f423 100644 --- a/packages/client/src/pages/admin/integrations.vue +++ b/packages/client/src/pages/admin/integrations.vue @@ -49,4 +49,4 @@ definePageMetadata({ title: i18n.ts.integration, icon: "ph-plug ph-bold ph-lg", }); - \ No newline at end of file + From 60303a9fb925ecf773a30726bb14b814ab4aed17 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 23:01:29 -0600 Subject: [PATCH 18/25] update locales --- locales/bg-BG.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/locales/bg-BG.yml b/locales/bg-BG.yml index feced92..1ca6112 100644 --- a/locales/bg-BG.yml +++ b/locales/bg-BG.yml @@ -806,10 +806,7 @@ emailAddress: Адрес за ел. поща addItem: Добавяне на елемент visibility: Видимост description: Описание -_relayStatus: -integrations: "Integrations" - - accepted: Прието +accepted: Прието other: Други channel: Канали accountInfo: Информация за акаунта From 4085882ae575fa50dc871c7d1039356e94f61538 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 23:12:20 -0600 Subject: [PATCH 19/25] update --- packages/client/src/pages/admin/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 72e38ec..629d80b 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -260,7 +260,7 @@ const menuDef = computed(() => [ }, { icon: `${icon("ph-thin ph-plug")}`, - text: i18n.ts.integration, + text: i18n.ts.integration.title, to: "/admin/integrations", active: currentPage.value?.route.name === "integrations", }, From d92a994cffe74b4524301166e695aa831b30621d Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 23:23:17 -0600 Subject: [PATCH 20/25] update --- packages/client/src/pages/admin/index.vue | 5 +++-- packages/client/src/pages/admin/integrations.vue | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 629d80b..2104fd9 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -94,6 +94,7 @@ import { provideMetadataReceiver, } from "@/scripts/page-metadata"; import icon from "@/scripts/icon"; +import Integrations from './integrations.vue' // Importa el componente de integración const isEmpty = (x: string | null) => x == null || x === ""; const el = ref(null); @@ -260,7 +261,7 @@ const menuDef = computed(() => [ }, { icon: `${icon("ph-thin ph-plug")}`, - text: i18n.ts.integration.title, + text: i18n.ts.integration, to: "/admin/integrations", active: currentPage.value?.route.name === "integrations", }, @@ -473,4 +474,4 @@ defineExpose({ } } } - + \ No newline at end of file diff --git a/packages/client/src/pages/admin/integrations.vue b/packages/client/src/pages/admin/integrations.vue index 937f423..8223dff 100644 --- a/packages/client/src/pages/admin/integrations.vue +++ b/packages/client/src/pages/admin/integrations.vue @@ -26,7 +26,7 @@ - + \ No newline at end of file From 3482ca7edc0212f7169c2a47812abb568b8039f0 Mon Sep 17 00:00:00 2001 From: srnovus Date: Wed, 30 Oct 2024 23:44:23 -0600 Subject: [PATCH 23/25] a --- packages/client/src/pages/admin/index.vue | 38 +- .../client/src/pages/admin/integrations.vue | 482 ++++++++++++++++-- 2 files changed, 472 insertions(+), 48 deletions(-) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 4a0594e..72e38ec 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -10,6 +10,7 @@ class="icon" /> + Reciber Soporte + @@ -64,6 +66,7 @@ + + \ No newline at end of file + diff --git a/packages/client/src/pages/admin/integrations.vue b/packages/client/src/pages/admin/integrations.vue index 8223dff..4a0594e 100644 --- a/packages/client/src/pages/admin/integrations.vue +++ b/packages/client/src/pages/admin/integrations.vue @@ -1,52 +1,444 @@ - + \ No newline at end of file From e9f0ef99dc3af496f9da4ea21c8bf02d88197ca7 Mon Sep 17 00:00:00 2001 From: srnovus Date: Thu, 31 Oct 2024 07:18:39 -0600 Subject: [PATCH 24/25] update --- .../client/src/pages/admin/integrations.vue | 39 +++++++++++++++---- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/packages/client/src/pages/admin/integrations.vue b/packages/client/src/pages/admin/integrations.vue index 4a0594e..7345d69 100644 --- a/packages/client/src/pages/admin/integrations.vue +++ b/packages/client/src/pages/admin/integrations.vue @@ -10,6 +10,7 @@ class="icon" /> + + + \ No newline at end of file + From 67eeb5501773d84f75988df70e9b49f13a12af77 Mon Sep 17 00:00:00 2001 From: srnovus Date: Thu, 31 Oct 2024 07:22:58 -0600 Subject: [PATCH 25/25] update --- packages/client/src/pages/admin/index.vue | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/packages/client/src/pages/admin/index.vue b/packages/client/src/pages/admin/index.vue index 72e38ec..9fafef1 100644 --- a/packages/client/src/pages/admin/index.vue +++ b/packages/client/src/pages/admin/index.vue @@ -56,7 +56,7 @@ >Reciber Soporte - + @@ -258,12 +258,6 @@ const menuDef = computed(() => [ to: "/admin/relays", active: currentPage.value?.route.name === "relays", }, - { - icon: `${icon("ph-thin ph-plug")}`, - text: i18n.ts.integration, - to: "/admin/integrations", - active: currentPage.value?.route.name === "integrations", - }, { icon: `${icon("ph-prohibit")}`, text: i18n.ts.instanceBlocking,