Skip to content

add auth to preview#37

Closed
kyle-lesinger wants to merge 11 commits intomainfrom
addContent
Closed

add auth to preview#37
kyle-lesinger wants to merge 11 commits intomainfrom
addContent

Conversation

@kyle-lesinger
Copy link
Contributor

  • Adding an AWS tab, updating the logo, creating a new Welcome page
  • Embedded VEDA page within a tab
  • Re-organized the GitHub tab
  • Added jupyter notebooks
  • update Training materials
  • Made a DataFlow Diagram Tab, Updated JupyterHub Tab
  • Created a dataflow diagram tab and updated the jupyterhub tab
  • Updated the Welcome Page and Presentations Tab
  • update presentations slidedecks
  • update presentations slidedecks
  • update Hub conversion
  • add disasters-conversion for testing
  • Remove disasters-aws-conversion submodule
  • Add disasters-aws-conversion as proper submodule
  • removes submodule added clone
  • update directory
  • update
  • update link for presentation
  • add AWS remote server login info
  • add training for STAC and Apache Airflow
  • update user notebooks
  • update user notebooks
  • update user notebooks
  • update with password auth
  • update with password auth
  • Add simple password protection with GitHub secrets
  • update data
  • update data usage
  • Add password protection and remove GHG Center content
  • Add password protection to PR preview deployments

- Updated quarto-publish.yml to inject password from GitHub secrets
- Added localhost bypass for development in auth-check.js
- Replaced GHG Center content with NASA Disasters case studies
- Cleaned up sidebar navigation in _quarto.yml
@github-actions
Copy link

github-actions bot commented Nov 18, 2025

PR Preview Action v1.6.2

🚀 View preview at
https://Disasters-Learning-Portal.github.io/disasters-docs/pr-preview/pr-37/

Built to branch gh-pages at 2025-11-18 22:53 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

kyle-lesinger and others added 4 commits November 18, 2025 16:32
The quarto-publish workflow was triggering on both 'main' and 'addContent'
branches. When a PR from addContent was opened, both workflows would run:
1. PR preview workflow would deploy to gh-pages/pr-preview/pr-XX/
2. Main deployment workflow would then overwrite the entire gh-pages branch

Now the workflow only triggers on 'main' branch pushes, allowing PR previews
to persist without being overwritten.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Updated auth-check.js to use dynamic path resolution instead of hardcoded
absolute paths. This ensures that:
- Main site redirects to /disasters-docs/password-protect.html
- PR previews redirect to /disasters-docs/pr-preview/pr-XX/password-protect.html

The getBasePath() function extracts the current directory path and constructs
the correct login page URL relative to the current location.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
ISSUE: The auth-check.js external script was not being included in
deployed HTML pages on PR previews, causing authentication to fail.

SOLUTION:
1. Inlined the entire auth-check.js content directly in _quarto.yml
   under include-in-header. This ensures the script is always embedded
   in every rendered HTML page.

2. Added verification step to both workflows (preview.yml and
   quarto-publish.yml) that checks for the presence of the auth script
   in rendered HTML before deployment. Build fails if script is missing.

This guarantees password protection works on all deployments:
- Main site (disasters-docs/)
- PR previews (disasters-docs/pr-preview/pr-XX/)
- Any future branch deployments

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
ISSUE: When visiting URLs like /disasters-docs/pr-preview/pr-37/ (without
index.html), the getBasePath() function couldn't find .html in the path,
so it fell back to the default /disasters-docs/, causing incorrect
redirects to the wrong password-protect.html location.

SOLUTION: Simplified getBasePath() to handle three cases:
1. Path ends with / → it's already the base directory
2. Path ends with .html → extract directory by removing filename
3. Otherwise → assume it's a directory, add trailing slash

This ensures correct redirects for all URL formats:
- /disasters-docs/pr-preview/pr-37/ → /disasters-docs/pr-preview/pr-37/password-protect.html
- /disasters-docs/pr-preview/pr-37/index.html → /disasters-docs/pr-preview/pr-37/password-protect.html
- /disasters-docs/ → /disasters-docs/password-protect.html

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <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