Skip to content

updated demo redirect handling - #164

Merged
Dargon789 merged 20 commits into
masterfrom
main
May 11, 2026
Merged

updated demo redirect handling#164
Dargon789 merged 20 commits into
masterfrom
main

Conversation

@Dargon789

@Dargon789 Dargon789 commented May 11, 2026

Copy link
Copy Markdown
Owner

Summary by Sourcery

Improve demo redirect URL handling and update asset sync script while adding a basic CircleCI workflow configuration.

Enhancements:

  • Encode the next demo path parameter when constructing redirect URLs for demo routing.
  • Simplify liquid asset download path handling in the asset sync script.

CI:

  • Introduce a minimal CircleCI configuration with a custom executor and placeholder web3-related job.

Dargon789 and others added 17 commits July 4, 2025 23:51
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
* Create SECURITY.md

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

* Update SECURITY.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

---------

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* Summary by Sourcery
Add a new GitHub Actions workflow to build and deploy static content to GitHub Pages.

CI:

Create .github/workflows/static.yml to trigger deployments on pushes to main and manual dispatch
Configure permissions for GITHUB_TOKEN and set concurrency to avoid canceling in-progress runs
Define a deploy job that checks out the repo, configures Pages, uploads the site artifact, and deploys to GitHub Pages

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
…scripting (#39)

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
…te scripting'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
…string with itself'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
@vercel

vercel Bot commented May 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
mempool Ready Ready Preview, Comment May 11, 2026 6:57am

@sourcery-ai

sourcery-ai Bot commented May 11, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates demo redirect URL construction to use the current path and URL-encoded next path, simplifies liquid asset filename handling in the asset sync script, and introduces a basic CircleCI config for a web3/defi/game-related workflow.

Sequence diagram for updated demo redirect handling

sequenceDiagram
  actor User
  participant Browser
  participant AngularRouter
  participant handleDemoRedirect

  User->>Browser: Navigate to demo URL with next param
  Browser->>AngularRouter: Activate route with query params
  AngularRouter->>handleDemoRedirect: Call with route and router
  handleDemoRedirect->>AngularRouter: Read query param next
  handleDemoRedirect->>handleDemoRedirect: Find index in path array
  alt next matches known path
    handleDemoRedirect->>handleDemoRedirect: Set currentPath
    handleDemoRedirect->>handleDemoRedirect: Compute nextPath
    handleDemoRedirect->>handleDemoRedirect: Build redirectUrl with encodeURIComponent
    handleDemoRedirect-->>Browser: Schedule setTimeout 15000ms
    Browser-->>Browser: Wait 15000ms
    Browser->>Browser: window.location.replace redirectUrl
  else next not in path
    handleDemoRedirect-->>AngularRouter: No redirect scheduled
  end
Loading

Flow diagram for simplified Liquid asset sync file handling

graph TD
  A[Start_downloadLiquidAssets] --> B[Log Downloading assets]
  B --> C[Iterate_liquidAssets]
  C --> D[Extract file and url]
  D --> E[Set fileName_to_file]
  E --> F[Log Downloading fileName]
  F --> G[downloadFile with ASSETS_PATH_slash_fileName and url]
  G --> H[Next_asset_or_end]
  H -->|More_assets| C
  H -->|No_more_assets| I[End_downloadLiquidAssets]
Loading

File-Level Changes

Change Details Files
Improve demo redirect URL construction and safety in common Angular utility.
  • Derive the current demo path from the existing path array using the computed index.
  • Compute the next path from the same array and URL-encode it before embedding in the query string.
  • Build the redirect URL using the current path and encoded next path and reuse it in the setTimeout callback instead of interpolating directly from params.
frontend/src/app/shared/common.utils.ts
Simplify Liquid asset filename derivation in the sync-assets script.
  • Remove the redundant replace() call when computing fileName for Liquid assets.
  • Use the file field directly as the target filename for downloadFile calls.
frontend/sync-assets.js
Add a minimal CircleCI workflow configuration using a custom executor.
  • Define a reusable Docker-based executor with authenticated access to Docker Hub using environment variables.
  • Add a placeholder job that checks out the repo and logs the working directory.
  • Wire the job into a simple workflow named my-custom-workflow so it runs on the pipeline.
.circleci/web3_defi_gamefi.yml

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@snyk-io

snyk-io Bot commented May 11, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
🔚 Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new CircleCI configuration, refactors asset synchronization, and updates the demo redirect utility. Feedback includes correcting the CircleCI filename and job naming, updating repository references, and improving asynchronous handling in the asset download script. Additionally, it is recommended to use the Angular Router for redirects instead of a full page reload to maintain SPA behavior.

I am having trouble creating individual review comments. Click here to see my feedback.

.circleci/web3_defi_gamefi.yml (1)

high

CircleCI requires the primary configuration file to be named config.yml and located in the .circleci directory. A file named web3_defi_gamefi.yml will not be recognized by CircleCI unless dynamic configuration is explicitly enabled for this repository.

frontend/sync-assets.js (343-347)

high

The downloadLiquidAssets function uses forEach to trigger asynchronous downloadFile calls without awaiting them. Since the main execution block also does not await downloadLiquidAssets(), the Node.js process could exit before these downloads are finished, potentially resulting in incomplete or corrupted files. Using Promise.all() with map() ensures that these background tasks are properly tracked. Additionally, the fileName variable is redundant and can be removed.

  return Promise.all(liquidAssets.map(({ file, url }) => {
    console.log(`${LOG_TAG} Downloading ${file}`);
    return downloadFile(`${ASSETS_PATH}/${file}`, url);
  }));

.circleci/web3_defi_gamefi.yml (11)

medium

The URL in this comment refers to a specific user's fork (Dargon789/foundry) rather than the main repository. This suggests the configuration was copied from an external source and should be updated to reflect the current project's context.

.circleci/web3_defi_gamefi.yml (15)

medium

The job name web3-defi-game-project- ends with a trailing hyphen, which appears to be a typo or an incomplete identifier. It is recommended to use a cleaner name.

frontend/src/app/shared/common.utils.ts (235)

medium

In an Angular application, using window.location.replace() triggers a full page reload, which is inefficient as it destroys and re-initializes the application state. Since the Router is already provided as an argument to this function, it is recommended to use router.navigateByUrl() with replaceUrl: true to maintain the Single Page Application (SPA) behavior.

          setTimeout(() => { router.navigateByUrl(redirectUrl, { replaceUrl: true }); }, 15000);

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • In handleDemoRedirect, consider normalizing params.next (e.g., stripping trailing slashes or query strings) before the indexOf lookup so the redirect logic is more robust to minor variations in the path.
  • The new .circleci/web3_defi_gamefi.yml config appears to be a standalone placeholder with project-specific comments and secrets; it may be clearer either to integrate this into the main CircleCI config (or a reusable orb) or relocate it under an examples/ci directory to avoid confusion in the primary CI setup.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In handleDemoRedirect, consider normalizing `params.next` (e.g., stripping trailing slashes or query strings) before the `indexOf` lookup so the redirect logic is more robust to minor variations in the path.
- The new `.circleci/web3_defi_gamefi.yml` config appears to be a standalone placeholder with project-specific comments and secrets; it may be clearer either to integrate this into the main CircleCI config (or a reusable orb) or relocate it under an examples/ci directory to avoid confusion in the primary CI setup.

Fix all in Cursor


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@Dargon789 Dargon789 linked an issue May 11, 2026 that may be closed by this pull request
@Dargon789 Dargon789 self-assigned this May 11, 2026
@Dargon789 Dargon789 added documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers invalid This doesn't seem right question Further information is requested dependencies Pull requests that update a dependency file javascript Pull requests that update javascript code docker Pull requests that update docker code labels May 11, 2026
@Dargon789 Dargon789 changed the title Main updated demo redirect handling May 11, 2026
vercel Bot and others added 2 commits May 11, 2026 13:52
## Vercel Web Analytics Integration

Successfully configured Vercel Web Analytics for the mempool Angular application.

### Changes Made:

#### 1. Created New File:
- **frontend/src/app/services/analytics.service.ts** - New Angular service to initialize Vercel Analytics
  - Implements proper environment-aware configuration
  - Uses `inject()` function from `@vercel/analytics` package
  - Automatically switches between 'production' and 'development' modes based on environment configuration

#### 2. Modified Files:
- **frontend/src/app/app.module.ts** - Added AnalyticsService to the providers array
- **frontend/src/app/components/app/app.component.ts** - Injected AnalyticsService into the root component to ensure it initializes on app startup
- **frontend/package.json** - Added @vercel/analytics ^2.0.1 to dependencies (was already present, order normalized)
- **frontend/package-lock.json** - Updated lock file to reflect dependency tree

### Implementation Details:

The implementation follows best practices for Angular applications:

1. **Service-Based Architecture**: Created a dedicated `AnalyticsService` that encapsulates the Vercel Analytics initialization logic
2. **Environment-Aware Configuration**: The service automatically detects whether the app is running in production or development mode and configures analytics accordingly
3. **Singleton Pattern**: The service uses `providedIn: 'root'` to ensure a single instance across the application
4. **Early Initialization**: The service is injected into the root `AppComponent` to ensure analytics are initialized as early as possible in the application lifecycle

### Technical Approach:

Since Vercel Analytics doesn't have specific Angular instructions in their documentation, I used their vanilla JavaScript/TypeScript approach with the `inject()` function. This is the recommended pattern for frameworks without dedicated integrations.

The configuration passes a `mode` parameter to control whether analytics run in development or production mode:
- **Production mode**: Full analytics tracking enabled
- **Development mode**: Analytics can be tested without affecting production data

### Verification:

- ✅ TypeScript compilation passes without errors
- ✅ Linter runs successfully with no new errors introduced
- ✅ Package is properly installed (@vercel/analytics@2.0.1)
- ✅ Service is properly registered in Angular's dependency injection system

### Next Steps:

To enable Web Analytics on Vercel:
1. Navigate to your Vercel dashboard
2. Select the project
3. Go to the Analytics section
4. Click "Enable" to activate Web Analytics
5. Deploy the application to see analytics data

The analytics will automatically start tracking page views and web vitals once the application is deployed and the feature is enabled in the Vercel dashboard.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
@Dargon789
Dargon789 merged commit 12bee27 into master May 11, 2026
14 of 17 checks passed
@Dargon789
Dargon789 deleted the main branch May 11, 2026 07:10
@github-project-automation github-project-automation Bot moved this from Todo to Done in web3-Defi-Gamefi May 11, 2026
@Dargon789
Dargon789 restored the main branch May 11, 2026 07:10
Dargon789 added a commit that referenced this pull request May 11, 2026
* updated demo redirect handling (#164)

* Create cargo.yml (#31)

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

* Create web3_defi_gamefi.yml (#33)

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

* Create SECURITY.md (#34)

* Create SECURITY.md

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

* Update SECURITY.md

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

---------

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>

* Create static.yml (#36)

* Summary by Sourcery
Add a new GitHub Actions workflow to build and deploy static content to GitHub Pages.

CI:

Create .github/workflows/static.yml to trigger deployments on pushes to main and manual dispatch
Configure permissions for GITHUB_TOKEN and set concurrency to avoid canceling in-progress runs
Define a deploy job that checks out the repo, configures Pages, uploads the site artifact, and deploys to GitHub Pages

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

* Potential fix for code scanning alert no. 33: Client-side cross-site scripting (#39)

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential fix for code scanning alert no. 8: Workflow does not contain permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

* Update .circleci/web3_defi_gamefi.yml

Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>

* Potential fix for pull request finding 'CodeQL / Client-side cross-site scripting'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>

* Potential fix for pull request finding 'CodeQL / Replacement of a substring with itself'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>

* Install Vercel Web Analytics (#167)

## Vercel Web Analytics Integration

Successfully configured Vercel Web Analytics for the mempool Angular application.

### Changes Made:

#### 1. Created New File:
- **frontend/src/app/services/analytics.service.ts** - New Angular service to initialize Vercel Analytics
  - Implements proper environment-aware configuration
  - Uses `inject()` function from `@vercel/analytics` package
  - Automatically switches between 'production' and 'development' modes based on environment configuration

#### 2. Modified Files:
- **frontend/src/app/app.module.ts** - Added AnalyticsService to the providers array
- **frontend/src/app/components/app/app.component.ts** - Injected AnalyticsService into the root component to ensure it initializes on app startup
- **frontend/package.json** - Added @vercel/analytics ^2.0.1 to dependencies (was already present, order normalized)
- **frontend/package-lock.json** - Updated lock file to reflect dependency tree

### Implementation Details:

The implementation follows best practices for Angular applications:

1. **Service-Based Architecture**: Created a dedicated `AnalyticsService` that encapsulates the Vercel Analytics initialization logic
2. **Environment-Aware Configuration**: The service automatically detects whether the app is running in production or development mode and configures analytics accordingly
3. **Singleton Pattern**: The service uses `providedIn: 'root'` to ensure a single instance across the application
4. **Early Initialization**: The service is injected into the root `AppComponent` to ensure analytics are initialized as early as possible in the application lifecycle

### Technical Approach:

Since Vercel Analytics doesn't have specific Angular instructions in their documentation, I used their vanilla JavaScript/TypeScript approach with the `inject()` function. This is the recommended pattern for frameworks without dedicated integrations.

The configuration passes a `mode` parameter to control whether analytics run in development or production mode:
- **Production mode**: Full analytics tracking enabled
- **Development mode**: Analytics can be tested without affecting production data

### Verification:

- ✅ TypeScript compilation passes without errors
- ✅ Linter runs successfully with no new errors introduced
- ✅ Package is properly installed (@vercel/analytics@2.0.1)
- ✅ Service is properly registered in Angular's dependency injection system

### Next Steps:

To enable Web Analytics on Vercel:
1. Navigate to your Vercel dashboard
2. Select the project
3. Go to the Analytics section
4. Click "Enable" to activate Web Analytics
5. Deploy the application to see analytics data

The analytics will automatically start tracking page views and web vitals once the application is deployed and the feature is enabled in the Vercel dashboard.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>

---------

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: googleworkspace-bot <googleworkspace-bot@google.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>

* Update frontend/src/app/services/analytics.service.ts

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>

---------

Signed-off-by: AU_gdev_19 <64915515+Dargon789@users.noreply.github.com>
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Co-authored-by: googleworkspace-bot <googleworkspace-bot@google.com>
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file docker Pull requests that update docker code documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request good first issue Good for newcomers invalid This doesn't seem right javascript Pull requests that update javascript code question Further information is requested

Projects

Status: Done

2 participants