Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
siccous committed Jan 1, 2025
2 parents 57aaed9 + a16402e commit 6fe59f0
Show file tree
Hide file tree
Showing 817 changed files with 80,313 additions and 27,989 deletions.
25 changes: 22 additions & 3 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ DATABASE_URL=postgresql://postgres:testpass@hoppscotch-db:5432/hoppscotch
JWT_SECRET="secret1233"
TOKEN_SALT_COMPLEXITY=10
MAGIC_LINK_TOKEN_VALIDITY= 3
REFRESH_TOKEN_VALIDITY="604800000" # Default validity is 7 days (604800000 ms) in ms
ACCESS_TOKEN_VALIDITY="86400000" # Default validity is 1 day (86400000 ms) in ms
# Default validity is 7 days (604800000 ms) in ms
REFRESH_TOKEN_VALIDITY="604800000"
# Default validity is 1 day (86400000 ms) in ms
ACCESS_TOKEN_VALIDITY="86400000"
SESSION_SECRET='add some secret here'
# Reccomended to be true, set to false if you are using http
# Note: Some auth providers may not support http requests
ALLOW_SECURE_COOKIES=true

# Sensitive Data Encryption Key while storing in Database (32 character)
DATA_ENCRYPTION_KEY="data encryption key with 32 char"

# Hoppscotch App Domain Config
REDIRECT_URL="http://localhost:3000"
Expand Down Expand Up @@ -45,9 +53,20 @@ OIDC_TOKEN_URL="************************************************"
OIDC_USERINFO_URL="************************************************"

# Mailer config
MAILER_SMTP_URL="smtps://[email protected]:[email protected]"
MAILER_SMTP_ENABLE="true"
MAILER_USE_CUSTOM_CONFIGS="false"
MAILER_ADDRESS_FROM='"From Name Here" <[email protected]>'

MAILER_SMTP_URL="smtps://[email protected]:[email protected]" # used if custom mailer configs is false

# The following are used if custom mailer configs is true
MAILER_SMTP_HOST="smtp.domain.com"
MAILER_SMTP_PORT="587"
MAILER_SMTP_SECURE="true"
MAILER_SMTP_USER="[email protected]"
MAILER_SMTP_PASSWORD="pass"
MAILER_TLS_REJECT_UNAUTHORIZED="true"

# Rate Limit Config
RATE_LIMIT_TTL=60 # In seconds
RATE_LIMIT_MAX=100 # Max requests per IP
Expand Down
17 changes: 6 additions & 11 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ Please make sure that the pull request is limited to one type (docs, feature, et
<!-- If this pull request closes an issue, please mention the issue number below -->
Closes # <!-- Issue # here -->

### Description
<!-- Add a brief description of the pull request -->
<!-- Add an introduction into what this PR tries to solve in a couple of sentences -->

### What's changed
<!-- Describe point by point the different things you have changed in this PR -->

<!-- You can also choose to add a list of changes and if they have been completed or not by using the markdown to-do list syntax
- [ ] Not Completed
- [x] Completed
-->

### Checks
<!-- Make sure your pull request passes the CI checks and do check the following fields as needed - -->
- [ ] My pull request adheres to the code style of this project
- [ ] My code requires changes to the documentation
- [ ] I have updated the documentation as required
- [ ] All the tests have passed

### Additional Information
<!-- Any additional information like breaking changes, dependencies added, screenshots, comparisons between new and old behaviour, etc. -->
### Notes to reviewers
<!-- Any information you feel the reviewer should know about when reviewing your PR -->
249 changes: 249 additions & 0 deletions .github/workflows/build-hoppscotch-agent.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,249 @@
on:
workflow_dispatch:
inputs:
version:
description: Tag of the version to build
required: true

env:
CARGO_TERM_COLOR: always

jobs:
build:
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-22.04, windows-latest]

runs-on: ${{ matrix.platform }}
defaults:
run:
shell: bash

steps:
- name: Checkout hoppscotch/hoppscotch
uses: actions/checkout@v3
with:
repository: hoppscotch/hoppscotch
ref: main
token: ${{ secrets.CHECKOUT_GITHUB_TOKEN }}

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20

- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 9

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install Rust targets (Mac)
if: matrix.platform == 'macos-latest'
run: |
rustup target add aarch64-apple-darwin
rustup target add x86_64-apple-darwin
- name: Install additional tools (Linux)
if: matrix.platform == 'ubuntu-22.04'
run: |
# Install Tauri CLI (binary)
curl -LO "https://github.com/tauri-apps/tauri/releases/download/tauri-cli-v2.0.1/cargo-tauri-x86_64-unknown-linux-gnu.tgz"
tar -xzf cargo-tauri-x86_64-unknown-linux-gnu.tgz
chmod +x cargo-tauri
sudo mv cargo-tauri /usr/local/bin/tauri
# Install Trunk (binary)
curl -LO "https://github.com/thedodd/trunk/releases/download/v0.17.5/trunk-x86_64-unknown-linux-gnu.tar.gz"
tar -xzf trunk-x86_64-unknown-linux-gnu.tar.gz
chmod +x trunk
sudo mv trunk /usr/local/bin/
- name: Install additional tools (Mac)
if: matrix.platform == 'macos-latest'
run: |
# Install Tauri CLI (binary)
mkdir __dist/
cd __dist/
curl -LO "https://github.com/tauri-apps/tauri/releases/download/tauri-cli-v2.0.1/cargo-tauri-aarch64-apple-darwin.zip"
unzip cargo-tauri-aarch64-apple-darwin.zip
chmod +x cargo-tauri
sudo mv cargo-tauri /usr/local/bin/tauri
- name: Install system dependencies (Ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev \
build-essential \
curl \
wget \
file \
libxdo-dev \
libssl-dev \
libayatana-appindicator3-dev \
librsvg2-dev
- name: Setting up Windows Environment and injecting before bundle command (Windows only)
if: matrix.platform == 'windows-latest'
shell: bash
env:
WINDOWS_SIGN_COMMAND: trusted-signing-cli -e ${{ secrets.AZURE_ENDPOINT }} -a ${{ secrets.AZURE_CODE_SIGNING_NAME }} -c ${{ secrets.AZURE_CERT_PROFILE_NAME }} %1
run: |
cd packages/hoppscotch-agent
# Inject signing command into main conf.
cat './src-tauri/tauri.conf.json' | jq '.bundle .windows += { "signCommand": env.WINDOWS_SIGN_COMMAND}' > './src-tauri/temp.json' && mv './src-tauri/temp.json' './src-tauri/tauri.conf.json'
# Inject signing command into portable conf.
cat './src-tauri/tauri.portable.conf.json' | jq '.bundle .windows += { "signCommand": env.WINDOWS_SIGN_COMMAND}' > './src-tauri/temp_portable.json' && mv './src-tauri/temp_portable.json' './src-tauri/tauri.portable.conf.json'
cargo install [email protected]
- name: Set platform-specific variables
run: |
if [ "${{ matrix.platform }}" = "ubuntu-22.04" ]; then
echo "target_arch=$(rustc -Vv | grep host | awk '{print $2}')" >> $GITHUB_ENV
echo "target_ext=" >> $GITHUB_ENV
echo "target_os_name=linux" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "windows-latest" ]; then
echo "target_arch=x86_64-pc-windows-msvc" >> $GITHUB_ENV
echo "target_ext=.exe" >> $GITHUB_ENV
echo "target_os_name=win" >> $GITHUB_ENV
elif [ "${{ matrix.platform }}" = "macos-latest" ]; then
echo "target_os_name=mac" >> $GITHUB_ENV
fi
- name: Setup macOS code signing
if: matrix.platform == 'macos-latest'
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: |
echo $APPLE_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
security import certificate.p12 -k build.keychain -P $APPLE_CERTIFICATE_PASSWORD -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
- name: Cache Rust dependencies
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- name: Install dependencies
shell: bash
run: |
cd packages/hoppscotch-agent
pnpm install --filter hoppscotch-agent
- name: Build Tauri app (Linux)
if: matrix.platform == 'ubuntu-22.04'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.AGENT_TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.AGENT_TAURI_SIGNING_PASSWORD }}
run: |
cd packages/hoppscotch-agent
pnpm tauri build --verbose -b deb -b appimage -b updater
- name: Build Tauri app (Mac)
if: matrix.platform == 'macos-latest'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.AGENT_TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.AGENT_TAURI_SIGNING_PASSWORD }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
run: |
cd packages/hoppscotch-agent
pnpm tauri build --verbose --target x86_64-apple-darwin
pnpm tauri build --verbose --target aarch64-apple-darwin
- name: Build Tauri app (Windows)
if: matrix.platform == 'windows-latest'
shell: powershell
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.AGENT_TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.AGENT_TAURI_SIGNING_PASSWORD }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
run: |
cd packages/hoppscotch-agent
# Build the portable version first and move it.
# This way the next build will regenerate `hoppscotch-agent.exe`.
pnpm tauri build --verbose --config src-tauri/tauri.portable.conf.json -- --no-default-features --features portable
Rename-Item -Path "src-tauri/target/release/hoppscotch-agent.exe" -NewName "hoppscotch-agent-portable.exe"
# Build the installer version.
pnpm tauri build --verbose -b msi -b updater
- name: Zip portable executable (Windows)
if: matrix.platform == 'windows-latest'
shell: powershell
run: |
Compress-Archive -Path "packages/hoppscotch-agent/src-tauri/target/release/hoppscotch-agent-portable.exe" -DestinationPath "packages/hoppscotch-agent/src-tauri/target/release/Hoppscotch_Agent_win_x64_portable.zip"
- name: Prepare artifacts
shell: bash
run: |
mkdir artifacts
mkdir artifacts/sigs
if [ "${{ matrix.platform }}" = "ubuntu-22.04" ]; then
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/appimage/*.AppImage artifacts/Hoppscotch_Agent_linux_x64.AppImage
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/appimage/*.AppImage.sig artifacts/sigs/Hoppscotch_Agent_linux_x64.AppImage.sig
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/deb/*.deb artifacts/Hoppscotch_Agent_linux_x64.deb
elif [ "${{ matrix.platform }}" = "macos-latest" ]; then
mv packages/hoppscotch-agent/src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/*_x64.dmg artifacts/Hoppscotch_Agent_mac_x64.dmg
mv packages/hoppscotch-agent/src-tauri/target/x86_64-apple-darwin/release/bundle/macos/*.app.tar.gz artifacts/Hoppscotch_Agent_mac_update_x64.tar.gz
mv packages/hoppscotch-agent/src-tauri/target/x86_64-apple-darwin/release/bundle/macos/*.app.tar.gz.sig artifacts/sigs/Hoppscotch_Agent_mac_update_x64.tar.gz.sig
mv packages/hoppscotch-agent/src-tauri/target/aarch64-apple-darwin/release/bundle/dmg/*_aarch64.dmg artifacts/Hoppscotch_Agent_mac_aarch64.dmg
mv packages/hoppscotch-agent/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.app.tar.gz artifacts/Hoppscotch_Agent_mac_update_aarch64.tar.gz
mv packages/hoppscotch-agent/src-tauri/target/aarch64-apple-darwin/release/bundle/macos/*.app.tar.gz.sig artifacts/sigs/Hoppscotch_Agent_mac_update_aarch64.tar.gz.sig
elif [ "${{ matrix.platform }}" = "windows-latest" ]; then
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/msi/*_x64_en-US.msi artifacts/Hoppscotch_Agent_win_x64.msi
mv packages/hoppscotch-agent/src-tauri/target/release/bundle/msi/*_x64_en-US.msi.sig artifacts/sigs/Hoppscotch_Agent_win_x64.msi.sig
mv packages/hoppscotch-agent/src-tauri/target/release/Hoppscotch_Agent_win_x64_portable.zip artifacts/Hoppscotch_Agent_win_x64_portable.zip
fi
- name: Generate checksums (Linux)
if: matrix.platform == 'ubuntu-22.04'
run: |
cd artifacts
mkdir shas
for file in *; do
if [ -f "$file" ]; then
sha256sum "$file" > "shas/${file}.sha256"
fi
done
- name: Generate checksums (Mac)
if: matrix.platform == 'macos-latest'
run: |
cd artifacts
mkdir shas
for file in *; do
if [ -f "$file" ]; then
shasum -a 256 "$file" > "shas/${file}.sha256"
fi
done
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: Hoppscotch_Agent-${{ matrix.platform }}
path: artifacts/*
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-push-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup environment
run: cp .env.example .env
Expand Down
19 changes: 9 additions & 10 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Node.js CI

on:
push:
branches: [main, staging, "release/**"]
branches: [main, next, patch]
pull_request:
branches: [main, staging, "release/**"]
branches: [main, next, patch]

jobs:
test:
Expand All @@ -17,22 +17,21 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup environment
run: mv .env.example .env

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Setup pnpm
uses: pnpm/action-setup@v2.2.4
uses: pnpm/action-setup@v3
with:
version: 8
run_install: true

- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: pnpm

- name: Run tests
run: pnpm test
4 changes: 2 additions & 2 deletions .github/workflows/ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup environment
run: mv .env.example .env
Expand All @@ -26,7 +26,7 @@ jobs:
run_install: true

- name: Setup node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm
Expand Down
Loading

0 comments on commit 6fe59f0

Please sign in to comment.