Skip to content

Refactor project paths and handling, preserve query params, scope download/XML routes, and adapt template for canonical URLs#462

Open
cycomachead wants to merge 17 commits into
mainfrom
cycomachead/ai/25/1
Open

Refactor project paths and handling, preserve query params, scope download/XML routes, and adapt template for canonical URLs#462
cycomachead wants to merge 17 commits into
mainfrom
cycomachead/ai/25/1

Conversation

@cycomachead
Copy link
Copy Markdown
Member

Refactor project routes to use canonical URL paths and scope API endpoints

This PR cleans up project URL handling by introducing a proper RESTful path for project pages, adding 301 redirects from legacy URLs, and emitting canonical link tags to ensure search engines always index the primary domain.

Changes

  • New project route: /project?username=...&projectname=.../users/:username/projects/:projectname as the canonical project show route
  • Legacy redirect: GET /project with query params (including old user/project aliases) now issues a 301 redirect to the new path, preserving all parameters
  • Canonical URL tag: The project page sets self.canonical_url using config.hostname (the primary domain), and views/layout/head.etlua emits a <link rel="canonical"> tag when present — ensuring secondary-domain requests still point canonically at the primary domain
  • Model URLs updated: url_for('site') now returns the new /users/{username}/projects/{projectname} path; url_for('download') now returns /api/v1/project/{id}
  • Client-side path generation: Cloud.prototype.showProjectPath updated to produce the new URL structure using encodeURIComponent
  • api.lua unchanged: The project/:id route remains accessible via api_route (both /api/v1/project/:id and /project/:id) — no breaking change to the API

Reviewer Notes

  • The api.lua route was intentionally not changed to hard-scope under /api/v1/ — that change was reverted per feedback. The model's download URL now emits the namespaced form, but the legacy short path remains supported server-side.
  • The legacy /project GET handler normalizes the old user/project param aliases and lowercases usernames to match the global before_filter behavior.

Superconductor Ticket Implementation | App Preview | Guided Review

cycomachead and others added 17 commits May 11, 2026 09:49
* 'main' of github.com:snap-cloud/snapCloud:
  Dump sql after migrate
  refactor: remove password v0 support and retire password_version column
Bumps [qs](https://github.com/ljharb/qs) and [express](https://github.com/expressjs/express). These dependencies needed to be updated together.

Updates `qs` from 6.14.1 to 6.15.2
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](ljharb/qs@v6.14.1...v6.15.2)

Updates `express` from 4.22.1 to 4.22.2
- [Release notes](https://github.com/expressjs/express/releases)
- [Changelog](https://github.com/expressjs/express/blob/v4.22.2/History.md)
- [Commits](expressjs/express@v4.22.1...v4.22.2)

---
updated-dependencies:
- dependency-name: qs
  dependency-version: 6.15.2
  dependency-type: indirect
- dependency-name: express
  dependency-version: 4.22.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
- Update robots.txt to disallow /project/ and /api/ for compliant crawlers.
- Add a user-agent blocklist to return 403 for aggressive SEO bots.
- Implement rate limiting (60r/s) specifically for the /project/:id XML
  endpoint to reduce egress costs from automated scraping.
- Serve robots.txt as a static file directly from the repository.

Co-authored-by: Claude Code <noreply@anthropic.com>
…ad/ai/26/1

* 'main' of github.com:snap-cloud/snapCloud:
  docs: move installation and deployment guides to docs directory
  rerun migrations
  feat: enhance compression logging and prevent stale CSS assets
  feat: implement pre-compression and global gzip configuration
Update internal UI and model call sites to use the explicit /api/v1/project/:id
path instead of the bare /project/:id route. This ensures legitimate
application traffic bypasses bot-mitigation rate limits targeting legacy
crawler entry points.

Co-authored-by: Claude Code <noreply@anthropic.com>
- Change project show route to /users/:username/projects/:projectname.
- Add 301 redirects for legacy /project query parameter URLs.
- Update project models to use /api/v1/ for download and XML routes.
- Add support for canonical link tags using the primary domain.
- Update client-side path generation to match new URL structure.

Co-authored-by: Claude Code <noreply@anthropic.com>
* 'main' of github.com:snap-cloud/snapCloud:
  docs: move installation and deployment guides to docs directory
  rerun migrations
  feat: enhance compression logging and prevent stale CSS assets
  feat: implement pre-compression and global gzip configuration
Use robots.txt and mitigate AI bots
- Change project show route to /users/:username/projects/:projectname.
- Add 301 redirects for legacy /project query parameter URLs.
- Update project models to use /api/v1/ for download and XML routes.
- Add support for canonical link tags using the primary domain.
- Update client-side path generation to match new URL structure.

Co-authored-by: Claude Code <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant