Compare commits
88 Commits
v2.1.0
...
feature/bu
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8739c9aa3e | ||
|
|
ad79ccd83b | ||
| f8c2788d86 | |||
|
|
a537d17a2f | ||
|
|
d5954410a7 | ||
|
|
36e66fd264 | ||
|
|
7b3fbafa50 | ||
|
|
ea54d926ab | ||
|
|
4776029cb4 | ||
|
|
5e04d46e36 | ||
|
|
518a3286fa | ||
|
|
2d18553f98 | ||
|
|
68e3fe45fa | ||
|
|
38bb29b20b | ||
|
|
8ccf7fb37e | ||
|
|
b406d4dd24 | ||
|
|
d12c8bd7b7 | ||
|
|
ea5d1e2b16 | ||
|
|
c2b43dc949 | ||
| 8d2fdfa63c | |||
| c1ffd89dbe | |||
|
|
dd8187d6da | ||
| 5028d07f0b | |||
| 4f5d8c6d20 | |||
|
|
6a67a32e4f | ||
|
|
549c52a39f | ||
|
|
36007b9d1a | ||
| cee5f0284f | |||
|
|
e8a8b8e1ae | ||
|
|
c21cbd77f0 | ||
| 99a035e29d | |||
|
|
64baa6d290 | ||
|
|
46fe591fa7 | ||
|
|
8f7e1bc0af | ||
|
|
9fc1098ef7 | ||
|
|
ae094416fc | ||
|
|
2e7dac1e3e | ||
|
|
7bea23a655 | ||
|
|
3d28869e92 | ||
|
|
f0f1f0b365 | ||
| be861b823c | |||
|
|
95de8df372 | ||
| 5994ded8be | |||
|
|
7b401add15 | ||
|
|
2d92dd47f0 | ||
|
|
eb8141ee8c | ||
|
|
2a50f5580d | ||
|
|
65bfb1d129 | ||
|
|
234f3d627d | ||
|
|
be1dccfcb9 | ||
|
|
454e5e807a | ||
|
|
29d20d5c5a | ||
|
|
e29546c727 | ||
|
|
5a89be6238 | ||
|
|
cfb5faa09b | ||
| 37471efb74 | |||
|
|
7a4f40a765 | ||
|
|
d11d55db66 | ||
|
|
76b6aa7c15 | ||
|
|
70d4fecad6 | ||
|
|
c3fa91752c | ||
|
|
7c2beef193 | ||
|
|
630d0d80d2 | ||
|
|
695743104c | ||
|
|
d014244b28 | ||
|
|
5cd56259f7 | ||
|
|
fa9f78b46e | ||
|
|
4a5f67f0fd | ||
|
|
3bed9cc27f | ||
|
|
0dcae25b93 | ||
|
|
ca734dcd39 | ||
|
|
9448072112 | ||
|
|
b1e98ca9d7 | ||
|
|
f036d409e6 | ||
|
|
5493c63f18 | ||
|
|
6c3139bf0f | ||
|
|
28ebb69612 | ||
|
|
008cb40cb8 | ||
|
|
195d3a219a | ||
|
|
c6452c4f2b | ||
|
|
3dbacf0d65 | ||
|
|
56a82baf40 | ||
|
|
20d210245b | ||
|
|
21cbcf677a | ||
|
|
8fb355d03b | ||
|
|
218477404f | ||
|
|
766c0bc1b4 | ||
|
|
4a8d0666c2 |
@@ -7,3 +7,6 @@ insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
|
||||
[*.{nix,yaml,yml}]
|
||||
indent_size = 2
|
||||
|
||||
3
.env.example
Normal file
3
.env.example
Normal file
@@ -0,0 +1,3 @@
|
||||
SENTRY_ORG=longhorn-developers
|
||||
SENTRY_PROJECT=ut-registration-plus
|
||||
SENTRY_AUTH_TOKEN=
|
||||
@@ -94,3 +94,5 @@ typings/
|
||||
config
|
||||
.eslintrc.js
|
||||
!.storybook
|
||||
|
||||
src/lib/chrome-extension-toolkit
|
||||
|
||||
@@ -205,7 +205,7 @@ module.exports = {
|
||||
{
|
||||
target: './src/shared',
|
||||
from: './',
|
||||
except: ['./src/shared', './node_modules'],
|
||||
except: ['./src/shared', './node_modules', './src/lib/chrome-extension-toolkit'],
|
||||
message: 'You cannot import into `shared` from an external directory.',
|
||||
},
|
||||
],
|
||||
@@ -227,6 +227,6 @@ module.exports = {
|
||||
'simple-import-sort/imports': 'error',
|
||||
'simple-import-sort/exports': 'error',
|
||||
'import-essentials/restrict-import-depth': 'error',
|
||||
'import-essentials/check-path-alias': 'error',
|
||||
// 'import-essentials/check-path-alias': 'error',
|
||||
},
|
||||
};
|
||||
|
||||
22
.github/ISSUE_TEMPLATE/bug_report.md
vendored
22
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -2,7 +2,7 @@
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: '[BUG] '
|
||||
labels: 'bug'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
@@ -10,11 +10,11 @@ assignees: ''
|
||||
|
||||
<!-- Please check all applicable boxes before submitting your issue -->
|
||||
|
||||
- [ ] I have searched existing issues to make sure this is not a duplicate
|
||||
- [ ] I have cleared my browser cache and confirmed the issue persists
|
||||
- [ ] I have checked this issue affects the latest version of the extension
|
||||
- [ ] I have disabled other extensions to ensure this isn't a conflict issue
|
||||
- [ ] I have included all the information requested below
|
||||
- [ ] I have searched existing issues to make sure this is not a duplicate
|
||||
- [ ] I have cleared my browser cache and confirmed the issue persists
|
||||
- [ ] I have checked this issue affects the latest version of the extension
|
||||
- [ ] I have disabled other extensions to ensure this isn't a conflict issue
|
||||
- [ ] I have included all the information requested below
|
||||
|
||||
**Bug Description**
|
||||
|
||||
@@ -29,11 +29,11 @@ assignees: ''
|
||||
|
||||
**Expected Behavior**
|
||||
|
||||
<!-- A clear and concise description of what you expected to happen -->
|
||||
<!-- What you expected to happen -->
|
||||
|
||||
**Current Behavior**
|
||||
|
||||
<!-- A clear and concise description of what actually happened -->
|
||||
<!-- What actually happened -->
|
||||
|
||||
**Screenshots**
|
||||
|
||||
@@ -41,9 +41,9 @@ assignees: ''
|
||||
|
||||
**Debug Information**
|
||||
|
||||
- UTRP Extension Version: [e.g. 1.2.0]
|
||||
- Browser Info: [e.g. Chrome 120.0.0]
|
||||
- OS: [e.g. Windows 11, macOS Sonoma]
|
||||
- UTRP Extension Version: [e.g. 1.2.0]
|
||||
- Browser Info: [e.g. Chrome 120.0.0]
|
||||
- OS: [e.g. Windows 11, macOS Sonoma]
|
||||
|
||||
**Console Logs**
|
||||
|
||||
|
||||
26
.github/ISSUE_TEMPLATE/feature_request.md
vendored
26
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -2,7 +2,7 @@
|
||||
name: Feature Request
|
||||
about: Suggest an idea for this project
|
||||
title: '[FEATURE] '
|
||||
labels: 'feature'
|
||||
labels: feature
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
@@ -10,24 +10,20 @@ assignees: ''
|
||||
|
||||
<!-- Please check all applicable boxes before submitting your feature request -->
|
||||
|
||||
- [ ] I have searched existing issues to ensure this feature hasn't been requested
|
||||
- [ ] I have searched closed issues to check if this was previously rejected/implemented
|
||||
- [ ] I have checked the project roadmap (if available) for planned similar features
|
||||
- [ ] I have reviewed the documentation to confirm this feature doesn't exist
|
||||
- [ ] I have completed all sections below with detailed information
|
||||
- [ ] I have searched existing issues to ensure this feature hasn't been requested
|
||||
- [ ] I have searched closed issues to check if this was previously rejected/implemented
|
||||
- [ ] I have checked the project roadmap (if available) for planned similar features
|
||||
- [ ] I have reviewed the documentation to confirm this feature doesn't exist
|
||||
- [ ] I have completed all sections below with detailed information
|
||||
|
||||
**Feature Description**
|
||||
**Your Idea**
|
||||
|
||||
<!-- A clear and concise description of the feature you'd like to see -->
|
||||
|
||||
**Proposed Solution**
|
||||
|
||||
<!-- A clear and concise description of what you want to happen -->
|
||||
<!-- A clear and concise description of the feature you'd like to see, and how it would work -->
|
||||
|
||||
**UI/UX Considerations**
|
||||
|
||||
<!-- If this feature involves UI changes, please describe the visual aspects -->
|
||||
<!-- If this feature involves UI changes (aka how it looks), please describe the visual aspects -->
|
||||
|
||||
**Technical Implementation Details**
|
||||
**Other**
|
||||
|
||||
<!-- If you have specific technical suggestions, list them here -->
|
||||
<!-- Any other comments you have can go here! -->
|
||||
|
||||
11
.github/ISSUE_TEMPLATE/updating-build-dependencies.md
vendored
Normal file
11
.github/ISSUE_TEMPLATE/updating-build-dependencies.md
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
name: Updating Build Dependencies
|
||||
about: Updating Build Dependencies
|
||||
title: ''
|
||||
labels: build, dependencies
|
||||
assignees: doprz, Razboy20
|
||||
---
|
||||
|
||||
- [ ] Updated Nix Flake
|
||||
- [ ] Update Dockerfile
|
||||
- [ ] Update Docs
|
||||
20
.github/dependabot.yml
vendored
Normal file
20
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: 'npm'
|
||||
directory: '/'
|
||||
schedule:
|
||||
interval: 'weekly'
|
||||
day: 'monday'
|
||||
time: '09:00'
|
||||
timezone: 'America/Chicago'
|
||||
groups:
|
||||
minor-and-patch-updates:
|
||||
update-types:
|
||||
- 'minor'
|
||||
- 'patch'
|
||||
major-updates:
|
||||
update-types:
|
||||
- 'major'
|
||||
ignore:
|
||||
- dependency-name: '@crxjs/vite-plugin'
|
||||
- dependency-name: '@unocss/vite'
|
||||
70
.github/workflows/best-practices.yml
vendored
70
.github/workflows/best-practices.yml
vendored
@@ -1,43 +1,33 @@
|
||||
name: Best Practices
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Run ESLint
|
||||
run: pnpm run lint
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Run Prettier
|
||||
run: pnpm run prettier
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Run ESLint
|
||||
run: pnpm run lint
|
||||
format:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Run Prettier
|
||||
run: pnpm run prettier
|
||||
|
||||
36
.github/workflows/check-types.yml
vendored
36
.github/workflows/check-types.yml
vendored
@@ -1,24 +1,18 @@
|
||||
name: Type Check
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
type-check:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm run check-types
|
||||
type-check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Run tests
|
||||
run: pnpm run check-types
|
||||
|
||||
42
.github/workflows/chromatic.yml
vendored
42
.github/workflows/chromatic.yml
vendored
@@ -1,26 +1,22 @@
|
||||
name: 'Chromatic'
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
chromatic:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Publish to Chromatic
|
||||
uses: chromaui/action@latest
|
||||
with:
|
||||
projectToken: chpt_e8bd07b0b27d8eb
|
||||
exitZeroOnChanges: true
|
||||
autoAcceptChanges: 'main'
|
||||
chromatic:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Publish to Chromatic
|
||||
uses: chromaui/action@latest
|
||||
with:
|
||||
projectToken: chpt_e8bd07b0b27d8eb
|
||||
exitZeroOnChanges: true
|
||||
autoAcceptChanges: 'main'
|
||||
|
||||
43
.github/workflows/release.yml
vendored
43
.github/workflows/release.yml
vendored
@@ -1,25 +1,24 @@
|
||||
name: Create Release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- production
|
||||
- preview
|
||||
push:
|
||||
branches:
|
||||
- production
|
||||
- preview
|
||||
jobs:
|
||||
build:
|
||||
name: build extension & create release
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Get file permission
|
||||
run: chmod -R 777 .
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Release with semantic-release
|
||||
id: semantic-release
|
||||
run: npx --no-install semantic-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
build:
|
||||
name: build extension & create release
|
||||
runs-on: ubuntu-latest
|
||||
concurrency:
|
||||
group: ${{ github.ref }}
|
||||
cancel-in-progress: true
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Get file permission
|
||||
run: chmod -R 777 .
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
- name: Release with semantic-release
|
||||
id: semantic-release
|
||||
run: npx --no-install semantic-release
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
36
.github/workflows/tests.yml
vendored
36
.github/workflows/tests.yml
vendored
@@ -1,24 +1,18 @@
|
||||
name: Tests
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v3
|
||||
with:
|
||||
version: 9
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
|
||||
- name: Run tests
|
||||
run: pnpm test
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Setup pnpm
|
||||
uses: pnpm/action-setup@v4
|
||||
with:
|
||||
version: 10
|
||||
- name: Install dependencies
|
||||
run: pnpm install
|
||||
- name: Run tests
|
||||
run: pnpm test
|
||||
|
||||
73
.github/workflows/validate-pr.yml
vendored
73
.github/workflows/validate-pr.yml
vendored
@@ -1,43 +1,40 @@
|
||||
name: Validate PR Title
|
||||
|
||||
# thank you ben limmer for this workflow:
|
||||
# https://github.com/blimmer/semantic-release-demo-2/blob/main/.github/workflows/lint-pr.yml
|
||||
|
||||
on:
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- edited
|
||||
- synchronize
|
||||
|
||||
pull_request_target:
|
||||
types:
|
||||
- opened
|
||||
- reopened
|
||||
- edited
|
||||
- synchronize
|
||||
jobs:
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: amannn/action-semantic-pull-request@v3.2.6
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Post Conventional Commit Comment (on failure)
|
||||
uses: jungwinter/comment@v1
|
||||
id: conventional-commit-help
|
||||
with:
|
||||
type: create
|
||||
issue_number: ${{ github.event.pull_request.number }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: |
|
||||
Your pull request title did not conform to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standards. Our upcoming automated release pipeline will automatically determine
|
||||
the proper release version based on your pull request title.
|
||||
**Cheat Sheet**
|
||||
- feat: A new feature
|
||||
- fix: A bug fix
|
||||
- docs: Documentation only changes
|
||||
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
- refactor: A code change that neither fixes a bug nor adds a feature
|
||||
- perf: A code change that improves performance
|
||||
- test: Adding missing tests or correcting existing tests
|
||||
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
- ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
- chore: Other changes that don't modify src or test files
|
||||
- revert: Reverts a previous commit
|
||||
if: ${{ failure() }}
|
||||
main:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: amannn/action-semantic-pull-request@v3.2.6
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Post Conventional Commit Comment (on failure)
|
||||
uses: jungwinter/comment@v1
|
||||
id: conventional-commit-help
|
||||
with:
|
||||
type: create
|
||||
issue_number: ${{ github.event.pull_request.number }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: |
|
||||
Your pull request title did not conform to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) standards. Our upcoming automated release pipeline will automatically determine
|
||||
the proper release version based on your pull request title.
|
||||
**Cheat Sheet**
|
||||
- feat: A new feature
|
||||
- fix: A bug fix
|
||||
- docs: Documentation only changes
|
||||
- style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
||||
- refactor: A code change that neither fixes a bug nor adds a feature
|
||||
- perf: A code change that improves performance
|
||||
- test: Adding missing tests or correcting existing tests
|
||||
- build: Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm)
|
||||
- ci: Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs)
|
||||
- chore: Other changes that don't modify src or test files
|
||||
- revert: Reverts a previous commit
|
||||
if: ${{ failure() }}
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -211,3 +211,10 @@ sketch
|
||||
package-lock.json
|
||||
storybook-static/
|
||||
package/
|
||||
|
||||
# Nix
|
||||
result
|
||||
result-*
|
||||
|
||||
# direnv
|
||||
.direnv
|
||||
|
||||
@@ -23,6 +23,7 @@ export default defineConfig({
|
||||
'@shared': resolve(root, 'shared'),
|
||||
'@background': resolve(pagesDir, 'background'),
|
||||
'@views': resolve(root, 'views'),
|
||||
'@chrome-extension-toolkit': resolve(root, 'lib/chrome-extension-toolkit'),
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
10
.vscode/launch.json
vendored
10
.vscode/launch.json
vendored
@@ -6,13 +6,9 @@
|
||||
"request": "launch",
|
||||
"name": "Run current script",
|
||||
"runtimeExecutable": "npx",
|
||||
"runtimeArgs": [
|
||||
"tsx"
|
||||
],
|
||||
"runtimeArgs": ["tsx"],
|
||||
"program": "${file}",
|
||||
"skipFiles": [
|
||||
"<node_internals>/**"
|
||||
],
|
||||
"skipFiles": ["<node_internals>/**"]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@@ -26,7 +26,7 @@
|
||||
"navigation": "Routes",
|
||||
"logging": "log",
|
||||
"popup": "Layout",
|
||||
"storage": "Database",
|
||||
"storage": "Database"
|
||||
},
|
||||
"material-icon-theme.files.associations": {
|
||||
"tsconfig.extension.json": "tsconfig",
|
||||
@@ -36,5 +36,5 @@
|
||||
"[html]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"typescript.tsdk": "node_modules/typescript/lib",
|
||||
"typescript.tsdk": "node_modules/typescript/lib"
|
||||
}
|
||||
|
||||
79
CHANGELOG.md
79
CHANGELOG.md
@@ -1,3 +1,82 @@
|
||||
## [2.3.0](https://github.com/Longhorn-Developers/UT-Registration-Plus/compare/v2.2.2...v2.3.0) (2026-01-07)
|
||||
|
||||
### Features
|
||||
|
||||
- add drag-and-drop import for schedules ([#661](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/661)) ([549c52a](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/549c52a39fee718f2bb07cfce33a294835a2246b)), closes [#446](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/446)
|
||||
- allow bypassing the 10-schedule limit ([#675](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/675)) ([6a67a32](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/6a67a32e4f50a5bdd20aa43789f199b822483e2d))
|
||||
- condense resourceLinks course schedule ([#676](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/676)) ([cee5f02](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/cee5f0284f09f39ca5ae64559d0b697646c77e74))
|
||||
- LHD birthday ([#717](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/717)) ([2d18553](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/2d18553f98c5146fa18699ae20462e7dcbc9d35c))
|
||||
- **nix:** add prettier-version-match check ([#713](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/713)) ([8ccf7fb](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/8ccf7fb37e769ba445f39c140ca9c1c4245cc1c1))
|
||||
- **nix:** build UTRP ([#714](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/714)) ([38bb29b](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/38bb29b20b97ed3cf8fd6511df16553fed1d58bb))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- .editorconfig syntax for nix files ([b406d4d](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/b406d4dd244a25688c2b9621cf5d441228bd8913))
|
||||
- toSorted outdated chrome bug ([#694](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/694)) ([4f5d8c6](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/4f5d8c6d20e3cfeb7b62520ba1819e297d2cc60f))
|
||||
|
||||
## [2.2.2](https://github.com/Longhorn-Developers/UT-Registration-Plus/compare/v2.2.1...v2.2.2) (2025-10-13)
|
||||
|
||||
### Features
|
||||
|
||||
- add nix flake ([#593](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/593)) ([7b401ad](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/7b401add1565ff401bad99745ff9e53b9a7f899f))
|
||||
- automatically select new or duplicated schedules ([#583](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/583)) ([#589](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/589)) ([2a50f55](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/2a50f5580d3dbeb0d66546c23cf29bbb37d80da2))
|
||||
- **env:** add SENTRY env vars ([8f7e1bc](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/8f7e1bc0af6336549068e02b80df21d4e8f4ef9c))
|
||||
- export schedule button add to calendar ([#594](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/594)) ([5994ded](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/5994ded8be876cb55174d27d3fdb0832b21a0ff9))
|
||||
- **release:** v2.2.2 ([c21cbd7](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/c21cbd77f0764c03a711589ff4f957cb8c936eec))
|
||||
- search result shading ([#617](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/617)) ([be861b8](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/be861b823cb2cb7f6f4a1f266351eec3fc1c2f99))
|
||||
- show warning for courses of different semesters ([#570](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/570)) ([2e7dac1](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/2e7dac1e3eba757231ac07ac966231c08c703a16))
|
||||
- support summer grades, fix summer course parser ([#596](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/596)) ([2d92dd4](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/2d92dd47f00a44b7d48e92a8ffba94480e4e73f9))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- fix or ignore various eslint warning ([#609](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/609)) ([95de8df](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/95de8df37243b6d59625df515a60442f11b7a9d3))
|
||||
- limit height of schedule list dropdown in the extension popup ([#543](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/543)) ([eb8141e](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/eb8141ee8c3d32bce901457178d50781b78f86dd))
|
||||
- whitespace wrapping in semester warning ([#629](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/629)) ([46fe591](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/46fe591fa72ef017eea7cfb8aa37d12d8f223926))
|
||||
|
||||
## [2.2.1](https://github.com/Longhorn-Developers/UT-Registration-Plus/compare/v2.2.0...v2.2.1) (2025-06-04)
|
||||
|
||||
### Features
|
||||
|
||||
- add dining app promo ([#598](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/598)) ([be1dccf](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/be1dccfcb9d052c6b291b50cc53418d6bb645beb))
|
||||
- inside jokes005 ([#590](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/590)) ([37471ef](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/37471efb740c7a5828cf3b54bac70954694359d7))
|
||||
- **release:** v2.2.1 ([234f3d6](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/234f3d627d603adf8555b4d0e93106d198918169))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- course columns on calendar ([#587](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/587)) ([cfb5faa](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/cfb5faa09bb0788e270d100f1f36536a53bcff75))
|
||||
- hide sentry instrumentation on debug builds ([#604](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/604)) ([454e5e8](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/454e5e807af29ae0384cc3a3b8b691df5edc69d1))
|
||||
|
||||
## [2.2.0](https://github.com/Longhorn-Developers/UT-Registration-Plus/compare/v2.1.1...v2.2.0) (2025-04-06)
|
||||
|
||||
### Features
|
||||
|
||||
- auto create empty schedule when deleted all schedules ([#552](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/552)) ([7c2beef](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/7c2beef1930fbc887e8ec1aea789016b3150cd21))
|
||||
- ensure unique splash text on schedule change ([#554](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/554)) ([9448072](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/94480721124e052426c1f3236e8605c7088df79c))
|
||||
- implement a What's New prompt ([#539](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/539)) ([f036d40](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/f036d409e60a39fd1d3cb2f0db53a6056615f336))
|
||||
- persist sidebar toggle state ([#569](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/569)) ([6957431](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/695743104c57951ba1957258c60c843f8fae793f))
|
||||
- recruitment banner for designer ([#578](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/578)) ([70d4fec](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/70d4fecad61ec3cd3ba839de302fd851e075d073))
|
||||
- **release:** v2.2.0 ([7a4f40a](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/7a4f40a765d704bf32a3b515d695916ed84f9397))
|
||||
- rework start time to checkboxes ([#553](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/553)) ([ca734dc](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/ca734dcd39a433cfd2e930ea04adeba959b32c36))
|
||||
- sticky calendar header and days ([#568](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/568)) ([fa9f78b](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/fa9f78b46e3a2270a44d4cc0691195a7c695cb93))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- ics calendar export dates ([#535](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/535)) ([4a5f67f](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/4a5f67f0fda9f0ef57f821e4b7a55d63f099f579))
|
||||
- include logo in screenshot, fix screenshots on small/zoomed windows ([#579](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/579)) ([76b6aa7](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/76b6aa7c150299dfcfa4b3dc00ce2de32f90f75c))
|
||||
- merge course labels across pages ([#541](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/541)) ([6c3139b](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/6c3139bf0f324c9a7be826b6c24e8bf142fc53b1))
|
||||
- **schedule:** truncate long schedule names in popup ([#564](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/564)) ([3bed9cc](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/3bed9cc27febfe795af0766a913c4845e74cc2da))
|
||||
|
||||
## [2.1.1](https://github.com/Longhorn-Developers/UT-Registration-Plus/compare/v2.1.0...v2.1.1) (2025-03-03)
|
||||
|
||||
### Features
|
||||
|
||||
- add isDeveloper ([c6452c4](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/c6452c4f2b174487e6f51ad546ca1c3f8b4dbc1f))
|
||||
- map page ([#390](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/390)) ([2184774](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/218477404fdeacda7b39cd233e4e1e65995935d4))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- import schedule file upload button ([#515](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues/515)) ([766c0bc](https://github.com/Longhorn-Developers/UT-Registration-Plus/commit/766c0bc1b4a75f8146a922cb2eca8871032c1dc9))
|
||||
|
||||
## [2.1.0](https://github.com/Longhorn-Developers/UT-Registration-Plus/compare/v2.0.2...v2.1.0) (2025-02-20)
|
||||
|
||||
### Features
|
||||
|
||||
32
CODE_OF_CONDUCT.md
Normal file
32
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# UT Registration Plus Code of Conduct
|
||||
|
||||
Like the technical community as a whole, the UT Registration Plus team and community is made up of a mixture of professionals and volunteers from all over the world, working on every aspect of the mission - including mentorship, teaching, and connecting people.
|
||||
|
||||
Diversity is one of our huge strengths, but it can also lead to communication issues and unhappiness. To that end, we have a few ground rules that we ask people to adhere to. This code applies equally to founders, mentors and those seeking help and guidance.
|
||||
|
||||
This isn’t an exhaustive list of things that you can’t do. Rather, take it in the spirit in which it’s intended - a guide to make it easier to enrich all of us and the technical communities in which we participate.
|
||||
|
||||
This code of conduct applies to all spaces managed by the UT Registration Plus project or Longhorn Developers. This includes IRC, the mailing lists, the issue tracker, DSF events, and any other forums created by the project team which the community uses for communication. In addition, violations of this code outside these spaces may affect a person's ability to participate within them.
|
||||
|
||||
If you believe someone is violating the code of conduct, we ask that you report it by emailing [contact@longhorns.dev](mailto:contact@longhorns.dev). For more details please see our
|
||||
|
||||
- **Be friendly and patient.**
|
||||
- **Be welcoming.** We strive to be a community that welcomes and supports people of all backgrounds and identities. This includes, but is not limited to members of any race, ethnicity, culture, national origin, colour, immigration status, social and economic class, educational level, sex, sexual orientation, gender identity and expression, age, size, family status, political belief, religion, and mental and physical ability.
|
||||
- **Be considerate.** Your work will be used by other people, and you in turn will depend on the work of others. Any decision you take will affect users and colleagues, and you should take those consequences into account when making decisions. Remember that we're a world-wide community, so you might not be communicating in someone else's primary language.
|
||||
- **Be respectful.** Not all of us will agree all the time, but disagreement is no excuse for poor behavior and poor manners. We might all experience some frustration now and then, but we cannot allow that frustration to turn into a personal attack. It’s important to remember that a community where people feel uncomfortable or threatened is not a productive one. Members of the UT Registration Plus community should be respectful when dealing with other members as well as with people outside the UT Registration Plus community.
|
||||
- **Be careful in the words that you choose.** We are a community of professionals, and we conduct ourselves professionally. Be kind to others. Do not insult or put down other participants. Harassment and other exclusionary behavior aren't acceptable. This includes, but is not limited to:
|
||||
- Violent threats or language directed against another person.
|
||||
- Discriminatory jokes and language.
|
||||
- Posting sexually explicit or violent material.
|
||||
- Posting (or threatening to post) other people's personally identifying information ("doxing").
|
||||
- Personal insults, especially those using racist or sexist terms.
|
||||
- Unwelcome sexual attention.
|
||||
- Advocating for, or encouraging, any of the above behavior.
|
||||
- Repeated harassment of others. In general, if someone asks you to stop, then stop.
|
||||
- **When we disagree, try to understand why.** Disagreements, both social and technical, happen all the time and UT Registration Plus is no exception. It is important that we resolve disagreements and differing views constructively. Remember that we’re different. The strength of UT Registration Plus comes from its varied community, people from a wide range of backgrounds. Different people have different perspectives on issues. Being unable to understand why someone holds a viewpoint doesn’t mean that they’re wrong. Don’t forget that it is human to err and blaming each other doesn’t get us anywhere. Instead, focus on helping to resolve issues and learning from mistakes.
|
||||
|
||||
Original text courtesy of the [Speak Up! project](http://web.archive.org/web/20141109123859/http://speakup.io/coc.html).
|
||||
|
||||
## Questions?
|
||||
|
||||
If you have questions, please see . If that doesn't answer your questions, feel free to [contact us](mailto:contact@longhorns.dev).
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker installed on your machine
|
||||
- Git (to clone the repository)
|
||||
- Docker installed on your machine
|
||||
- Git (to clone the repository)
|
||||
|
||||
## Getting Started
|
||||
|
||||
@@ -70,9 +70,9 @@ docker run -it --rm -v $(pwd)/dist:/extension/dist -p 5173:5173 -e BUILD_MODE=de
|
||||
|
||||
## Accessing the Built Extension
|
||||
|
||||
- For build mode, the extension files will be in the `dist` directory on your host machine.
|
||||
- For zip mode, the zipped extension will be in the `package` directory on your host machine.
|
||||
- For dev mode, the extension will be continuously built in the `dist` directory, and you can load it as an unpacked extension in Chrome.
|
||||
- For build mode, the extension files will be in the `dist` directory on your host machine.
|
||||
- For zip mode, the zipped extension will be in the `package` directory on your host machine.
|
||||
- For dev mode, the extension will be continuously built in the `dist` directory, and you can load it as an unpacked extension in Chrome.
|
||||
|
||||
## Docker Development Workflow
|
||||
|
||||
@@ -85,5 +85,5 @@ When working on the extension:
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
- If you encounter permission issues with the output directories, ensure that the directories exist on your host machine and have the correct permissions.
|
||||
- For any other issues, please check the Docker logs or open an issue in the GitHub repository.
|
||||
- If you encounter permission issues with the output directories, ensure that the directories exist on your host machine and have the correct permissions.
|
||||
- For any other issues, please check the Docker logs or open an issue in the GitHub repository.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
FROM node:20.9.0-alpine AS base
|
||||
|
||||
# Install pnpm
|
||||
RUN npm install -g pnpm
|
||||
RUN npm install -g pnpm@latest-10
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
SOFTWARE.
|
||||
|
||||
118
README.md
118
README.md
@@ -6,7 +6,7 @@
|
||||

|
||||

|
||||
|
||||
**UT Registration Plus (UTRP)** streamlines the process of registering for classes at UT Austin by reducing the chaos of juggling multiple tabs like Rate My Professor, Google Sheets, and the UT Course Schedule. With UTRP, you can simplify class selection and schedule management. We've all been there. 20 tabs of Rate My Professor, Google Spreadsheet, and the UT Course Schedule open and you still don't know what classes to take.
|
||||
**UT Registration Plus (UTRP)** streamlines the process of registering for classes at UT Austin by reducing the chaos of juggling multiple tabs like Rate My Professor, Google Sheets, and the UT Course Schedule. With UTRP, you can simplify class selection and schedule management. We've all been there. 20 tabs of Rate My Professor, Google Spreadsheet, and the UT Course Schedule open and you still don't know what classes to take.
|
||||
|
||||
## Demo
|
||||
|
||||
@@ -14,36 +14,37 @@
|
||||
|
||||
## Features
|
||||
|
||||
- **Quick Access to Class Info**: For each class in the UT Course Schedule, UTRP provides a "breakdown" popup with direct links to RateMyProfessor, Course Evaluation Surveys (CES), and past syllabi.
|
||||
- **Prerequisite & Restriction Highlights**: Displays course descriptions with highlighted details on prerequisites, restrictions, and other important info.
|
||||
- **Grade Distribution Graphs**: View an aggregate and semester-specific graph of grade distributions for each course.
|
||||
- **Saved Courses List**: Easily add courses to a list and view them in the extension popup. Copy unique numbers with a single click.
|
||||
- **Conflict Detection**: Automatically highlights and strikes out courses that conflict with your saved courses in the UT Course Catalog.
|
||||
- **Weekly Schedule View**: Displays your saved courses in a weekly schedule format for easier planning.
|
||||
- **Multiple Schedule Support**: Create multiple schedules to plan for different registration scenarios.
|
||||
- **And much more!**
|
||||
- **Quick Access to Class Info**: For each class in the UT Course Schedule, UTRP provides a "breakdown" popup with direct links to RateMyProfessor, Course Evaluation Surveys (CES), and past syllabi.
|
||||
- **Prerequisite & Restriction Highlights**: Displays course descriptions with highlighted details on prerequisites, restrictions, and other important info.
|
||||
- **Grade Distribution Graphs**: View an aggregate and semester-specific graph of grade distributions for each course.
|
||||
- **Saved Courses List**: Easily add courses to a list and view them in the extension popup. Copy unique numbers with a single click.
|
||||
- **Conflict Detection**: Automatically highlights and strikes out courses that conflict with your saved courses in the UT Course Catalog.
|
||||
- **Weekly Schedule View**: Displays your saved courses in a weekly schedule format for easier planning.
|
||||
- **Multiple Schedule Support**: Create multiple schedules to plan for different registration scenarios.
|
||||
- **And much more!**
|
||||
|
||||
## Toolchain
|
||||
|
||||
- React v20.9.0 (LTS)
|
||||
- TypeScript
|
||||
- Vite 5
|
||||
- UnoCSS
|
||||
- ESLint
|
||||
- Prettier
|
||||
- Storybook
|
||||
- Figma
|
||||
- Semantic-Release
|
||||
- Custom Messaging & Storage Wrappers
|
||||
- React v20.9.0 (LTS)
|
||||
- TypeScript v5.x
|
||||
- Vite v5.x
|
||||
- pnpm v10.x
|
||||
- UnoCSS
|
||||
- ESLint
|
||||
- Prettier
|
||||
- Storybook
|
||||
- Figma
|
||||
- Semantic-Release
|
||||
- Custom Messaging & Storage Wrappers
|
||||
|
||||
## VSCode Extensions
|
||||
|
||||
We recommend using the following VSCode extensions to improve your development experience:
|
||||
|
||||
- **[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)**: For identifying and fixing linting issues.
|
||||
- **[Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)**: For automatic code formatting.
|
||||
- **[Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)**: For Tailwind CSS class autocomplete and IntelliSense.
|
||||
- **[UnoCSS](https://marketplace.visualstudio.com/items?itemName=antfu.unocss)**: For better support with UnoCSS utilities.
|
||||
- **[ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)**: For identifying and fixing linting issues.
|
||||
- **[Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)**: For automatic code formatting.
|
||||
- **[Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)**: For Tailwind CSS class autocomplete and IntelliSense.
|
||||
- **[UnoCSS](https://marketplace.visualstudio.com/items?itemName=antfu.unocss)**: For better support with UnoCSS utilities.
|
||||
|
||||
## Contributing
|
||||
|
||||
@@ -78,7 +79,7 @@ Once set up, the extension can be built to the `dist/` directory using the follo
|
||||
|
||||
### Development Builds
|
||||
|
||||
- Run the development server:
|
||||
- Run the development server:
|
||||
```bash
|
||||
pnpm dev
|
||||
```
|
||||
@@ -91,7 +92,7 @@ Once set up, the extension can be built to the `dist/` directory using the follo
|
||||
|
||||
### Production Builds
|
||||
|
||||
- To generate production builds:
|
||||
- To generate production builds:
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
@@ -120,10 +121,10 @@ To load the extension manually in Chrome:
|
||||
|
||||
If you encounter bugs or issues, please report them in the [Issues](https://github.com/Longhorn-Developers/UT-Registration-Plus/issues) section, including:
|
||||
|
||||
- A clear, descriptive title
|
||||
- Steps to reproduce the issue
|
||||
- Expected behavior
|
||||
- Screenshots or logs (if applicable)
|
||||
- A clear, descriptive title
|
||||
- Steps to reproduce the issue
|
||||
- Expected behavior
|
||||
- Screenshots or logs (if applicable)
|
||||
|
||||
We aim to address issues promptly.
|
||||
|
||||
@@ -141,14 +142,14 @@ Follow this structure for commit messages:
|
||||
|
||||
Where:
|
||||
|
||||
- **type**: One of the following:
|
||||
- `feat`: A new feature
|
||||
- `fix`: A bug fix
|
||||
- `docs`: Documentation updates
|
||||
- `style`: Code formatting changes (whitespace, semicolons, etc.)
|
||||
- `refactor`: Code restructuring (without adding features or fixing bugs)
|
||||
- `test`: Adding or modifying tests
|
||||
- `chore`: Maintenance tasks or build process changes
|
||||
- **type**: One of the following:
|
||||
- `feat`: A new feature
|
||||
- `fix`: A bug fix
|
||||
- `docs`: Documentation updates
|
||||
- `style`: Code formatting changes (whitespace, semicolons, etc.)
|
||||
- `refactor`: Code restructuring (without adding features or fixing bugs)
|
||||
- `test`: Adding or modifying tests
|
||||
- `chore`: Maintenance tasks or build process changes
|
||||
|
||||
Example:
|
||||
|
||||
@@ -167,9 +168,9 @@ Branch names should follow the format:
|
||||
|
||||
Examples:
|
||||
|
||||
- `feat/user-login`
|
||||
- `fix/navbar-layout`
|
||||
- `docs/update-readme`
|
||||
- `feat/user-login`
|
||||
- `fix/navbar-layout`
|
||||
- `docs/update-readme`
|
||||
|
||||
## License
|
||||
|
||||
@@ -183,27 +184,28 @@ We maintain a strict code of conduct. By contributing, you agree to adhere to th
|
||||
|
||||
Special thanks to the developers and contributors behind these amazing tools and libraries:
|
||||
|
||||
- React v20.9.0 (LTS)
|
||||
- TypeScript
|
||||
- Vite 5
|
||||
- UnoCSS
|
||||
- ESLint
|
||||
- Prettier
|
||||
- Storybook
|
||||
- Figma
|
||||
- Semantic-Release
|
||||
- [chrome-extension-toolkit](https://github.com/sghsri/chrome-extension-toolkit)
|
||||
- [UT_Grade_Parser](https://github.com/doprz/UT_Grade_Parser)
|
||||
- [eslint-plugin-import-essentials](https://github.com/doprz/eslint-plugin-import-essentials)
|
||||
- [UT Registration Plus v1.2.2.7](https://github.com/Longhorn-Developers/UT-Registration-Plus/tree/legacy) by @sghsri
|
||||
- [UT Registration Planner](https://github.com/doprz/UT-Registration-Planner) by @doprz
|
||||
- [Figma Designs](https://www.figma.com/design/8tsCay2FRqctrdcZ3r9Ahw/UTRP) by @IsaDavRod
|
||||
- [Longhorn Developers](https://github.com/Longhorn-Developers) - established in 2024
|
||||
- The UTRP devs, beta testers, and all supporters of the project!
|
||||
- React v20.9.0 (LTS)
|
||||
- TypeScript v5.x
|
||||
- Vite v5.x
|
||||
- pnpm v10.x
|
||||
- UnoCSS
|
||||
- ESLint
|
||||
- Prettier
|
||||
- Storybook
|
||||
- Figma
|
||||
- Semantic-Release
|
||||
- [chrome-extension-toolkit](https://github.com/sghsri/chrome-extension-toolkit)
|
||||
- [UT_Grade_Parser](https://github.com/doprz/UT_Grade_Parser)
|
||||
- [eslint-plugin-import-essentials](https://github.com/doprz/eslint-plugin-import-essentials)
|
||||
- [UT Registration Plus v1.2.2.7](https://github.com/Longhorn-Developers/UT-Registration-Plus/tree/legacy) by @sghsri
|
||||
- [UT Registration Planner](https://github.com/doprz/UT-Registration-Planner) by @doprz
|
||||
- [Figma Designs](https://www.figma.com/design/8tsCay2FRqctrdcZ3r9Ahw/UTRP) by @IsaDavRod
|
||||
- [Longhorn Developers](https://github.com/Longhorn-Developers) - established in 2024
|
||||
- The UTRP devs, beta testers, and all supporters of the project!
|
||||
|
||||
## Activity
|
||||
|
||||

|
||||

|
||||
|
||||
## Star History
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"onlyChanged": true,
|
||||
"projectId": "Project:65c5172964f36dcf207985bf",
|
||||
"zip": true
|
||||
"onlyChanged": true,
|
||||
"projectId": "Project:65c5172964f36dcf207985bf",
|
||||
"zip": true
|
||||
}
|
||||
|
||||
10
default.nix
Normal file
10
default.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
(import (
|
||||
let
|
||||
rev = "v1.1.0";
|
||||
sha256 = "sha256:19d2z6xsvpxm184m41qrpi1bplilwipgnzv9jy17fgw421785q1m";
|
||||
in
|
||||
fetchTarball {
|
||||
inherit sha256;
|
||||
url = "https://github.com/NixOS/flake-compat/archive/${rev}.tar.gz";
|
||||
}
|
||||
) { src = ./.; }).defaultNix
|
||||
@@ -24,7 +24,7 @@ else
|
||||
fi
|
||||
|
||||
# Validate the mode
|
||||
if [[ ! " ${SUPPORTED_MODES[*]} " =~ " ${mode} " ]]; then
|
||||
if [[ ! " ${SUPPORTED_MODES[*]} " =~ ${mode} ]]; then
|
||||
echo "Error: Invalid mode '${mode}'" >&2
|
||||
usage
|
||||
fi
|
||||
|
||||
96
flake.lock
generated
Normal file
96
flake.lock
generated
Normal file
@@ -0,0 +1,96 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1767609335,
|
||||
"narHash": "sha256-feveD98mQpptwrAEggBQKJTYbvwwglSbOv53uCfH9PY=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "250481aafeb741edfe23d29195671c19b36b6dca",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1767640445,
|
||||
"narHash": "sha256-UWYqmD7JFBEDBHWYcqE6s6c77pWdcU/i+bwD6XxMb8A=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9f0c42f8bc7151b8e7e5840fb3bd454ad850d8c5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib": {
|
||||
"locked": {
|
||||
"lastModified": 1765674936,
|
||||
"narHash": "sha256-k00uTP4JNfmejrCLJOwdObYC9jHRrr/5M/a/8L2EIdo=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "2075416fcb47225d9b68ac469a5c4801a9c4dd85",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1761236834,
|
||||
"narHash": "sha256-+pthv6hrL5VLW2UqPdISGuLiUZ6SnAXdd2DdUE+fV2Q=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "d5faa84122bc0a1fd5d378492efce4e289f8eac1",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1767468822,
|
||||
"narHash": "sha256-MpffQxHxmjVKMiQd0Tg2IM/bSjjdQAM+NDcX6yxj7rE=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "d56486eb9493ad9c4777c65932618e9c2d0468fc",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
33
flake.nix
Normal file
33
flake.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
treefmt-nix.url = "github:numtide/treefmt-nix";
|
||||
};
|
||||
|
||||
outputs =
|
||||
inputs@{ flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
systems = inputs.nixpkgs.lib.systems.flakeExposed;
|
||||
|
||||
imports = [
|
||||
./nix/packages.nix
|
||||
./nix/devShells.nix
|
||||
./nix/treefmt.nix
|
||||
];
|
||||
|
||||
perSystem =
|
||||
{ system, ... }:
|
||||
{
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
overlays = [
|
||||
(final: prev: {
|
||||
nodejs = prev.nodejs_20; # v20.19.5
|
||||
})
|
||||
];
|
||||
config = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
10
gulpfile.js
10
gulpfile.js
@@ -35,9 +35,13 @@ function removeExtraDatabaseDir(cb) {
|
||||
// Instrument with Sentry
|
||||
// Make sure sentry is configured https://docs.sentry.io/platforms/javascript/sourcemaps/uploading/typescript/#2-configure-sentry-cli
|
||||
async function instrumentWithSentry(cb) {
|
||||
await exec(`sentry-cli sourcemaps inject ${DIST_DIR}`);
|
||||
await exec(`sentry-cli sourcemaps upload ${DIST_DIR}`);
|
||||
log('Sentry instrumentation completed.');
|
||||
if (process.env.SENTRY_ENV && process.env.SENTRY_ENV !== 'development') {
|
||||
await exec(`sentry-cli sourcemaps inject ${DIST_DIR}`);
|
||||
await exec(`sentry-cli sourcemaps upload ${DIST_DIR}`);
|
||||
log('Sentry instrumentation completed.');
|
||||
} else {
|
||||
logWarn('Skipping uploading/creating Sentry source maps. (development build)');
|
||||
}
|
||||
|
||||
cb();
|
||||
}
|
||||
|
||||
17
justfile
Normal file
17
justfile
Normal file
@@ -0,0 +1,17 @@
|
||||
# Check release dependencies
|
||||
check-deps:
|
||||
./scripts/check-release-deps.sh
|
||||
|
||||
# Stage a new release (bump version, changelog, commit, tag)
|
||||
stage-release version="minor":
|
||||
./scripts/stage-release.sh {{version}}
|
||||
|
||||
# Publish the release (create distribution package)
|
||||
publish-release:
|
||||
./scripts/publish-release.sh
|
||||
|
||||
# Complete release workflow
|
||||
release version="minor": check-deps (stage-release version) publish-release
|
||||
@echo ""
|
||||
@echo "Complete release workflow finished!"
|
||||
@echo "Don't forget to push your changes to the remote repository."
|
||||
30
nix/devShells.nix
Normal file
30
nix/devShells.nix
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
perSystem =
|
||||
{
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
commonPackages = with pkgs; [
|
||||
nodejs # Defined in overlay
|
||||
pnpm_10 # v10.18.2
|
||||
];
|
||||
|
||||
additionalPackages = with pkgs; [
|
||||
bun
|
||||
nodePackages.conventional-changelog-cli
|
||||
sentry-cli
|
||||
];
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
name = "utrp-dev";
|
||||
packages = commonPackages;
|
||||
};
|
||||
|
||||
devShells.full = pkgs.mkShell {
|
||||
name = "utrp-dev-full";
|
||||
packages = commonPackages ++ additionalPackages;
|
||||
};
|
||||
};
|
||||
}
|
||||
51
nix/package.nix
Normal file
51
nix/package.nix
Normal file
@@ -0,0 +1,51 @@
|
||||
{
|
||||
stdenv,
|
||||
lib,
|
||||
nodejs,
|
||||
pnpm_10,
|
||||
git,
|
||||
version ? "dev",
|
||||
gitRev ? "unknown",
|
||||
gitBranch ? "unknown",
|
||||
buildScript ? "build",
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
inherit version;
|
||||
pname = "ut-registration-plus";
|
||||
|
||||
src = ../.;
|
||||
|
||||
nativeBuildInputs = [
|
||||
nodejs
|
||||
pnpm_10.configHook
|
||||
git
|
||||
];
|
||||
|
||||
pnpmDeps = pnpm_10.fetchDeps {
|
||||
inherit (finalAttrs) pname version src;
|
||||
fetcherVersion = 2;
|
||||
hash = "sha256-UqHymJWvlTV4glra/6DkxuCxbG5dpPkFcnvq3vuxsJ8=";
|
||||
};
|
||||
|
||||
# Pass git info to the build
|
||||
VITE_GIT_COMMIT = gitRev;
|
||||
VITE_GIT_BRANCH = gitBranch;
|
||||
|
||||
buildPhase = ''
|
||||
pnpm run ${buildScript}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -r dist/* $out/
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "UT Registration Plus";
|
||||
homepage = "https://github.com/Longhorn-Developers/UT-Registration-Plus";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = lib.maintainers.doprz;
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
})
|
||||
40
nix/packages.nix
Normal file
40
nix/packages.nix
Normal file
@@ -0,0 +1,40 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
let
|
||||
packageJson = builtins.fromJSON (builtins.readFile ../package.json);
|
||||
gitRev = inputs.self.shortRev or inputs.self.dirtyShortRev or "dev";
|
||||
gitBranch = if inputs.self ? ref then inputs.self.ref else "unknown";
|
||||
baseVersion = packageJson.version;
|
||||
|
||||
commonArgs = {
|
||||
inherit gitRev gitBranch;
|
||||
};
|
||||
|
||||
# Prod variant
|
||||
ut-registration-plus = pkgs.callPackage ./package.nix (
|
||||
commonArgs
|
||||
// {
|
||||
version = "${baseVersion}+git.${gitRev}";
|
||||
buildScript = "build";
|
||||
}
|
||||
);
|
||||
|
||||
# Dev variant
|
||||
ut-registration-plus-dev = pkgs.callPackage ./package.nix (
|
||||
commonArgs
|
||||
// {
|
||||
version = "${baseVersion}-dev+git.${gitRev}";
|
||||
buildScript = "build:dev";
|
||||
}
|
||||
);
|
||||
in
|
||||
{
|
||||
packages = {
|
||||
inherit ut-registration-plus ut-registration-plus-dev;
|
||||
default = ut-registration-plus;
|
||||
dev = ut-registration-plus-dev;
|
||||
};
|
||||
};
|
||||
}
|
||||
63
nix/treefmt.nix
Normal file
63
nix/treefmt.nix
Normal file
@@ -0,0 +1,63 @@
|
||||
{ inputs, ... }:
|
||||
{
|
||||
imports = [
|
||||
inputs.treefmt-nix.flakeModule
|
||||
];
|
||||
|
||||
perSystem =
|
||||
{ pkgs, ... }:
|
||||
{
|
||||
treefmt = {
|
||||
projectRootFile = "flake.nix";
|
||||
programs.nixfmt.enable = pkgs.lib.meta.availableOn pkgs.stdenv.buildPlatform pkgs.nixfmt-rfc-style.compiler;
|
||||
programs.nixfmt.package = pkgs.nixfmt-rfc-style;
|
||||
|
||||
# NOTE: Make sure the prettier version in package.json and the one used by treefmt are the same for consistent results
|
||||
programs.prettier.enable = true;
|
||||
programs.shellcheck.enable = true;
|
||||
programs.yamlfmt.enable = true;
|
||||
programs.dockerfmt.enable = true;
|
||||
|
||||
settings.formatter.prettier.excludes = [ "pnpm-lock.yaml" ];
|
||||
settings.formatter.shellcheck.excludes = [ ".envrc" ];
|
||||
settings.formatter.yamlfmt.excludes = [ "pnpm-lock.yaml" ];
|
||||
};
|
||||
|
||||
checks = {
|
||||
prettier-version-match =
|
||||
pkgs.runCommand "check-prettier-version"
|
||||
{
|
||||
buildInputs = [ pkgs.jq ];
|
||||
}
|
||||
''
|
||||
# Extract prettier version from package.json
|
||||
packageJsonVersion=$(jq -r '.devDependencies.prettier // empty' ${../package.json})
|
||||
|
||||
if [ -z "$packageJsonVersion" ]; then
|
||||
echo "Error: prettier not found in package.json devDependencies"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Remove any semver prefix characters (^, ~, etc...)
|
||||
packageJsonVersion=$(echo "$packageJsonVersion" | sed 's/^[\^~>=<]*//')
|
||||
|
||||
# Get prettier version from nixpkgs
|
||||
nixVersion="${pkgs.nodePackages.prettier.version}"
|
||||
|
||||
if [ "$packageJsonVersion" != "$nixVersion" ]; then
|
||||
echo ""
|
||||
echo "ERROR: Prettier version mismatch!"
|
||||
echo " package.json: $packageJsonVersion"
|
||||
echo " nixpkgs: $nixVersion"
|
||||
echo ""
|
||||
echo "Please update one of the following:"
|
||||
echo " - Update prettier in package.json to match nixpkgs: $nixVersion"
|
||||
echo " - Override prettier in your flake to match package.json"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
touch $out
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
127
package.json
127
package.json
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "ut-registration-plus",
|
||||
"displayName": "UT Registration Plus",
|
||||
"version": "2.1.0",
|
||||
"version": "2.3.0",
|
||||
"description": "UT Registration Plus is a Chrome extension that allows students to easily register for classes.",
|
||||
"private": true,
|
||||
"homepage": "https://github.com/Longhorn-Developers/UT-Registration-Plus",
|
||||
@@ -9,8 +9,10 @@
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "tsc && vite build",
|
||||
"build:dev": "tsc && NODE_ENV='development' vite build --mode development",
|
||||
"build:watch": "NODE_ENV='development' vite build --mode development -w",
|
||||
"zip": "PROD=true pnpm build && pnpm gulp zipProdBuild",
|
||||
"zip": "pnpm build && pnpm gulp zipProdBuild",
|
||||
"zip:to-publish": "SENTRY_ENV='production' pnpm zip",
|
||||
"prettier": "prettier src --check",
|
||||
"prettier:fix": "prettier src --write",
|
||||
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives",
|
||||
@@ -27,66 +29,71 @@
|
||||
"prepare": "husky"
|
||||
},
|
||||
"dependencies": {
|
||||
"@date-fns/tz": "^1.2.0",
|
||||
"@dnd-kit/core": "^6.3.1",
|
||||
"@dnd-kit/modifiers": "^9.0.0",
|
||||
"@dnd-kit/sortable": "^10.0.0",
|
||||
"@dnd-kit/utilities": "^3.2.2",
|
||||
"@headlessui/react": "^2.2.0",
|
||||
"@octokit/rest": "^21.0.2",
|
||||
"@octokit/rest": "^21.1.1",
|
||||
"@phosphor-icons/react": "^2.1.7",
|
||||
"@sentry/react": "^8.38.0",
|
||||
"@sentry/react": "^8.55.0",
|
||||
"@tanstack/react-query": "^5.69.0",
|
||||
"@tsparticles/engine": "^3.9.1",
|
||||
"@tsparticles/react": "^3.0.0",
|
||||
"@tsparticles/slim": "^3.9.1",
|
||||
"@unocss/vite": "^0.63.6",
|
||||
"@vitejs/plugin-react": "^4.3.3",
|
||||
"chrome-extension-toolkit": "^0.0.54",
|
||||
"@vitejs/plugin-react": "^4.3.4",
|
||||
"clsx": "^2.1.1",
|
||||
"conventional-changelog": "^6.0.0",
|
||||
"date-fns": "^4.1.0",
|
||||
"highcharts": "^11.4.8",
|
||||
"highcharts-react-official": "^3.2.1",
|
||||
"html-to-image": "^1.11.11",
|
||||
"husky": "^9.1.6",
|
||||
"html-to-image": "^1.11.13",
|
||||
"husky": "^9.1.7",
|
||||
"kc-dabr-wasm": "^0.1.2",
|
||||
"nanoid": "^5.0.8",
|
||||
"nanoid": "^5.1.2",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"react-loading-skeleton": "^3.5.0",
|
||||
"react-markdown": "^9.0.1",
|
||||
"react-markdown": "^9.1.0",
|
||||
"react-syntax-highlighter": "^15.6.1",
|
||||
"remark-gfm": "^4.0.0",
|
||||
"sass": "^1.81.0",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"sass": "^1.85.1",
|
||||
"simple-git": "^3.27.0",
|
||||
"sql.js": "1.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@chromatic-com/storybook": "^2.0.2",
|
||||
"@commitlint/cli": "^19.5.0",
|
||||
"@commitlint/config-conventional": "^19.5.0",
|
||||
"@commitlint/cli": "^19.7.1",
|
||||
"@commitlint/config-conventional": "^19.7.1",
|
||||
"@commitlint/types": "^19.5.0",
|
||||
"@crxjs/vite-plugin": "2.0.0-beta.21",
|
||||
"@iconify-json/bi": "^1.2.1",
|
||||
"@iconify-json/ic": "^1.2.1",
|
||||
"@iconify-json/iconoir": "^1.2.4",
|
||||
"@iconify-json/material-symbols": "^1.2.6",
|
||||
"@iconify-json/ri": "^1.2.3",
|
||||
"@iconify-json/streamline": "^1.2.1",
|
||||
"@iconify-json/bi": "^1.2.2",
|
||||
"@iconify-json/ic": "^1.2.2",
|
||||
"@iconify-json/iconoir": "^1.2.7",
|
||||
"@iconify-json/material-symbols": "^1.2.14",
|
||||
"@iconify-json/ri": "^1.2.5",
|
||||
"@iconify-json/streamline": "^1.2.2",
|
||||
"@semantic-release/exec": "^6.0.3",
|
||||
"@sentry/types": "^8.38.0",
|
||||
"@storybook/addon-designs": "^8.0.4",
|
||||
"@storybook/addon-essentials": "^8.4.4",
|
||||
"@storybook/addon-links": "^8.4.4",
|
||||
"@storybook/blocks": "^8.4.4",
|
||||
"@storybook/react": "^8.4.4",
|
||||
"@storybook/react-vite": "^8.4.4",
|
||||
"@storybook/test": "^8.4.4",
|
||||
"@sentry/types": "^8.55.0",
|
||||
"@storybook/addon-designs": "^8.2.0",
|
||||
"@storybook/addon-essentials": "^8.6.0",
|
||||
"@storybook/addon-links": "^8.6.0",
|
||||
"@storybook/blocks": "^8.6.0",
|
||||
"@storybook/react": "^8.6.0",
|
||||
"@storybook/react-vite": "^8.6.0",
|
||||
"@storybook/test": "^8.6.0",
|
||||
"@svgr/core": "^8.1.0",
|
||||
"@svgr/plugin-jsx": "^8.1.0",
|
||||
"@types/chrome": "^0.0.273",
|
||||
"@types/conventional-changelog": "^3.1.5",
|
||||
"@types/gulp": "^4.0.17",
|
||||
"@types/gulp-zip": "^4.0.4",
|
||||
"@types/node": "^22.9.0",
|
||||
"@types/node": "^22.13.5",
|
||||
"@types/prompts": "^2.4.9",
|
||||
"@types/react": "^18.3.12",
|
||||
"@types/react-dom": "^18.3.1",
|
||||
"@types/react": "^18.3.18",
|
||||
"@types/react-dom": "^18.3.5",
|
||||
"@types/react-syntax-highlighter": "^15.5.13",
|
||||
"@types/semantic-release": "^20.0.6",
|
||||
"@types/semver": "^7.5.8",
|
||||
@@ -100,48 +107,53 @@
|
||||
"@unocss/reset": "^0.63.6",
|
||||
"@unocss/transformer-directives": "^0.63.6",
|
||||
"@unocss/transformer-variant-group": "^0.63.6",
|
||||
"@vitejs/plugin-react-swc": "^3.7.1",
|
||||
"@vitest/coverage-v8": "^2.1.5",
|
||||
"@vitest/ui": "^2.1.5",
|
||||
"chalk": "^5.3.0",
|
||||
"chromatic": "^11.18.1",
|
||||
"@vitejs/plugin-react-swc": "^3.8.0",
|
||||
"@vitest/coverage-v8": "^2.1.9",
|
||||
"@vitest/ui": "^2.1.9",
|
||||
"chalk": "^5.4.1",
|
||||
"chromatic": "^11.26.0",
|
||||
"cssnano": "^7.0.6",
|
||||
"cssnano-preset-advanced": "^7.0.6",
|
||||
"dotenv": "^16.4.5",
|
||||
"es-module-lexer": "^1.5.4",
|
||||
"dotenv": "^16.4.7",
|
||||
"es-module-lexer": "^1.6.0",
|
||||
"eslint": "^8.57.1",
|
||||
"eslint-config-airbnb": "^19.0.4",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-config-airbnb-typescript": "^18.0.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint-import-resolver-typescript": "^3.6.3",
|
||||
"eslint-import-resolver-typescript": "^3.8.3",
|
||||
"eslint-plugin-import": "^2.31.0",
|
||||
"eslint-plugin-import-essentials": "^0.2.1",
|
||||
"eslint-plugin-jsdoc": "^50.5.0",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-react": "^7.37.2",
|
||||
"eslint-plugin-jsdoc": "^50.6.3",
|
||||
"eslint-plugin-prettier": "^5.2.3",
|
||||
"eslint-plugin-react": "^7.37.4",
|
||||
"eslint-plugin-react-hooks": "^4.6.2",
|
||||
"eslint-plugin-react-prefer-function-component": "^3.3.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.14",
|
||||
"eslint-plugin-react-prefer-function-component": "^3.4.0",
|
||||
"eslint-plugin-react-refresh": "^0.4.19",
|
||||
"eslint-plugin-simple-import-sort": "^12.1.1",
|
||||
"eslint-plugin-storybook": "^0.9.0",
|
||||
"eslint-plugin-tsdoc": "^0.3.0",
|
||||
"gulp": "^5.0.0",
|
||||
"gulp-execa": "^7.0.1",
|
||||
"gulp-zip": "^6.0.0",
|
||||
"gulp-zip": "^6.1.0",
|
||||
"jsdom": "^28.0.0",
|
||||
"path": "^0.12.7",
|
||||
"postcss": "^8.4.49",
|
||||
"prettier": "^3.3.3",
|
||||
"postcss": "^8.5.3",
|
||||
"prettier": "3.6.2",
|
||||
"react-dev-utils": "^12.0.1",
|
||||
"semantic-release": "^24.2.0",
|
||||
"storybook": "^8.4.4",
|
||||
"typescript": "^5.6.3",
|
||||
"semantic-release": "^24.2.3",
|
||||
"storybook": "^8.6.0",
|
||||
"typescript": "^5.7.3",
|
||||
"unocss": "^0.63.6",
|
||||
"unocss-preset-primitives": "0.0.2-beta.1",
|
||||
"unplugin-icons": "^0.19.3",
|
||||
"vite": "^5.4.11",
|
||||
"vite-plugin-inspect": "^0.8.7",
|
||||
"vitest": "^2.1.5"
|
||||
"vite": "^5.4.20",
|
||||
"vite-plugin-inspect": "^0.8.9",
|
||||
"vitest": "^2.1.9"
|
||||
},
|
||||
"engineStrict": true,
|
||||
"engines": {
|
||||
"pnpm": "^10"
|
||||
},
|
||||
"pnpm": {
|
||||
"patchedDependencies": {
|
||||
@@ -150,6 +162,13 @@
|
||||
},
|
||||
"overrides": {
|
||||
"es-module-lexer": "^1.5.4"
|
||||
}
|
||||
},
|
||||
"onlyBuiltDependencies": [
|
||||
"@tsparticles/engine"
|
||||
]
|
||||
},
|
||||
"volta": {
|
||||
"node": "20.19.4",
|
||||
"pnpm": "10.14.0"
|
||||
}
|
||||
}
|
||||
|
||||
3847
pnpm-lock.yaml
generated
3847
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -218,4 +218,4 @@
|
||||
"WRT",
|
||||
"YID",
|
||||
"YOR"
|
||||
]
|
||||
]
|
||||
|
||||
78
scripts/check-deps.nu
Normal file
78
scripts/check-deps.nu
Normal file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use std/log
|
||||
|
||||
# Check release dependencies
|
||||
export def main [] {
|
||||
print "Checking Release Dependencies"
|
||||
print "=============================\n"
|
||||
|
||||
log info "Checking .env file..."
|
||||
if not (".env" | path exists) {
|
||||
error make {msg: ".env file not found"}
|
||||
}
|
||||
log debug " .env file found"
|
||||
|
||||
log info "Validating Sentry configuration..."
|
||||
# Get env variables dynamically and reduce the table into a record
|
||||
let env_vars = (
|
||||
open .env
|
||||
| lines
|
||||
| where { |line| ($line | str trim) != "" and not ($line | str starts-with "#") }
|
||||
| each { |line|
|
||||
let parts = ($line | split column "=" key value | first)
|
||||
{ name: ($parts.key | str trim), value: ($parts.value | str trim) }
|
||||
}
|
||||
| reduce --fold {} { |it, acc| $acc | merge { ($it.name): $it.value } }
|
||||
)
|
||||
|
||||
let sentry_org = $env_vars | get SENTRY_ORG?
|
||||
if $sentry_org != "longhorn-developers" {
|
||||
error make {msg: $"SENTRY_ORG must be set to longhorn-developers in .env\nGot: ($sentry_org)"}
|
||||
}
|
||||
log debug $" SENTRY_ORG: ($sentry_org)"
|
||||
|
||||
|
||||
let sentry_project = $env_vars | get SENTRY_PROJECT?
|
||||
if $sentry_project != "ut-registration-plus" {
|
||||
error make {msg: $"SENTRY_PROJECT must be set to ut-registration-plus in .env\nGot: ($sentry_project)"}
|
||||
}
|
||||
log debug $" SENTRY_PROJECT: ($sentry_project)"
|
||||
|
||||
let sentry_auth_token = $env_vars | get SENTRY_AUTH_TOKEN?
|
||||
if ($sentry_auth_token | is-empty) {
|
||||
error make {msg: "SENTRY_AUTH_TOKEN must be populated in .env"}
|
||||
}
|
||||
log debug " SENTRY_AUTH_TOKEN: [set]"
|
||||
|
||||
#Check for required commands
|
||||
mut missing_deps = []
|
||||
|
||||
if (which pnpm | is-empty) {
|
||||
$missing_deps = ($missing_deps | append "pnpm")
|
||||
}
|
||||
if (which npm | is-empty) {
|
||||
$missing_deps = ($missing_deps | append "npm")
|
||||
}
|
||||
if (which conventional-changelog | is-empty) {
|
||||
$missing_deps = ($missing_deps | append "conventional-changelog")
|
||||
}
|
||||
|
||||
log info "Checking VCS"
|
||||
if not (which jj | is-empty) {
|
||||
log debug " Version control: jujutsu"
|
||||
} else if not (which git | is-empty) {
|
||||
log debug " Version control: git"
|
||||
} else {
|
||||
$missing_deps = ($missing_deps | append "git or jujutsu")
|
||||
}
|
||||
|
||||
if ($missing_deps | length) > 0 {
|
||||
let deps: string = $missing_deps | str join ", "
|
||||
let error_msg: string = ("Missing required dependencies: " | append $deps | str join)
|
||||
error make { msg: $error_msg }
|
||||
}
|
||||
|
||||
log info "All required commands found"
|
||||
log info "All dependency checks passed"
|
||||
}
|
||||
82
scripts/check-release-deps.sh
Normal file
82
scripts/check-release-deps.sh
Normal file
@@ -0,0 +1,82 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
# Check Release Dependencies
|
||||
# Validates environment and requirements before releasing
|
||||
|
||||
echo "Checking Release Dependencies"
|
||||
echo "=============================="
|
||||
echo ""
|
||||
|
||||
# Check if .env file exists
|
||||
echo "[1/3] Checking .env file..."
|
||||
if [ ! -f .env ]; then
|
||||
echo "ERROR: .env file not found"
|
||||
exit 1
|
||||
fi
|
||||
echo " .env file found"
|
||||
|
||||
# Source the .env file and validate required variables
|
||||
set +u
|
||||
source .env
|
||||
set -u
|
||||
|
||||
echo "[2/3] Validating Sentry configuration..."
|
||||
|
||||
if [ -z "${SENTRY_ORG:-}" ] || [ "$SENTRY_ORG" != "longhorn-developers" ]; then
|
||||
echo "ERROR: SENTRY_ORG must be set to 'longhorn-developers' in .env"
|
||||
exit 1
|
||||
fi
|
||||
echo " SENTRY_ORG: $SENTRY_ORG"
|
||||
|
||||
if [ -z "${SENTRY_PROJECT:-}" ] || [ "$SENTRY_PROJECT" != "ut-registration-plus" ]; then
|
||||
echo "ERROR: SENTRY_PROJECT must be set to 'ut-registration-plus' in .env"
|
||||
exit 1
|
||||
fi
|
||||
echo " SENTRY_PROJECT: $SENTRY_PROJECT"
|
||||
|
||||
if [ -z "${SENTRY_AUTH_TOKEN:-}" ]; then
|
||||
echo "ERROR: SENTRY_AUTH_TOKEN must be populated in .env"
|
||||
exit 1
|
||||
fi
|
||||
echo " SENTRY_AUTH_TOKEN: [set]"
|
||||
|
||||
# Check for required commands
|
||||
echo "[3/3] Checking required commands..."
|
||||
|
||||
MISSING_DEPS=()
|
||||
|
||||
if ! command -v pnpm &>/dev/null; then
|
||||
MISSING_DEPS+=("pnpm")
|
||||
fi
|
||||
|
||||
if ! command -v npm &>/dev/null; then
|
||||
MISSING_DEPS+=("npm")
|
||||
fi
|
||||
|
||||
if ! command -v conventional-changelog &>/dev/null; then
|
||||
MISSING_DEPS+=("conventional-changelog")
|
||||
fi
|
||||
|
||||
# Check for version control
|
||||
if command -v jj &>/dev/null; then
|
||||
echo " Version control: jujutsu"
|
||||
elif command -v git &>/dev/null; then
|
||||
echo " Version control: git"
|
||||
else
|
||||
MISSING_DEPS+=("git or jujutsu")
|
||||
fi
|
||||
|
||||
if [ ${#MISSING_DEPS[@]} -ne 0 ]; then
|
||||
echo ""
|
||||
echo "ERROR: Missing required dependencies:"
|
||||
for dep in "${MISSING_DEPS[@]}"; do
|
||||
echo " - $dep"
|
||||
done
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo " All required commands found"
|
||||
echo ""
|
||||
echo "All dependency checks passed."
|
||||
@@ -27,8 +27,8 @@ interface Props {
|
||||
/**
|
||||
* Generates a changelog using the conventional-changelog command.
|
||||
*
|
||||
* @returns {Promise<void>} A promise that resolves when the changelog is generated.
|
||||
* @throws {Error} If there is an error generating the changelog.
|
||||
* @returns A promise that resolves when the changelog is generated.
|
||||
* @throws If there is an error generating the changelog.
|
||||
*/
|
||||
async function generateChangelog({ preset, outFile = 'CHANGELOG.md', releaseCount = 1 }: Props): Promise<void> {
|
||||
try {
|
||||
|
||||
31
scripts/publish-release.nu
Normal file
31
scripts/publish-release.nu
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use std/log
|
||||
|
||||
# Publish the release (creates distribution package and displays checksum)
|
||||
export def main [] {
|
||||
print "Publishing Release"
|
||||
print "==================\n"
|
||||
|
||||
log info "pnpm zip:to-publish"
|
||||
let result = (pnpm zip:to-publish | complete)
|
||||
|
||||
if ($result.stderr | str contains -i "error") or ($result.stderr | str contains -i "failed") {
|
||||
error make {msg: "Package creation failed"}
|
||||
}
|
||||
|
||||
# Find and verify the zip file
|
||||
let zip_files = (ls package/*.zip | where type == file)
|
||||
if ($zip_files | is-empty) {
|
||||
error make {msg: "No package found in package/ directory"}
|
||||
}
|
||||
|
||||
# Get last modified zip file
|
||||
let zip_file = ($zip_files | sort-by -r modified | first | get name)
|
||||
let checksum = (open $zip_file | hash sha256)
|
||||
|
||||
log info "Release published successfully!"
|
||||
log info "Package ready for distribution:"
|
||||
log info $"($zip_file)"
|
||||
log info $"SHA256: ($checksum)"
|
||||
}
|
||||
54
scripts/publish-release.sh
Normal file
54
scripts/publish-release.sh
Normal file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
# Publish Release
|
||||
# Creates distribution package and displays checksum
|
||||
|
||||
echo "Publishing Release"
|
||||
echo "=================="
|
||||
echo ""
|
||||
|
||||
# Remove old zip files
|
||||
echo "[1/2] Creating distribution package..."
|
||||
rm -f package/*.zip 2>/dev/null || true
|
||||
|
||||
TEMP_ZIP=$(mktemp)
|
||||
trap "rm -f $TEMP_ZIP" EXIT
|
||||
|
||||
FORCE_COLOR=1 pnpm zip:to-publish 2>&1 | tee "$TEMP_ZIP"
|
||||
|
||||
if grep -qi "error\|failed" "$TEMP_ZIP"; then
|
||||
echo ""
|
||||
echo "ERROR: Package creation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Find and verify the zip file
|
||||
ZIP_FILE=$(find package/ -name "*.zip" -type f -print -quit 2>/dev/null)
|
||||
|
||||
if [ -z "$ZIP_FILE" ]; then
|
||||
echo "ERROR: No package found in package/ directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Calculate SHA256 checksum
|
||||
echo ""
|
||||
echo "[2/2] Calculating SHA256 checksum..."
|
||||
echo " Package: $ZIP_FILE"
|
||||
echo ""
|
||||
|
||||
if command -v shasum &>/dev/null; then
|
||||
shasum -a 256 "$ZIP_FILE"
|
||||
elif command -v sha256sum &>/dev/null; then
|
||||
sha256sum "$ZIP_FILE"
|
||||
else
|
||||
echo "ERROR: Neither shasum nor sha256sum found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Release published successfully!"
|
||||
echo ""
|
||||
echo "Package ready for distribution:"
|
||||
echo " $ZIP_FILE"
|
||||
29
scripts/release.nu
Normal file
29
scripts/release.nu
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use check-deps.nu
|
||||
use stage-release.nu
|
||||
use publish-release.nu
|
||||
|
||||
# UTRP Release workflow
|
||||
export def main [
|
||||
--bump: string = "minor", # bump type: major, minor, or patch
|
||||
--dry-run = true, # Dry run release workflow
|
||||
] {
|
||||
check-deps
|
||||
|
||||
if $dry_run {
|
||||
print "\ndry-run todo:"
|
||||
print "- stage-release"
|
||||
print "- publish-release"
|
||||
exit 0
|
||||
}
|
||||
|
||||
mut vcs = ""
|
||||
if not (which jj | is-empty) { $vcs = "jj" } else if not (which git | is-empty) { $vcs = "git"}
|
||||
|
||||
stage-release $bump $vcs
|
||||
publish-release
|
||||
|
||||
print "Release workflow completed!"
|
||||
}
|
||||
|
||||
97
scripts/stage-release.nu
Normal file
97
scripts/stage-release.nu
Normal file
@@ -0,0 +1,97 @@
|
||||
#!/usr/bin/env nu
|
||||
|
||||
use std/log
|
||||
|
||||
# Stage a new release (bump version, changelog, commit, and tag)
|
||||
export def main [
|
||||
version_type: string = "minor", # Version type: major, minor, or patch
|
||||
vcs: string = "jj", # VCS: jj or git
|
||||
] {
|
||||
print "Staging Release"
|
||||
print "===============\n"
|
||||
|
||||
if $version_type not-in ["major, minor", "patch"] {
|
||||
error make {msg: $"version_type must be major, minor, or patch.\nGot: ($version_type)"}
|
||||
}
|
||||
|
||||
if $vcs not-in ["jj", "git"] {
|
||||
error make {msg: $"vcs must be jj or git.\nGot: ($vcs)"}
|
||||
}
|
||||
|
||||
|
||||
log info $"Using ($vcs)"
|
||||
if $vcs == "git" {
|
||||
# Check for uncommitted changes (git only)
|
||||
let status = (git diff-index --quiet HEAD -- | complete)
|
||||
if $status.exit_code != 0 {
|
||||
error make {msg: "You have uncommitted changes. Please commit or stash them first."}
|
||||
}
|
||||
}
|
||||
|
||||
# Bump version in package.json without committing or tagging
|
||||
log info "Bumping version in package.json..."
|
||||
npm version $version_type --no-git-tag-version | complete
|
||||
|
||||
let new_version = (open package.json | get version)
|
||||
log debug $"New version: ($new_version)"
|
||||
|
||||
changelog
|
||||
|
||||
log info "Committing changes..."
|
||||
if $vcs == "jj" {
|
||||
jj commit -m $"chore: release v($new_version)"
|
||||
log debug "Commit created"
|
||||
|
||||
# Update main bookmark (jj only)
|
||||
log info "Updating main bookmark..."
|
||||
jj bookmark set main -r @
|
||||
log debug "Bookmark 'main' updated to current commit"
|
||||
} else {
|
||||
git add package.json package-lock.json CHANGELOG.md
|
||||
git commit -m $"chore: release v($new_version)"
|
||||
}
|
||||
|
||||
if $vcs == "jj" {
|
||||
log info "Creating annotated tag via git..."
|
||||
jj git export
|
||||
git tag -a $"v($new_version)" -m $"Release v($new_version)"
|
||||
jj git import
|
||||
log debug $"Annotated tag 'v($new_version)' created via git"
|
||||
} else {
|
||||
log info "Creating annotated tag..."
|
||||
git tag -a $"v($new_version)" -m $"Release v($new_version)"
|
||||
log debug $"Annotated tag 'v($new_version)' created"
|
||||
}
|
||||
|
||||
log info $"Release v($new_version) staged successfully!"
|
||||
print "Next steps:"
|
||||
if $vcs == "jj" {
|
||||
print " - Review changes: jj show @-"
|
||||
print " - Push to remote: jj git push && git push --tags"
|
||||
} else {
|
||||
print " - Review changes: git show"
|
||||
print " - Push to remote: git push && git push --tags"
|
||||
}
|
||||
}
|
||||
|
||||
def changelog [] {
|
||||
log info "Generating changelog with new version..."
|
||||
let changelog_exists = ("CHANGELOG.md" | path exists)
|
||||
let changelog_before = if $changelog_exists {
|
||||
(ls CHANGELOG.md | get modified | first)
|
||||
}
|
||||
|
||||
let result = (pnpm generate-changelog | complete)
|
||||
if ($result.stderr | str contains -i "error") or ($result.stderr | str contains -i "failed") or ($result.stderr | str contains -i "command not found") {
|
||||
error make {msg: "Changelog generation failed"}
|
||||
}
|
||||
|
||||
if not ("CHANGELOG.md" | path exists) {
|
||||
error make {msg: "CHANGELOG.md was not created"}
|
||||
}
|
||||
|
||||
let changelog_after = (ls CHANGELOG.md | get modified | first)
|
||||
if $changelog_exists and ($changelog_after <= $changelog_before) {
|
||||
error make {msg: "CHANGELOG.md was not updated"}
|
||||
}
|
||||
}
|
||||
124
scripts/stage-release.sh
Normal file
124
scripts/stage-release.sh
Normal file
@@ -0,0 +1,124 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -uo pipefail
|
||||
|
||||
VERSION_TYPE=${1:-minor}
|
||||
|
||||
# Stage Release
|
||||
# Bumps version, generates changelog, and commits changes
|
||||
|
||||
echo "Staging Release"
|
||||
echo "==============="
|
||||
echo "Version type: $VERSION_TYPE"
|
||||
echo ""
|
||||
|
||||
# Detect version control system
|
||||
if command -v jj &>/dev/null; then
|
||||
VCS="jj"
|
||||
echo "Using jujutsu"
|
||||
elif command -v git &>/dev/null; then
|
||||
VCS="git"
|
||||
echo "Using git"
|
||||
|
||||
# Check for uncommitted changes (git only)
|
||||
if ! git diff-index --quiet HEAD --; then
|
||||
echo "ERROR: You have uncommitted changes. Please commit or stash them first."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "ERROR: No version control system found (git or jujutsu required)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
# Bump version in package.json WITHOUT committing or tagging
|
||||
echo "[1/5] Bumping version in package.json..."
|
||||
npm version $VERSION_TYPE --no-git-tag-version
|
||||
|
||||
# Get the new version
|
||||
NEW_VERSION=$(node -p "require('./package.json').version")
|
||||
echo " New version: $NEW_VERSION"
|
||||
|
||||
# Generate changelog
|
||||
echo ""
|
||||
echo "[2/5] Generating changelog with new version..."
|
||||
|
||||
if [ -f CHANGELOG.md ]; then
|
||||
CHANGELOG_BEFORE=$(stat -c %Y CHANGELOG.md 2>/dev/null || stat -f %m CHANGELOG.md 2>/dev/null)
|
||||
else
|
||||
CHANGELOG_BEFORE=0
|
||||
fi
|
||||
|
||||
TEMP_CHANGELOG=$(mktemp)
|
||||
trap "rm -f $TEMP_CHANGELOG" EXIT
|
||||
|
||||
FORCE_COLOR=1 pnpm generate-changelog 2>&1 | tee "$TEMP_CHANGELOG"
|
||||
|
||||
if grep -qi "error\|failed\|command not found" "$TEMP_CHANGELOG"; then
|
||||
echo ""
|
||||
echo "ERROR: Changelog generation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -f CHANGELOG.md ]; then
|
||||
CHANGELOG_AFTER=$(stat -c %Y CHANGELOG.md 2>/dev/null || stat -f %m CHANGELOG.md 2>/dev/null)
|
||||
if [ "$CHANGELOG_AFTER" -le "$CHANGELOG_BEFORE" ]; then
|
||||
echo ""
|
||||
echo "ERROR: CHANGELOG.md was not updated"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo ""
|
||||
echo "ERROR: CHANGELOG.md was not created"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Commit changes
|
||||
echo ""
|
||||
echo "[3/5] Committing changes..."
|
||||
|
||||
if [ "$VCS" = "jj" ]; then
|
||||
jj commit -m "chore: release v$NEW_VERSION"
|
||||
echo " Commit created"
|
||||
else
|
||||
git add package.json package-lock.json CHANGELOG.md
|
||||
git commit -m "chore: release v$NEW_VERSION"
|
||||
echo " Commit created"
|
||||
fi
|
||||
|
||||
# Update main bookmark (jujutsu only)
|
||||
if [ "$VCS" = "jj" ]; then
|
||||
echo ""
|
||||
echo "[4/5] Updating main bookmark..."
|
||||
jj bookmark set main -r @
|
||||
echo " Bookmark 'main' updated to current commit"
|
||||
fi
|
||||
|
||||
# Create tag
|
||||
echo ""
|
||||
if [ "$VCS" = "jj" ]; then
|
||||
echo "[5/5] Creating annotated tag via git..."
|
||||
# Jujutsu doesn't support annotated tags yet, so we use git
|
||||
jj git export
|
||||
git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
|
||||
jj git import
|
||||
echo " Annotated tag 'v$NEW_VERSION' created via git"
|
||||
else
|
||||
echo "[5/5] Creating annotated tag..."
|
||||
git tag -a "v$NEW_VERSION" -m "Release v$NEW_VERSION"
|
||||
echo " Annotated tag 'v$NEW_VERSION' created"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Release v$NEW_VERSION staged successfully!"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
if [ "$VCS" = "jj" ]; then
|
||||
echo " - Review changes: jj show @-"
|
||||
echo " - Push to remote: jj git push && git push --tags"
|
||||
else
|
||||
echo " - Review changes: git show"
|
||||
echo " - Push to remote: git push && git push --tags"
|
||||
fi
|
||||
echo " - Publish release: ./publish-release.sh"
|
||||
10
shell.nix
Normal file
10
shell.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
(import (
|
||||
let
|
||||
rev = "v1.1.0";
|
||||
sha256 = "sha256:19d2z6xsvpxm184m41qrpi1bplilwipgnzv9jy17fgw421785q1m";
|
||||
in
|
||||
fetchTarball {
|
||||
inherit sha256;
|
||||
url = "https://github.com/NixOS/flake-compat/archive/${rev}.tar.gz";
|
||||
}
|
||||
) { src = ./.; }).shellNix
|
||||
BIN
src/assets/LD-icon-new.png
Normal file
BIN
src/assets/LD-icon-new.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 188 KiB |
5075
src/assets/UT-Map.svg
Normal file
5075
src/assets/UT-Map.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 347 KiB |
@@ -8,15 +8,27 @@ const splashText: string[] = [
|
||||
'The squirrels, they have mastered begging for food better than students. Impressive... but worrying.',
|
||||
"Do you study often? Ha! What am I saying? Of course you don't.",
|
||||
"Hey, you, you're finally awake. You were trying to skip class right?",
|
||||
'Mmm... Brutalist architecture...',
|
||||
'The course syllabus: more than meets the eye',
|
||||
'Pain is temporary, GPA is forever.',
|
||||
"You've Yee'd Your Last Haw.",
|
||||
'lol everything is already waitlisted.',
|
||||
'Could be worse. Could be A&M.',
|
||||
"Should you major in Compsci? well, here's a better question. do you wanna have a bad time?",
|
||||
'A pen and paper is old fashioned, but sometimes old ways are best',
|
||||
'A heart is like bedrock, destroyable only by cheating',
|
||||
'You may not rest now, there are Canvas assignments nearby',
|
||||
'You are filled with DETERMINATION',
|
||||
'60k+ users!',
|
||||
'Almost Turing complete',
|
||||
'#BF5700',
|
||||
'The waitlist is a lie!',
|
||||
'BEVO JOCKEY 🗣️🗣️🗣️',
|
||||
'RIP Domino, you beloved campus feline.',
|
||||
"The year is 2055 and Welch still isn't finished.",
|
||||
'Motivation dropping faster than ur GPA',
|
||||
'No Work Happens On PCL 5th Floor.',
|
||||
'I may be a sophomore in name, but my credit count screams freshman!',
|
||||
'Pain is temporary, GPA is forever.',
|
||||
"You've Yee'd Your Last Haw.",
|
||||
'lol everything is already waitlisted.',
|
||||
'Could be worse. Could be A&M.',
|
||||
// 'TeXAs iS BaCK GuYZ',
|
||||
'mAke iT yOuR tExAS',
|
||||
'change yOur slogan',
|
||||
@@ -24,7 +36,7 @@ const splashText: string[] = [
|
||||
'Does McCombs teach Parseltongue?',
|
||||
'No Cruce Enfrente Del Bus.',
|
||||
'Omae Wa Mou Shindeiru...',
|
||||
'Every day another brick disappears from Speedway',
|
||||
"They say each day, another brick disappears from Speedway. No one's sure where to.",
|
||||
'The GDC will annex the EER one day',
|
||||
'To hike to Kins or not to hike to Kins...',
|
||||
"C'mon you Longhorns! You want to study forever?",
|
||||
@@ -34,15 +46,11 @@ const splashText: string[] = [
|
||||
"The Block of Butter incident of '22",
|
||||
'Begun, the midterms have.',
|
||||
'You must construct additional schedules',
|
||||
"Arrows of Christ vs Church of Scientology was the crossover we didn't know we needed",
|
||||
'THE WALK SIGN IS ON TO CROSS GUADALUPE AND 21ST',
|
||||
'Pay attention. Might learn something.',
|
||||
'Long ago, apartment rates lived together in harmony. Then, everything changed when American Campus Communities Inc attacked.',
|
||||
'Roll for Initiative!',
|
||||
'The line at the on-campus Starbucks is longer than your course waitlist.',
|
||||
'The weather changes more often than your class schedule.',
|
||||
'Mmm... Brutalist architecture...',
|
||||
'The course syllabus: more than meets the eye',
|
||||
"'studying' often means refreshing Canvas every five minutes to see if the professor posted lecture slides.",
|
||||
"It's over Bevo! I have the high ground!",
|
||||
"I'll just skip this lecture and watch the recording later. What's the worst that could happen?",
|
||||
@@ -59,23 +67,15 @@ const splashText: string[] = [
|
||||
'follow @sghsri!',
|
||||
'Officially part of the SEC',
|
||||
'Planner is now acquired by Plus',
|
||||
'Longhorn-Developers is the best UT Student Org',
|
||||
'Longhorn Developers is the best UT Student Org',
|
||||
'The Eiffel Tower is the UT Tower of Paris',
|
||||
'A pen and paper is old fashioned, but sometimes old ways are best',
|
||||
'A heart is like bedrock, destroyable only by cheating',
|
||||
'You may not rest now, there are Canvas assignments nearby',
|
||||
'You are filled with DETERMINATION',
|
||||
'60k+ users!',
|
||||
'Almost Turing complete',
|
||||
'#BF5700',
|
||||
'The waitlist is a lie!',
|
||||
`He's a CS Major, but he showers regularly. 🧢`,
|
||||
"He's a CS Major, but he showers regularly. 🧢",
|
||||
'A CS major walks into a bar. The bar is empty because it is a CS major.',
|
||||
'UT Registration Plus - The only thing that can make registration worse is not having it',
|
||||
'UT Registration Plus - We make registration slightly less painful. Slightly.',
|
||||
'UT Registration Plus - Do you really want to figure out which professors will ruin your GPA by yourself?',
|
||||
'Ayo tf is a memory leak',
|
||||
"lowkey we never thought we'd get this far, how tf are 60k of you people using this",
|
||||
"Ayo what's is a memory leak",
|
||||
"lowkey we never thought we'd get this far, how are 60k of you people using this",
|
||||
"dang we're really out here making a splash",
|
||||
"We'd make a joke about A&M, but we're not sure they can read",
|
||||
"We've only caused one or two outages, we swear!",
|
||||
@@ -113,8 +113,7 @@ const splashText: string[] = [
|
||||
"Stop trying to make UTRP happen, it's not going to happen!",
|
||||
'Befriend the raccoons on campus',
|
||||
`It's ${new Date().toLocaleString('en-US', { month: 'long', day: 'numeric' })} and OU still sucks`,
|
||||
'As seen on TV! ',
|
||||
"Should you major in Compsci? well, here's a better question. do you wanna have a bad time?",
|
||||
'As seen on TV!',
|
||||
];
|
||||
|
||||
export default splashText;
|
||||
|
||||
8
src/lib/chrome-extension-toolkit/README.md
Normal file
8
src/lib/chrome-extension-toolkit/README.md
Normal file
@@ -0,0 +1,8 @@
|
||||
# chrome-extension-toolkit
|
||||
|
||||
Repo: https://github.com/sghsri/chrome-extension-toolkit
|
||||
Author: sghsri
|
||||
License: MIT
|
||||
Version: 0.0.96
|
||||
|
||||
This library has been inlined into UTRP due to the package being removed from npm.
|
||||
@@ -0,0 +1,62 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
const containerStyle: React.CSSProperties = {
|
||||
position: 'fixed',
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
padding: '8px',
|
||||
fontSize: '20px',
|
||||
textAlign: 'center',
|
||||
borderTopLeftRadius: '20px',
|
||||
borderTopRightRadius: '20px',
|
||||
zIndex: 999999999999,
|
||||
cursor: 'pointer',
|
||||
};
|
||||
|
||||
const closeButtonStyle: React.CSSProperties = {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
padding: '8px',
|
||||
paddingRight: '20px',
|
||||
fontSize: '20px',
|
||||
cursor: 'pointer',
|
||||
};
|
||||
|
||||
interface Props {
|
||||
className?: string;
|
||||
onClick?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* A component that displays a message onto a content script when the context extension is invalidated.
|
||||
*/
|
||||
export function ContextInvalidated(props: Props): JSX.Element | null {
|
||||
const [isShowing, setIsShowing] = useState(true);
|
||||
|
||||
const hide = (e: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
|
||||
e.stopPropagation();
|
||||
setIsShowing(false);
|
||||
};
|
||||
|
||||
const reload = () => {
|
||||
window.location.reload();
|
||||
};
|
||||
|
||||
return isShowing ? (
|
||||
<div
|
||||
style={{
|
||||
...containerStyle,
|
||||
}}
|
||||
id='extension-context-invalidated'
|
||||
className={props.className}
|
||||
onClick={props.onClick ?? reload}
|
||||
>
|
||||
Context Extension Context invalidated. Click to reload
|
||||
<div style={closeButtonStyle} onClick={hide}>
|
||||
✕
|
||||
</div>
|
||||
</div>
|
||||
) : null;
|
||||
}
|
||||
2
src/lib/chrome-extension-toolkit/context/index.ts
Normal file
2
src/lib/chrome-extension-toolkit/context/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './ContextInvalidated';
|
||||
export * from './onContextInvalidated';
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* A content script can be invalidated if a chrome extension is reloaded / updated.
|
||||
* This function is used to detect when the extension's context has been invalidated, and to call a callback.
|
||||
* @param callback A callback to be called when the extension's context has been invalidated
|
||||
*/
|
||||
export function onContextInvalidated(callback: () => void) {
|
||||
const interval = setInterval(() => {
|
||||
// this means the current tab's context has been invalidated
|
||||
if (!chrome.runtime.id) {
|
||||
clearInterval(interval);
|
||||
callback();
|
||||
}
|
||||
}, 1 * 1000);
|
||||
}
|
||||
55
src/lib/chrome-extension-toolkit/dom/createShadowRoot.ts
Normal file
55
src/lib/chrome-extension-toolkit/dom/createShadowRoot.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* An extension of HTMLDivElement that represents a shadow root for use within an Extension Content Script.
|
||||
*/
|
||||
interface HTMLShadowDOMElement extends HTMLDivElement {
|
||||
shadowRoot: ShadowRoot & {
|
||||
INJECTION_POINT: HTMLDivElement;
|
||||
};
|
||||
/**
|
||||
* Adds a style sheet to the shadow root.
|
||||
* @param path the path to the style sheet relative to the extension's root directory. uses chrome.runtime.getURL to get the absolute path.
|
||||
*/
|
||||
addStyle(path: string): Promise<void>;
|
||||
}
|
||||
|
||||
/**
|
||||
* In extension content scripts, often times the parent site's styles will override the styles of the extension.
|
||||
* To get around this, we create a shadow DOM and isolate the extension's html and styles in the shadow DOM.
|
||||
* from the parent site's styles to prevent conflicts.
|
||||
* @param id the id of the shadow root.
|
||||
* @param options the optional options for the shadow root.
|
||||
* @param isolate whether or not to isolate the extension's document flow from the parent site's document flow.
|
||||
* @returns A Div that represents the shadow root with some additional methods added to it.
|
||||
*/
|
||||
export function createShadowDOM(id: string, options?: ShadowRootInit, isolate = false): HTMLShadowDOMElement {
|
||||
const html = document.querySelector('html');
|
||||
if (!html) {
|
||||
throw new Error('Could not find html element');
|
||||
}
|
||||
const div = document.createElement('div') as HTMLShadowDOMElement;
|
||||
div.id = id;
|
||||
div.style.all = 'initial';
|
||||
div.attachShadow({
|
||||
mode: 'open',
|
||||
...(options || {}),
|
||||
});
|
||||
|
||||
const INJECTION_POINT = document.createElement('div');
|
||||
INJECTION_POINT.id = 'INJECTION_POINT';
|
||||
div.shadowRoot.appendChild(INJECTION_POINT);
|
||||
div.shadowRoot.INJECTION_POINT = INJECTION_POINT;
|
||||
|
||||
div.addStyle = async (path: string) => {
|
||||
const style = await fetch(chrome.runtime.getURL(path));
|
||||
const styleNode = document.createElement('style');
|
||||
const parsedStyle = await style.text();
|
||||
styleNode.textContent = parsedStyle;
|
||||
div.shadowRoot.appendChild(styleNode);
|
||||
};
|
||||
|
||||
html.appendChild(div);
|
||||
|
||||
if (isolate) document.body.style.isolation = 'isolate';
|
||||
|
||||
return div as HTMLShadowDOMElement;
|
||||
}
|
||||
1
src/lib/chrome-extension-toolkit/dom/index.ts
Normal file
1
src/lib/chrome-extension-toolkit/dom/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './createShadowRoot';
|
||||
70
src/lib/chrome-extension-toolkit/getScriptType.ts
Normal file
70
src/lib/chrome-extension-toolkit/getScriptType.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
/**
|
||||
* Possible contexts in which a chrome extension can run.
|
||||
*/
|
||||
export enum ScriptType {
|
||||
CONTENT_SCRIPT = 'content_script',
|
||||
BACKGROUND_SCRIPT = 'background_script',
|
||||
EXTENSION_POPUP = 'extension_popup',
|
||||
EXTENSION_PAGE = 'extension_page',
|
||||
}
|
||||
|
||||
/**
|
||||
* Chrome extension code can run in different contexts.
|
||||
* These different contexts have different capabilities and access to certain parts of the chrome extensions API.
|
||||
* For example, the chrome.tabs api is not readily available in the content scripts.
|
||||
* This function is used to identify the context in which the code is running.
|
||||
* @returns The context in which the code is running, or null if the code is not running in a chrome extension.
|
||||
*/
|
||||
export default function getScriptType(): ScriptType | null {
|
||||
if (!chrome?.runtime?.id) {
|
||||
// we are not in a chrome extension
|
||||
return null;
|
||||
}
|
||||
const manifest = chrome.runtime.getManifest();
|
||||
if (globalThis.window === undefined) {
|
||||
return ScriptType.BACKGROUND_SCRIPT;
|
||||
}
|
||||
|
||||
if (window.location.href.startsWith(`chrome-extension://${chrome.runtime.id}`)) {
|
||||
if (manifest.action?.default_popup && window.location.href.includes(manifest.action.default_popup)) {
|
||||
return ScriptType.EXTENSION_POPUP;
|
||||
}
|
||||
return ScriptType.EXTENSION_PAGE;
|
||||
}
|
||||
|
||||
return ScriptType.CONTENT_SCRIPT;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function to check if the code is running in a content script.
|
||||
* @returns true if the code is running in a content script, false otherwise.
|
||||
*/
|
||||
export function isContentScript(): boolean {
|
||||
return getScriptType() === ScriptType.CONTENT_SCRIPT;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function to check if the code is running in the background script.
|
||||
* @returns true if the code is running in the background script, false otherwise.
|
||||
*/
|
||||
export function isBackgroundScript(): boolean {
|
||||
return getScriptType() === ScriptType.BACKGROUND_SCRIPT;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function to check if the code is running in the extension popup.
|
||||
* @returns true if the code is running in the extension popup, false otherwise.
|
||||
*/
|
||||
export function isExtensionPopup(): boolean {
|
||||
return getScriptType() === ScriptType.EXTENSION_POPUP;
|
||||
}
|
||||
|
||||
/**
|
||||
* A helper function to check if the code is running in an extension page (popup, options, etc.).
|
||||
* @returns true if the code is running in an extension page (popup, options, etc.), false otherwise.
|
||||
* @param pageName The name of the page to check for. ex: 'options.html'
|
||||
*/
|
||||
export function isExtensionPage(pageName?: string): boolean {
|
||||
const isPage = getScriptType() === ScriptType.EXTENSION_PAGE;
|
||||
return isPage && pageName ? window.location.href.includes(pageName) : isPage;
|
||||
}
|
||||
6
src/lib/chrome-extension-toolkit/index.ts
Normal file
6
src/lib/chrome-extension-toolkit/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './context';
|
||||
export * from './dom';
|
||||
export * from './getScriptType';
|
||||
export * from './messaging';
|
||||
export * from './storage';
|
||||
export * from './types';
|
||||
127
src/lib/chrome-extension-toolkit/messaging/MessageListener.ts
Normal file
127
src/lib/chrome-extension-toolkit/messaging/MessageListener.ts
Normal file
@@ -0,0 +1,127 @@
|
||||
import getScriptType, { ScriptType } from '../getScriptType';
|
||||
import type { IMessageListener, Message, MessageHandler, Serializable } from '../types';
|
||||
import { MessageEndpoint } from '../types';
|
||||
|
||||
/**
|
||||
* Options for configuring a message listener.
|
||||
*/
|
||||
export interface MessageListenerOptions {
|
||||
/**
|
||||
* A callback function that will be called when an error occurs.
|
||||
* Useful if you want to log errors to a service like Sentry or Bugsnag.
|
||||
* @param error The error that occurred.
|
||||
*/
|
||||
onError?: (error: Error) => void;
|
||||
|
||||
/**
|
||||
* A flag indicating whether verbose logging should be enabled.
|
||||
*/
|
||||
verbose?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that can be used to listen for and handle messages coming from another extension context.
|
||||
*/
|
||||
export class MessageListener<M> implements IMessageListener<M> {
|
||||
private handlers: MessageHandler<M>;
|
||||
private scriptType: ScriptType;
|
||||
private myEndpoint: MessageEndpoint;
|
||||
private listeningFor: MessageEndpoint;
|
||||
|
||||
private onError?: (error: Error) => void;
|
||||
|
||||
private isVerbose: boolean = false;
|
||||
|
||||
/**
|
||||
* An object that can be used to listen for and handle messages coming from another extension context.
|
||||
* @param handlers the message handlers for the messages that this listener will handle. When a message is received, the corresponding message handler is called.
|
||||
*/
|
||||
constructor(handlers: MessageHandler<M>) {
|
||||
this.handlers = handlers;
|
||||
|
||||
// we want to know what type of script we are running in so we can determine what endpoint we are (background or foreground)
|
||||
const scriptType = getScriptType();
|
||||
if (!scriptType) {
|
||||
throw new Error('[crx-kit]: Unable to determine extension script type.');
|
||||
}
|
||||
this.scriptType = scriptType;
|
||||
|
||||
if (this.scriptType === ScriptType.BACKGROUND_SCRIPT) {
|
||||
this.myEndpoint = MessageEndpoint.BACKGROUND;
|
||||
this.listeningFor = MessageEndpoint.FOREGROUND;
|
||||
} else {
|
||||
this.myEndpoint = MessageEndpoint.FOREGROUND;
|
||||
this.listeningFor = MessageEndpoint.BACKGROUND;
|
||||
}
|
||||
}
|
||||
|
||||
private handleMessage = (
|
||||
message: Message<M>,
|
||||
sender: chrome.runtime.MessageSender,
|
||||
sendResponse: (response: any) => void
|
||||
): boolean => {
|
||||
if (message.to !== this.myEndpoint && message.from !== this.listeningFor) {
|
||||
// this message is not for my current context, so ignore it
|
||||
return true;
|
||||
}
|
||||
const messageName = message.name as string;
|
||||
|
||||
// @ts-expect-error
|
||||
const handler = this.handlers[messageName];
|
||||
if (!handler) {
|
||||
// this message is for my current context, but I don't have a handler for it, so ignore it
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
if (this.isVerbose) {
|
||||
console.log(`[crx-kit]: message received: ${messageName}`, {
|
||||
name: messageName,
|
||||
data: message.data,
|
||||
sender,
|
||||
});
|
||||
}
|
||||
// this message is for my current context, and I have a handler for it, so handle it
|
||||
handler({
|
||||
data: message.data as Serializable<typeof message.data>,
|
||||
sendResponse,
|
||||
sender,
|
||||
});
|
||||
} catch (error) {
|
||||
console.error(`[crx-kit]: Error handling message ${messageName}`, {
|
||||
name: messageName,
|
||||
error,
|
||||
message,
|
||||
sender,
|
||||
});
|
||||
if (this.onError) {
|
||||
// @ts-expect-error
|
||||
this.onError(error);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
/**
|
||||
* Listens for messages from the specified source.
|
||||
* @param options - The options for the message listener.
|
||||
*/
|
||||
public listen(options: MessageListenerOptions = { verbose: false }) {
|
||||
this.isVerbose = options.verbose ?? false;
|
||||
this.onError = options.onError;
|
||||
console.log(`[crx-kit]: ${this.toString()} listening for messages from ${this.listeningFor}`);
|
||||
chrome.runtime.onMessage.addListener(this.handleMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stops listening for messages
|
||||
*/
|
||||
public unlisten() {
|
||||
console.log(`[crx-kit]: ${this.toString()} no longer listening for messages from ${this.listeningFor}`);
|
||||
chrome.runtime.onMessage.removeListener(this.handleMessage);
|
||||
}
|
||||
|
||||
private toString() {
|
||||
return `MessageListener(${this.myEndpoint})`;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
import type { Message, MessageData, MessageResponse } from '../types';
|
||||
import { MessageEndpoint } from '../types';
|
||||
/**
|
||||
* An object that can be used to send messages to the background script.
|
||||
*/ export type BackgroundMessenger<M> = {
|
||||
[K in keyof M]: MessageData<M, K> extends undefined
|
||||
? () => Promise<MessageResponse<M, K>>
|
||||
: (data: MessageData<M, K>) => Promise<MessageResponse<M, K>>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Where the foreground message is being sent to specifically (which tab or frame)
|
||||
*/
|
||||
type ForegroundMessageOptions =
|
||||
| {
|
||||
tabId: number;
|
||||
frameId?: number;
|
||||
}
|
||||
| {
|
||||
tabId: 'ALL' | 'ACTIVE_TAB';
|
||||
};
|
||||
|
||||
/**
|
||||
* an object that can be used to send messages to the foreground (tabs OR extension pages (popup, options, etc.))
|
||||
*/
|
||||
export type ForegroundMessenger<M> = {
|
||||
[K in keyof M]: MessageData<M, K> extends undefined
|
||||
? (options: ForegroundMessageOptions) => Promise<MessageResponse<M, K>>
|
||||
: (data: MessageData<M, K>, options: ForegroundMessageOptions) => Promise<MessageResponse<M, K>>;
|
||||
};
|
||||
|
||||
/**
|
||||
* A wrapper for chrome extension messaging with a type-safe API.
|
||||
* @type To which context the messages are sent.
|
||||
* @returns A proxy object that can be used to send messages to the foreground (tabs or extension pages (popup, options, etc.))
|
||||
*/
|
||||
export function createMessenger<M>(destination: 'foreground'): ForegroundMessenger<M>;
|
||||
/**
|
||||
* A wrapper for chrome extension messaging with a type-safe API.
|
||||
* @param type To which context the messages are sent.
|
||||
* @returns A proxy object that can be used to send messages to the background script.
|
||||
*/
|
||||
export function createMessenger<M>(destination: 'background'): BackgroundMessenger<M>;
|
||||
/**
|
||||
* A wrapper for chrome extension messaging with a type-safe API.
|
||||
* @param destination To which context the messages are sent.
|
||||
* @returns A proxy object that can be used to send messages to the background script.
|
||||
*/
|
||||
export function createMessenger<M>(destination: 'background' | 'foreground') {
|
||||
let to: MessageEndpoint = MessageEndpoint.BACKGROUND;
|
||||
let from: MessageEndpoint = MessageEndpoint.FOREGROUND;
|
||||
|
||||
if (destination === 'foreground') {
|
||||
to = MessageEndpoint.FOREGROUND;
|
||||
from = MessageEndpoint.BACKGROUND;
|
||||
}
|
||||
|
||||
const sender = new Proxy({} as any, {
|
||||
get(target, prop) {
|
||||
const name = prop as keyof M;
|
||||
return async (data: MessageData<M, any>, options?: ForegroundMessageOptions) => {
|
||||
const message: Message<M> = {
|
||||
name,
|
||||
data,
|
||||
from,
|
||||
to,
|
||||
};
|
||||
|
||||
if (to === MessageEndpoint.FOREGROUND && options) {
|
||||
// for messages sent to the tabs, we want to send to the tabs using chrome.tabs.sendMessage,
|
||||
const { tabId } = options;
|
||||
if (typeof tabId === 'number') {
|
||||
return chrome.tabs.sendMessage(tabId, message, { frameId: options.frameId });
|
||||
}
|
||||
if (tabId === 'ACTIVE_TAB') {
|
||||
const tab = (await chrome.tabs.query({ active: true, currentWindow: true }))[0];
|
||||
if (tab && tab.id) {
|
||||
return chrome.tabs.sendMessage(tab.id, message);
|
||||
}
|
||||
}
|
||||
if (tabId === 'ALL') {
|
||||
const tabs = (await chrome.tabs.query({})).filter(tab => tab.id !== undefined && tab.url);
|
||||
return Promise.any([
|
||||
...tabs.map(tab => chrome.tabs.sendMessage(tab.id!, message)),
|
||||
chrome.runtime.sendMessage(message),
|
||||
]);
|
||||
}
|
||||
}
|
||||
return chrome.runtime.sendMessage(message);
|
||||
};
|
||||
},
|
||||
});
|
||||
return sender;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import { useEffect } from 'react';
|
||||
|
||||
import type { Message, MessageData } from '../types';
|
||||
|
||||
/**
|
||||
* A helper function to create a hook that can listen for messages coming through chrome.runtime.onMessage
|
||||
* with e2e type safety
|
||||
* @returns a hook that can be used to listen for messages from the background script.
|
||||
*/
|
||||
export function createUseMessage<M>() {
|
||||
return function useMessage<N extends keyof M, D extends MessageData<M, N>>(
|
||||
name: N,
|
||||
callback: (data: D) => void
|
||||
): void {
|
||||
useEffect(() => {
|
||||
const onMessage = (message: Message<M>) => {
|
||||
if (message.name === name) {
|
||||
callback(message.data);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
chrome.runtime.onMessage.addListener(onMessage);
|
||||
|
||||
return () => {
|
||||
chrome.runtime.onMessage.removeListener(onMessage);
|
||||
};
|
||||
}, [name, callback]);
|
||||
};
|
||||
}
|
||||
3
src/lib/chrome-extension-toolkit/messaging/index.ts
Normal file
3
src/lib/chrome-extension-toolkit/messaging/index.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from './createMessenger';
|
||||
export * from './createUseMessage';
|
||||
export * from './MessageListener';
|
||||
15
src/lib/chrome-extension-toolkit/modules.d.ts
vendored
Normal file
15
src/lib/chrome-extension-toolkit/modules.d.ts
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
declare global {
|
||||
namespace NodeJS {
|
||||
interface ProcessEnv {
|
||||
NODE_ENV: 'development' | 'production' | 'test';
|
||||
CI?: string;
|
||||
EXTENSION_STORAGE_PASSWORD?: string;
|
||||
}
|
||||
}
|
||||
|
||||
type Environment = typeof process.env.NODE_ENV;
|
||||
}
|
||||
|
||||
// If this file has no import/export statements (i.e. is a script)
|
||||
// convert it into a module by adding an empty export statement.
|
||||
export {};
|
||||
214
src/lib/chrome-extension-toolkit/storage/Security.ts
Normal file
214
src/lib/chrome-extension-toolkit/storage/Security.ts
Normal file
@@ -0,0 +1,214 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
const { crypto } = globalThis;
|
||||
|
||||
/** the number of times the key_algo will be run on the password */
|
||||
const ITERATIONS = 470_000;
|
||||
/** the algorithm used to derive the password key from the password */
|
||||
const KEY_ALGO = 'PBKDF2';
|
||||
/** the algorithm used to derive the cipher key from the password key */
|
||||
const HASH_ALGO = 'SHA-256';
|
||||
/** the algorithm used to encrypt the data */
|
||||
const CIPHER_MODE = 'AES-GCM';
|
||||
|
||||
/** the size of the cipher key */
|
||||
const CIPHER_SIZE = 256;
|
||||
|
||||
/**
|
||||
* A class that provides encryption and decryption methods for use when storing data in the Stores provided by this library.
|
||||
*/
|
||||
export class Security {
|
||||
private encoder = new TextEncoder();
|
||||
private decoder = new TextDecoder();
|
||||
|
||||
private cachedPasswordKey?: CryptoKey;
|
||||
|
||||
public static MISSING_PASSWORD_ERROR_MESSAGE =
|
||||
'You must set the EXTENSION_STORAGE_PASSWORD environment variable to use encrypted storage.';
|
||||
|
||||
/**
|
||||
* @returns the password key, either from the cache or by generating a new one from the password environment variable
|
||||
*/
|
||||
private async getPasswordKey(): Promise<CryptoKey> {
|
||||
if (this.cachedPasswordKey) return this.cachedPasswordKey;
|
||||
|
||||
if (!process.env.EXTENSION_STORAGE_PASSWORD) {
|
||||
throw new Error(Security.MISSING_PASSWORD_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
const passwordBuffer = this.encoder.encode(process.env.EXTENSION_STORAGE_PASSWORD);
|
||||
this.cachedPasswordKey = await crypto.subtle.importKey(
|
||||
'raw',
|
||||
passwordBuffer,
|
||||
{ name: KEY_ALGO },
|
||||
false, // Not exportable
|
||||
['deriveKey']
|
||||
);
|
||||
return this.cachedPasswordKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* Derives a cipher key from the password key and salt
|
||||
* @param salt the salt to use when deriving the cipher key
|
||||
* @param passKey the password key to use when deriving the cipher key
|
||||
* @param KeyUsage the key usage for the cipher key (encrypt or decrypt)
|
||||
* @returns the cipher key which can be used to encrypt or decrypt data
|
||||
*/
|
||||
private async deriveCipherKey(salt: Uint8Array, passKey: CryptoKey, KeyUsage: KeyUsage[]): Promise<CryptoKey> {
|
||||
return crypto.subtle.deriveKey(
|
||||
{
|
||||
name: KEY_ALGO,
|
||||
hash: HASH_ALGO,
|
||||
salt,
|
||||
iterations: ITERATIONS,
|
||||
},
|
||||
passKey,
|
||||
{
|
||||
name: CIPHER_MODE,
|
||||
length: CIPHER_SIZE,
|
||||
},
|
||||
false,
|
||||
KeyUsage
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns a random salt buffer for use in encryption
|
||||
*/
|
||||
private deriveSalt(): Uint8Array {
|
||||
return crypto.getRandomValues(new Uint8Array(BoxBuffer.SALT_SIZE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns a random IV buffer for use in encryption
|
||||
*/
|
||||
private deriveIv(): Uint8Array {
|
||||
return crypto.getRandomValues(new Uint8Array(BoxBuffer.IV_SIZE));
|
||||
}
|
||||
|
||||
/**
|
||||
* Decrypts a value that has been encrypted using the encrypt method
|
||||
* @param value the encrypted value to decrypt
|
||||
* @returns the decrypted value
|
||||
*/
|
||||
async decrypt(value: any) {
|
||||
if (!value) return value;
|
||||
if (!isString(value)) return value;
|
||||
|
||||
const passKey = await this.getPasswordKey();
|
||||
|
||||
// read in the string into a boxBuffer, and separate the salt, iv and encrypted data from it
|
||||
const boxBuffer = BoxBuffer.fromBase64String(value);
|
||||
const salt = boxBuffer.getSalt();
|
||||
const iv = boxBuffer.getIv();
|
||||
const encryptedData = boxBuffer.getEncryptedData();
|
||||
|
||||
// generate the decryption key
|
||||
const decryptionKey = await this.deriveCipherKey(salt, passKey, ['decrypt']);
|
||||
|
||||
// decrypt the data using the decryption key
|
||||
const decryptedDataBuffer = await crypto.subtle.decrypt(
|
||||
{
|
||||
name: CIPHER_MODE,
|
||||
iv,
|
||||
},
|
||||
decryptionKey,
|
||||
encryptedData
|
||||
);
|
||||
|
||||
// parse the decrypted data into a JSON object and return it
|
||||
return decryptedDataBuffer.byteLength === 0 ? undefined : JSON.parse(this.decoder.decode(decryptedDataBuffer));
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypts a value using the password key derived from the EXTENSION_STORAGE_PASSWORD environment variable
|
||||
* @param value the value to encrypt
|
||||
* @returns the encrypted value as a base64 string
|
||||
*/
|
||||
async encrypt(value: any): Promise<string> {
|
||||
let valueString = JSON.stringify(value);
|
||||
|
||||
const passKey = await this.getPasswordKey();
|
||||
|
||||
const salt = this.deriveSalt();
|
||||
const iv = this.deriveIv();
|
||||
|
||||
const encryptionKey = await this.deriveCipherKey(salt, passKey, ['encrypt']);
|
||||
|
||||
const encryptedData = new Uint8Array(
|
||||
await crypto.subtle.encrypt(
|
||||
{
|
||||
name: CIPHER_MODE,
|
||||
iv,
|
||||
},
|
||||
encryptionKey,
|
||||
this.encoder.encode(valueString)
|
||||
)
|
||||
);
|
||||
|
||||
// create a boxBuffer to store the salt, iv and encrypted data together in a single buffer
|
||||
const bufferSize = BoxBuffer.PREFIX_SIZE + encryptedData.byteLength;
|
||||
|
||||
const boxBuffer = new BoxBuffer(new Uint8Array(bufferSize));
|
||||
boxBuffer.setSalt(salt);
|
||||
boxBuffer.setIv(iv);
|
||||
boxBuffer.setEncryptedData(encryptedData);
|
||||
|
||||
// return the boxBuffer as a base64 string (to make it easier to store)
|
||||
return boxBuffer.toBase64String();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A class representation of a buffer box in memory of the form:
|
||||
* [salt][iv][encrypted data]
|
||||
*/
|
||||
class BoxBuffer {
|
||||
private buffer: Uint8Array;
|
||||
static SALT_SIZE = 16;
|
||||
static IV_SIZE = 32;
|
||||
|
||||
static get PREFIX_SIZE() {
|
||||
return BoxBuffer.SALT_SIZE + BoxBuffer.IV_SIZE;
|
||||
}
|
||||
|
||||
constructor(buffer: Uint8Array) {
|
||||
this.buffer = buffer;
|
||||
}
|
||||
|
||||
setSalt(salt: Uint8Array) {
|
||||
this.buffer.set(salt, 0);
|
||||
}
|
||||
|
||||
setIv(iv: Uint8Array) {
|
||||
this.buffer.set(iv, BoxBuffer.SALT_SIZE);
|
||||
}
|
||||
|
||||
setEncryptedData(encryptedData: Uint8Array) {
|
||||
this.buffer.set(encryptedData, BoxBuffer.PREFIX_SIZE);
|
||||
}
|
||||
|
||||
getSalt(): Uint8Array {
|
||||
return this.buffer.slice(0, BoxBuffer.SALT_SIZE);
|
||||
}
|
||||
|
||||
getIv(): Uint8Array {
|
||||
return this.buffer.slice(BoxBuffer.SALT_SIZE, BoxBuffer.PREFIX_SIZE);
|
||||
}
|
||||
|
||||
getEncryptedData(): Uint8Array {
|
||||
return this.buffer.slice(BoxBuffer.PREFIX_SIZE);
|
||||
}
|
||||
|
||||
toBase64String() {
|
||||
return globalThis.btoa(String.fromCharCode.apply(null, this.buffer as any));
|
||||
}
|
||||
|
||||
static fromBase64String(base64String: string): BoxBuffer {
|
||||
const rawBuffer = Uint8Array.from(globalThis.atob(base64String), c => c.charCodeAt(0));
|
||||
return new BoxBuffer(rawBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
function isString(value: any): value is string {
|
||||
return typeof value === 'string' || value instanceof String;
|
||||
}
|
||||
447
src/lib/chrome-extension-toolkit/storage/createStore.ts
Normal file
447
src/lib/chrome-extension-toolkit/storage/createStore.ts
Normal file
@@ -0,0 +1,447 @@
|
||||
/* eslint-disable no-await-in-loop */
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import type { Serializable } from '../types';
|
||||
import { Security } from './Security';
|
||||
|
||||
/** A utility type that forces you to declare all the values specified in the type interface for a module. */
|
||||
export type StoreDefaults<T> = {
|
||||
[P in keyof Required<T>]: Pick<T, P> extends Required<Pick<T, P>> ? T[P] : T[P] | undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a change in data within the store.
|
||||
*/
|
||||
export type DataChange<T> = {
|
||||
key: string;
|
||||
/**
|
||||
* The old value of the data. This will be undefined if the data was just initialized.
|
||||
*/
|
||||
oldValue?: Serializable<T>;
|
||||
/**
|
||||
* The new value of the data.
|
||||
*/
|
||||
newValue: Serializable<T>;
|
||||
};
|
||||
|
||||
/**
|
||||
* A function that is called when the data in the store changes.
|
||||
*/
|
||||
export type OnChangedFunction<T> = (changes: DataChange<T>) => void;
|
||||
|
||||
/**
|
||||
* A virtual wrapper around the chrome.storage API that allows you to segment and compartmentalize your data.
|
||||
* The data is all stored at the top level of the storage area, so you should namespace your keys to avoid collisions.
|
||||
*/
|
||||
export type Store<T = {}> = {
|
||||
/**
|
||||
* A unique identifier for the store. This will be prepended to all keys in the store to avoid collisions.
|
||||
*/
|
||||
readonly storeId: string;
|
||||
/**
|
||||
* The options that were passed to the createStore function
|
||||
*/
|
||||
readonly options: StoreOptions;
|
||||
|
||||
/**
|
||||
* The default values for the store. These were passed to the createStore function and will be used to initialize the store if the key is not already set.
|
||||
*/
|
||||
readonly defaults: StoreDefaults<T>;
|
||||
/**
|
||||
* Initializes the store by setting any keys that are not already set to their default values. This will be called automatically when you first access a getter or setter.
|
||||
*/
|
||||
initialize(): Promise<void>;
|
||||
|
||||
/**
|
||||
* Gets the value of the specified key from the store.
|
||||
* @param key the key to get the value of
|
||||
* @returns a promise that resolves to the value of the specified key (wrapped in a Serialized type)
|
||||
*/
|
||||
get<K extends keyof T>(key: K): Promise<Serializable<T[K]>>;
|
||||
|
||||
/**
|
||||
* Sets the value of the specified key in the store.
|
||||
* @param key the key to set the value of
|
||||
* @param value the value to set the key to
|
||||
*/
|
||||
set<K extends keyof T>(key: K, value: Serializable<T[K]>): Promise<void>;
|
||||
|
||||
/**
|
||||
* Sets the store with the values in the object passed in.
|
||||
* @param values an object containing the keys and values to set in the store
|
||||
*/
|
||||
set(values: Partial<Serializable<T>>): Promise<void>;
|
||||
|
||||
/**
|
||||
* Removes a specific key from the store.
|
||||
* @param key the key to remove from the store
|
||||
*/
|
||||
remove<K extends keyof T>(key: K): Promise<void>;
|
||||
|
||||
/**
|
||||
* Returns a promise that resolves to the entire contents of the store.
|
||||
*/
|
||||
all(): Promise<Serializable<T>>;
|
||||
|
||||
/**
|
||||
* Returns an array of all the keys in the store.
|
||||
*/
|
||||
keys(): (keyof T & string)[];
|
||||
|
||||
/**
|
||||
* A react hook that allows you to get and set the value of the specified key in the store from a functional component.
|
||||
* @param key the key to get the value of or null to get the entire store
|
||||
* @returns a tuple containing the value of the specified key, and a function to set the value
|
||||
*/
|
||||
use<K extends keyof T | null>(
|
||||
key: K
|
||||
): [
|
||||
K extends keyof T ? Serializable<T[K]> : Serializable<T>,
|
||||
(value: K extends keyof T ? Serializable<T[K]> : Partial<Serializable<T>>) => Promise<void>,
|
||||
];
|
||||
|
||||
/**
|
||||
* A react hook that allows you to get and set the value of the specified key in the store from a functional component.
|
||||
* @param key the key to get the value of or null to get the entire store
|
||||
* @param defaultValue the default value to use if the key is not already set
|
||||
*/
|
||||
use<K extends keyof T | null>(
|
||||
key: K,
|
||||
defaultValue: K extends keyof T ? Serializable<T[K]> : Serializable<T>
|
||||
): [
|
||||
K extends keyof T ? Serializable<T[K]> : Serializable<T>,
|
||||
(value: K extends keyof T ? Serializable<T[K]> : Partial<Serializable<T>>) => Promise<void>,
|
||||
];
|
||||
|
||||
/**
|
||||
* Subscribes to changes in the specified key in the store, and calls the specified function when the key changes.
|
||||
* @param key the key to subscribe to
|
||||
* @param callback the function to call when the key changes
|
||||
*/
|
||||
// @ts-expect-error
|
||||
subscribe<K extends keyof T>(key: K, callback: OnChangedFunction<T[K]>): (changes, area) => void;
|
||||
// @ts-expect-error
|
||||
subscribe<K extends keyof T>(key: K[], callback: OnChangedFunction<T[K]>): (changes, area) => void;
|
||||
|
||||
/**
|
||||
* Removes a subscription that was added with the subscribe function.
|
||||
* @param sub the subscription function that was added
|
||||
*/
|
||||
// @ts-expect-error
|
||||
unsubscribe(sub: (changes, area) => void): void;
|
||||
};
|
||||
|
||||
/**
|
||||
* Options that modify the behavior of the store
|
||||
*/
|
||||
type StoreOptions = {
|
||||
/**
|
||||
* Whether or not to encrypt the data before storing it, and decrypt it when retrieving it. Defaults to false.
|
||||
*/
|
||||
isEncrypted?: boolean;
|
||||
};
|
||||
|
||||
const security = new Security();
|
||||
|
||||
/**
|
||||
* A function that creates a virtual storage bucket within the chrome.storage API.
|
||||
*
|
||||
* @param defaults the default values for the store (these will be used to initialize the store if the key is not already set, and will be used as the type for the getters and setters)
|
||||
* @param area the storage area to use. Defaults to 'local'
|
||||
* @returns an object which contains getters/setters for the keys in the defaults object, as well as an initialize function and an onChanged functions
|
||||
*/
|
||||
function createStore<T>(
|
||||
storeId: string,
|
||||
defaults: StoreDefaults<T>,
|
||||
area: 'sync' | 'local' | 'session' | 'managed',
|
||||
options?: StoreOptions
|
||||
): Store<T> {
|
||||
const keys = Object.keys(defaults) as string[];
|
||||
const actualKeys = keys.map(key => `${storeId}:${key}`);
|
||||
|
||||
let isEncrypted = options?.isEncrypted || false;
|
||||
|
||||
if (isEncrypted && !process.env.EXTENSION_STORAGE_PASSWORD) {
|
||||
throw new Error(Security.MISSING_PASSWORD_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
const store = {
|
||||
defaults,
|
||||
storeId,
|
||||
options,
|
||||
} as Store<T>;
|
||||
|
||||
let hasInitialized = false;
|
||||
store.initialize = async () => {
|
||||
const data = await chrome.storage[area].get(actualKeys);
|
||||
const missingKeys = actualKeys.filter(key => data[key] === undefined);
|
||||
|
||||
if (missingKeys.length) {
|
||||
const defaultsToSet = {};
|
||||
|
||||
for (const key of missingKeys) {
|
||||
// @ts-expect-error
|
||||
const value = defaults[key.replace(`${storeId}:`, '')];
|
||||
// @ts-expect-error
|
||||
defaultsToSet[key] = isEncrypted ? await security.encrypt(value) : value;
|
||||
}
|
||||
|
||||
await chrome.storage[area].set(defaultsToSet);
|
||||
}
|
||||
hasInitialized = true;
|
||||
};
|
||||
|
||||
store.get = async (key: any) => {
|
||||
if (!hasInitialized) {
|
||||
await store.initialize();
|
||||
}
|
||||
|
||||
const actualKey = `${storeId}:${key}`;
|
||||
|
||||
const value = (await chrome.storage[area].get(actualKey))[actualKey];
|
||||
return isEncrypted ? await security.decrypt(value) : value;
|
||||
};
|
||||
|
||||
store.set = async (key: any, value?: any) => {
|
||||
if (!hasInitialized) {
|
||||
await store.initialize();
|
||||
}
|
||||
|
||||
// Handle the case where key is an object
|
||||
if (typeof key === 'object' && value === undefined) {
|
||||
const entriesToRemove: string[] = [];
|
||||
const entriesToSet = {};
|
||||
|
||||
for (const [k, v] of Object.entries(key)) {
|
||||
const actualKey = `${storeId}:${k}`;
|
||||
if (v === undefined) {
|
||||
// Prepare to remove this key
|
||||
entriesToRemove.push(actualKey);
|
||||
} else {
|
||||
// @ts-expect-error
|
||||
entriesToSet[actualKey] = isEncrypted ? await security.encrypt(v) : v;
|
||||
}
|
||||
}
|
||||
|
||||
// Remove keys with undefined values
|
||||
if (entriesToRemove.length > 0) {
|
||||
await chrome.storage[area].remove(entriesToRemove);
|
||||
}
|
||||
|
||||
// Set keys with defined values
|
||||
if (Object.keys(entriesToSet).length > 0) {
|
||||
await chrome.storage[area].set(entriesToSet);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
// now we know key is a string, so lets either set or remove it directly
|
||||
|
||||
const actualKey = `${storeId}:${key}`;
|
||||
if (value === undefined) {
|
||||
// Remove if value is explicitly undefined
|
||||
return await chrome.storage[area].remove(actualKey);
|
||||
}
|
||||
|
||||
// Set the value, applying encryption if necessary
|
||||
await chrome.storage[area].set({
|
||||
[actualKey]: isEncrypted ? await security.encrypt(value) : value,
|
||||
});
|
||||
};
|
||||
|
||||
store.remove = async (key: any) => {
|
||||
if (!hasInitialized) {
|
||||
await store.initialize();
|
||||
}
|
||||
|
||||
const actualKey = `${storeId}:${key}`;
|
||||
await chrome.storage[area].remove(actualKey);
|
||||
};
|
||||
|
||||
store.all = async () => {
|
||||
if (!hasInitialized) {
|
||||
await store.initialize();
|
||||
}
|
||||
const fullStore = await chrome.storage[area].get(actualKeys);
|
||||
if (isEncrypted) {
|
||||
await Promise.all(
|
||||
keys.map(async key => {
|
||||
const actualKey = `${storeId}:${key}`;
|
||||
fullStore[key] = await security.decrypt(fullStore[actualKey]);
|
||||
})
|
||||
);
|
||||
}
|
||||
// now we need to remove the storeId from the keys
|
||||
Object.keys(fullStore).forEach(actualKey => {
|
||||
const newKey = actualKey.replace(`${storeId}:`, '');
|
||||
fullStore[newKey] = fullStore[actualKey];
|
||||
delete fullStore[actualKey];
|
||||
});
|
||||
return fullStore as Serializable<T>;
|
||||
};
|
||||
|
||||
store.keys = () => keys as (keyof T & string)[];
|
||||
|
||||
store.subscribe = (key: string | string[], callback) => {
|
||||
// @ts-expect-error
|
||||
const sub = async (changes, areaName) => {
|
||||
const keys = Array.isArray(key) ? key : [key];
|
||||
const actualKeys = keys.map(k => `${storeId}:${k}`);
|
||||
|
||||
if (areaName !== area) return;
|
||||
|
||||
// make sure that there are keys is in the changes object
|
||||
const subKeys = Object.keys(changes).filter(k => actualKeys.includes(k));
|
||||
if (!subKeys.length) return;
|
||||
|
||||
subKeys.forEach(async actualKey => {
|
||||
const key = actualKey.replace(`${storeId}:`, '');
|
||||
const [oldValue, newValue] = await Promise.all([
|
||||
isEncrypted ? security.decrypt(changes[actualKey].oldValue) : changes[actualKey].oldValue,
|
||||
isEncrypted ? security.decrypt(changes[actualKey].newValue) : changes[actualKey].newValue,
|
||||
]);
|
||||
|
||||
callback({
|
||||
key,
|
||||
oldValue,
|
||||
newValue,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
chrome.storage.onChanged.addListener(sub);
|
||||
return sub;
|
||||
};
|
||||
|
||||
store.unsubscribe = sub => {
|
||||
chrome.storage.onChanged.removeListener(sub);
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
store.use = (key: keyof T | null, defaultValue?: key extends null ? T : T[typeof key]) => {
|
||||
const initialValue: any = (() => {
|
||||
// an explicit default value was passed, use it
|
||||
if (arguments.length === 2) {
|
||||
return defaultValue;
|
||||
}
|
||||
// a key was passed, but no default value was passed, use the default value from the defaults object
|
||||
if (key === null) {
|
||||
return defaults;
|
||||
}
|
||||
// no key was passed, use the default value from the defaults object
|
||||
return defaults[key];
|
||||
})();
|
||||
|
||||
const [value, setValue] = useState(initialValue);
|
||||
|
||||
const onChange = ({ key: k, newValue }: DataChange<T>) => {
|
||||
if (key === null) {
|
||||
// @ts-expect-error
|
||||
setValue(prev => ({ ...prev, [k]: newValue }) as any);
|
||||
} else {
|
||||
setValue(newValue as any);
|
||||
}
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (key === null) {
|
||||
store
|
||||
.all()
|
||||
.then(setValue)
|
||||
.then(() => {
|
||||
store.subscribe(store.keys(), onChange as any);
|
||||
});
|
||||
} else {
|
||||
store
|
||||
.get(key)
|
||||
.then(setValue)
|
||||
.then(() => {
|
||||
store.subscribe(key, onChange as any);
|
||||
});
|
||||
}
|
||||
return () => {
|
||||
store.unsubscribe(onChange as any);
|
||||
};
|
||||
}, []);
|
||||
|
||||
// @ts-expect-error
|
||||
const set = async newValue => {
|
||||
if (key === null) {
|
||||
await store.set(newValue as any);
|
||||
} else {
|
||||
await store.set(key, newValue as any);
|
||||
}
|
||||
};
|
||||
|
||||
return [value, set] as any;
|
||||
};
|
||||
|
||||
return store;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that creates a virtual storage bucket within the chrome.storage.local API.
|
||||
* This store will persist across browser sessions and be stored on the user's computer.
|
||||
*
|
||||
* @param storeId A unique key to use for this store. This will be prepended to all keys in the store to avoid collisions. ex: 'my-store' -> 'my-store:myKey'
|
||||
* @param defaults the default values for the store (these will be used to initialize the store if the key is not already set, and will be used as the type for the getters and setters)
|
||||
* @param computed an optional function that allows you to override the generated getters and setters with your own. Provides a reference to the store itself so you can access this store's getters and setters.
|
||||
* @param area the storage area to use. Defaults to 'local'
|
||||
* @returns an object which contains getters/setters for the keys in the defaults object, as well as an initialize function and an onChanged functions
|
||||
*/
|
||||
export function createLocalStore<T>(storeId: string, defaults: StoreDefaults<T>, options?: StoreOptions): Store<T> {
|
||||
return createStore(storeId, defaults, 'local', options);
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that creates a virtual storage bucket within the chrome.storage.sync API.
|
||||
* This store will persist across browser sessions and be stored on the user's Google account (if they are logged in).
|
||||
* This means that the data will be synced across all of the user's devices.
|
||||
*
|
||||
* @param storeId A unique key to use for this store. This will be prepended to all keys in the store to avoid collisions. ex: 'my-store' -> 'my-store:myKey'
|
||||
* @param defaults the default values for the store (these will be used to initialize the store if the key is not already set, and will be used as the type for the getters and setters)
|
||||
* @param options options that modify the behavior of the store
|
||||
* @returns an object which contains getters/setters for the keys in the defaults object, as well as an initialize function and an onChanged functions
|
||||
*/
|
||||
export function createSyncStore<T>(storeId: string, defaults: StoreDefaults<T>, options?: StoreOptions): Store<T> {
|
||||
return createStore(storeId, defaults, 'sync', options);
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that creates a virtual storage bucket within the chrome.storage.managed API.
|
||||
* This store will persist across browser sessions and managed by the administrator of the user's computer.
|
||||
*
|
||||
* @param storeId A unique key to use for this store. This will be prepended to all keys in the store to avoid collisions. ex: 'my-store' -> 'my-store:myKey'
|
||||
* @param defaults the default values for the store (these will be used to initialize the store if the key is not already set, and will be used as the type for the getters and setters)
|
||||
* @param options options that modify the behavior of the store
|
||||
* @returns an object which contains getters/setters for the keys in the defaults object, as well as an initialize function and an onChanged functions
|
||||
* @see https://developer.chrome.com/docs/extensions/reference/storage/#type-ManagedStorageArea
|
||||
*
|
||||
*/
|
||||
export function createManagedStore<T>(storeId: string, defaults: StoreDefaults<T>, options?: StoreOptions): Store<T> {
|
||||
return createStore(storeId, defaults, 'managed', options);
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that creates a virtual storage bucket within the chrome.storage.session API.
|
||||
* This store will NOT persist across browser sessions and will be stored in memory. This will reset when the browser is closed.
|
||||
*
|
||||
* @param storeId A unique key to use for this store. This will be prepended to all keys in the store to avoid collisions. ex: 'my-store' -> 'my-store:myKey'
|
||||
* @param defaults the default values for the store (these will be used to initialize the store if the key is not already set, and will be used as the type for the getters and setters)
|
||||
* @param options options that modify the behavior of the store
|
||||
* @returns an object which contains getters/setters for the keys in the defaults object, as well as an initialize function and an onChanged functions
|
||||
*/
|
||||
export function createSessionStore<T>(storeId: string, defaults: StoreDefaults<T>, options?: StoreOptions): Store<T> {
|
||||
return createStore(storeId, defaults, 'session', options);
|
||||
}
|
||||
|
||||
// interface MyStore {
|
||||
// name: string;
|
||||
// age: number;
|
||||
// isCool?: boolean;
|
||||
// }
|
||||
// const store = createLocalStore<MyStore>('my-store', {
|
||||
// age: 0,
|
||||
// isCool: false,
|
||||
// name: 'John Doe',
|
||||
// });
|
||||
2
src/lib/chrome-extension-toolkit/storage/index.ts
Normal file
2
src/lib/chrome-extension-toolkit/storage/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from './createStore';
|
||||
export * from './Security';
|
||||
70
src/lib/chrome-extension-toolkit/types/Messaging.ts
Normal file
70
src/lib/chrome-extension-toolkit/types/Messaging.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import type { Serializable } from './Serialization';
|
||||
|
||||
/**
|
||||
* MessageDefinition is a record of message names and their data types.
|
||||
* The data type is the type of the first argument of the message handler.
|
||||
* The return type of the message handler is the resolved type of the promise returned by the message sender.
|
||||
*/
|
||||
export type MessageDefinition<T extends Record<string, (data: Record<string, any> | undefined) => any>> = T;
|
||||
|
||||
/**
|
||||
* A helper type to extract the data type of a message handler.
|
||||
*/
|
||||
export type MessageData<M, K extends keyof M> = Serializable<
|
||||
Parameters<M[K] extends (...args: any) => any ? M[K] : never>[0]
|
||||
>;
|
||||
|
||||
/**
|
||||
* A helper type to extract the resolved type of a message handler.
|
||||
*/
|
||||
export type MessageResponse<M, K extends keyof M> = Serializable<
|
||||
ReturnType<M[K] extends (...args: any) => any ? M[K] : never>
|
||||
>;
|
||||
/**
|
||||
* The internal object representing a message sent between chrome extension contexts.
|
||||
*/
|
||||
export type Message<M> = {
|
||||
name: keyof M;
|
||||
data: MessageData<M, keyof M>;
|
||||
from: MessageEndpoint;
|
||||
to: MessageEndpoint;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents the extension context in which a message is either sent or received.
|
||||
* The context is either the background script/service worker or a tab.
|
||||
*/
|
||||
export enum MessageEndpoint {
|
||||
/** The background script or service worker. */
|
||||
BACKGROUND = 'BACKGROUND',
|
||||
/** A foreground or extension page (popup, options, etc) */
|
||||
FOREGROUND = 'FOREGROUND',
|
||||
}
|
||||
|
||||
/**
|
||||
* An object that implements the message handlers for each of the messages in the message definition.
|
||||
*/
|
||||
export type MessageHandler<M> = {
|
||||
[K in keyof M]: (context: {
|
||||
/** The data sent with the message. */
|
||||
data: MessageData<M, K>;
|
||||
/** The tab or page or background service worker that sent the message. */
|
||||
sender: chrome.runtime.MessageSender;
|
||||
/** A function that can be used to send a response asynchronously to the sender. */
|
||||
sendResponse: (response: MessageResponse<M, K>) => void;
|
||||
}) => Promise<void> | void;
|
||||
};
|
||||
|
||||
/**
|
||||
* An object that can be used to handle messages coming from another extension context.
|
||||
*/
|
||||
export interface IMessageListener<M> {
|
||||
/**
|
||||
* Starts listening for messages. When a message is received, the corresponding message handler is called.
|
||||
*/
|
||||
listen: (handler: MessageHandler<M>) => void;
|
||||
/**
|
||||
* Stops listening for messages.
|
||||
*/
|
||||
unlisten: () => void;
|
||||
}
|
||||
69
src/lib/chrome-extension-toolkit/types/Serialization.ts
Normal file
69
src/lib/chrome-extension-toolkit/types/Serialization.ts
Normal file
@@ -0,0 +1,69 @@
|
||||
type Primitive = string | number | boolean | null | undefined;
|
||||
|
||||
/**
|
||||
* A type that represents a serialized object. This is a recursive type that will serialize all properties of an object, except for functions which are ignored (and thus not serialized)
|
||||
*/
|
||||
export type Serialized<T> = {
|
||||
[K in keyof T as T[K] extends Function ? never : K]: Serializable<T[K]>;
|
||||
};
|
||||
|
||||
/**
|
||||
* Represents a type that can be serialized to JSON. This could either be a primitive type, an array of serializable types, or a complex object
|
||||
* Recursively serializes an object to a JSON-compatible object.
|
||||
*/
|
||||
export type Serializable<T> = T extends Primitive
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
? Array<Serializable<U>>
|
||||
: T extends object
|
||||
? Serialized<T>
|
||||
: T;
|
||||
|
||||
/**
|
||||
* Serializes a value to a JSON-compatible object (i.e. a Serializable<T>)
|
||||
* @returns A JSON-compatible object that represents the value passed in with all functions removed and all objects recursively serialized
|
||||
*/
|
||||
export function serialize<T>(value: T): Serializable<T> {
|
||||
return JSON.parse(JSON.stringify(value)) as Serializable<T>;
|
||||
}
|
||||
|
||||
// THIS IS FOR TESTINWG THE TYPING
|
||||
|
||||
// type Test2 = {
|
||||
// test: string;
|
||||
// openNewTab: (url: string) => void;
|
||||
// url?: URL;
|
||||
// };
|
||||
|
||||
// type Test1 = {
|
||||
// openNewTab: (url: string) => void;
|
||||
// count: number;
|
||||
// url: URL;
|
||||
// urls?: URL[];
|
||||
// foo: Test2;
|
||||
// bar?: Test2;
|
||||
// };
|
||||
|
||||
// let x: Serialized<Test1>;
|
||||
// // ^?
|
||||
|
||||
// type SerializedData = Serializable<Data>;
|
||||
|
||||
// let data: SerializedData = {} as any;
|
||||
|
||||
// data.url = undefined;
|
||||
|
||||
// data = {
|
||||
// a: 'test',
|
||||
// b: 1,
|
||||
// c: true,
|
||||
// d: {
|
||||
// e: 'test',
|
||||
// t: undefined,
|
||||
// },
|
||||
// urls: [],
|
||||
// };
|
||||
|
||||
// data.d = {
|
||||
// e: 'test',
|
||||
// };
|
||||
47
src/lib/chrome-extension-toolkit/types/Test.ts
Normal file
47
src/lib/chrome-extension-toolkit/types/Test.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
type Primitive = string | number | boolean | null | undefined;
|
||||
|
||||
type Serialized<T> = {
|
||||
[K in keyof T as T[K] extends Function ? never : K]: Serializable<T[K]>;
|
||||
};
|
||||
|
||||
type Serializable<T> = T extends Primitive
|
||||
? T
|
||||
: T extends Array<infer U>
|
||||
? Array<Serializable<U>>
|
||||
: T extends object
|
||||
? Serialized<T>
|
||||
: T;
|
||||
|
||||
type Data = {
|
||||
a: string;
|
||||
b: number;
|
||||
c: boolean;
|
||||
url?: URL;
|
||||
d: {
|
||||
e: string;
|
||||
t?: URL;
|
||||
};
|
||||
get: () => void;
|
||||
urls: URL[];
|
||||
};
|
||||
|
||||
type SerializedData = Serializable<Data>;
|
||||
|
||||
let x: SerializedData = {} as any;
|
||||
|
||||
x.url = undefined;
|
||||
|
||||
x = {
|
||||
a: 'test',
|
||||
b: 1,
|
||||
c: true,
|
||||
d: {
|
||||
e: 'test',
|
||||
t: undefined,
|
||||
},
|
||||
urls: [],
|
||||
};
|
||||
|
||||
x.d = {
|
||||
e: 'test',
|
||||
};
|
||||
6
src/lib/chrome-extension-toolkit/types/index.ts
Normal file
6
src/lib/chrome-extension-toolkit/types/index.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export * from './Messaging';
|
||||
export * from './Serialization';
|
||||
|
||||
export type AddParameters<TFunction extends (...args: any) => any, TParameters extends [...args: any]> = (
|
||||
...args: [...Parameters<TFunction>, ...TParameters]
|
||||
) => ReturnType<TFunction>;
|
||||
48
src/lib/chrome-extension-toolkit/utils/Console.ts
Normal file
48
src/lib/chrome-extension-toolkit/utils/Console.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
const LOG_BACKGROUND_COLOR = '#2196F3';
|
||||
const LOG_TEXT_COLOR = '#fff';
|
||||
|
||||
const SUCCESS_BACKGROUND_COLOR = '#4CAF50';
|
||||
const SUCCESS_TEXT_COLOR = '#fff';
|
||||
|
||||
const ERROR_BACKGROUND_COLOR = '#F44336';
|
||||
const ERROR_TEXT_COLOR = '#fff';
|
||||
|
||||
const WARNING_BACKGROUND_COLOR = '#FFC107';
|
||||
const WARNING_TEXT_COLOR = '#fff';
|
||||
|
||||
/**
|
||||
* Utility class for logging messages with different styles.
|
||||
*/
|
||||
export class Console {
|
||||
static log(...args: any[]) {
|
||||
console.log(
|
||||
`%c ${args[0]} `,
|
||||
`background: ${LOG_BACKGROUND_COLOR}; color: ${LOG_TEXT_COLOR}`,
|
||||
...args.slice(1)
|
||||
);
|
||||
}
|
||||
|
||||
static success(...args: any[]) {
|
||||
console.log(
|
||||
`%c ${args[0]} `,
|
||||
`background: ${SUCCESS_BACKGROUND_COLOR}; color: ${SUCCESS_TEXT_COLOR}`,
|
||||
...args.slice(1)
|
||||
);
|
||||
}
|
||||
|
||||
static error(...args: any[]) {
|
||||
console.error(
|
||||
`%c ${args[0]} `,
|
||||
`background: ${ERROR_BACKGROUND_COLOR}; color: ${ERROR_TEXT_COLOR}`,
|
||||
...args.slice(1)
|
||||
);
|
||||
}
|
||||
|
||||
static warn(...args: any[]) {
|
||||
console.warn(
|
||||
`%c ${args[0]} `,
|
||||
`background: ${WARNING_BACKGROUND_COLOR}; color: ${WARNING_TEXT_COLOR}`,
|
||||
...args.slice(1)
|
||||
);
|
||||
}
|
||||
}
|
||||
8
src/lib/chrome-extension-toolkit/utils/string.ts
Normal file
8
src/lib/chrome-extension-toolkit/utils/string.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Capitalizes the first letter of a string
|
||||
* @param str the string to capitalize
|
||||
* @returns the capitalized string
|
||||
*/
|
||||
export function capitalize(str: string): string {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
@@ -271,12 +271,12 @@ export default function Page404(): JSX.Element {
|
||||
}
|
||||
function _0x5629d1() {
|
||||
let _0x13c635 = _0xdd3699;
|
||||
_0x5b7f43(),
|
||||
(_0x5b7f43(),
|
||||
_0x16f39e[_0x13c635(0x81)](
|
||||
_0x228047,
|
||||
0x9c + -0x1 * 0x23ab + 0x230f * 0x1,
|
||||
-0x1c26 + 0x7bf + -0x6cd * -0x3
|
||||
);
|
||||
));
|
||||
}
|
||||
let _0x93f360 = 0x64 * 0x49 + 0x1e1e + -0x3aa2;
|
||||
function _0x5b7f43() {
|
||||
@@ -373,12 +373,12 @@ export default function Page404(): JSX.Element {
|
||||
(-0x2469 + 0x156a * -0x1 + 0x39e2)) +
|
||||
(-0x1 * 0x13f8 + 0x6df + -0x1 * -0xd29);
|
||||
if (_0x3e178a == 0x1 * -0x1a87 + 0x1fdd + -0x555 * 0x1) {
|
||||
(_0x546fb5 =
|
||||
((_0x546fb5 =
|
||||
(_0x227002 * (-0x10d7 + 0x1 * 0x15ad + -0x2 * 0x263)) &
|
||||
(-0x25ca * 0x1 + 0x8 * 0x278 + -0x1 * -0x1219)),
|
||||
(_0x1667c5 =
|
||||
(_0x32116b * (0x4d3 + 0x1c09 * -0x1 + 0x3 * 0x7c2)) &
|
||||
(-0xf06 * 0x2 + -0x144f * -0x1 + -0x344 * -0x3));
|
||||
(-0xf06 * 0x2 + -0x144f * -0x1 + -0x344 * -0x3)));
|
||||
if (_0x5b3085 < -0xa * 0xed + -0xd19 + 0x1 * 0x165b)
|
||||
_0x1667c5 += -0xd48 + 0xf6c + 0xc * -0x2b;
|
||||
}
|
||||
@@ -410,10 +410,10 @@ export default function Page404(): JSX.Element {
|
||||
(-0x2709 + -0x6 * -0x312 + -0x39a * -0x6)),
|
||||
(_0x267dd3 = _0x38c463));
|
||||
}
|
||||
(_0x227002 += _0x4b089b),
|
||||
((_0x227002 += _0x4b089b),
|
||||
(_0x2aec99 += _0x5b3085),
|
||||
(_0x32116b += _0x1eaaad),
|
||||
(_0x38c463 += _0x57383c);
|
||||
(_0x38c463 += _0x57383c));
|
||||
}
|
||||
}
|
||||
let _0x5cba48 =
|
||||
@@ -430,7 +430,7 @@ export default function Page404(): JSX.Element {
|
||||
let _0xdf8389 =
|
||||
((_0x13f1b0 & (-0x247a + -0x4 * -0x9c2 + -0x39 * 0x7)) * _0x2062a9 * _0x5c387a) /
|
||||
((0x1d5 * 0xa + -0x250a + -0x31 * -0x67) * (-0x7 * 0x25f + -0xae7 + 0x1c7f * 0x1));
|
||||
(_0x228047[_0x4626de(0x8e)][
|
||||
((_0x228047[_0x4626de(0x8e)][
|
||||
(_0x132623 + _0x1a573d * _0x124180) * (0x29 * -0xa9 + -0x94 * -0x2b + -0x239 * -0x1) +
|
||||
(0x55d * 0x2 + 0xeed * 0x1 + -0xc7 * 0x21)
|
||||
] = _0x5cba48),
|
||||
@@ -441,7 +441,7 @@ export default function Page404(): JSX.Element {
|
||||
(_0x228047[_0x4626de(0x8e)][
|
||||
(_0x132623 + _0x1a573d * _0x124180) * (0x1e2a + -0x21df + -0x1 * -0x3b9) +
|
||||
(0x1e79 + 0x860 * -0x2 + 0x1 * -0xdb7)
|
||||
] = _0xdf8389);
|
||||
] = _0xdf8389));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { MessageListener } from '@chrome-extension-toolkit';
|
||||
import type { BACKGROUND_MESSAGES } from '@shared/messages';
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
import updateBadgeText from '@shared/util/updateBadgeText';
|
||||
import { MessageListener } from 'chrome-extension-toolkit';
|
||||
|
||||
import onInstall from './events/onInstall';
|
||||
import onServiceWorkerAlive from './events/onServiceWorkerAlive';
|
||||
@@ -9,6 +9,7 @@ import onUpdate from './events/onUpdate';
|
||||
import browserActionHandler from './handler/browserActionHandler';
|
||||
import calendarBackgroundHandler from './handler/calendarBackgroundHandler';
|
||||
import CESHandler from './handler/CESHandler';
|
||||
import gitHubStatsHandler from './handler/gitHubStatsHandler';
|
||||
import tabManagementHandler from './handler/tabManagementHandler';
|
||||
import userScheduleHandler from './handler/userScheduleHandler';
|
||||
|
||||
@@ -52,17 +53,18 @@ const messageListener = new MessageListener<BACKGROUND_MESSAGES>({
|
||||
...userScheduleHandler,
|
||||
...CESHandler,
|
||||
...calendarBackgroundHandler,
|
||||
...gitHubStatsHandler,
|
||||
});
|
||||
|
||||
messageListener.listen();
|
||||
|
||||
UserScheduleStore.listen('schedules', async schedules => {
|
||||
UserScheduleStore.subscribe('schedules', async schedules => {
|
||||
const index = await UserScheduleStore.get('activeIndex');
|
||||
const numCourses = schedules.newValue[index]?.courses?.length;
|
||||
updateBadgeText(numCourses || 0);
|
||||
});
|
||||
|
||||
UserScheduleStore.listen('activeIndex', async ({ newValue }) => {
|
||||
UserScheduleStore.subscribe('activeIndex', async ({ newValue }) => {
|
||||
const schedules = await UserScheduleStore.get('schedules');
|
||||
const numCourses = schedules[newValue]?.courses?.length;
|
||||
updateBadgeText(numCourses || 0);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { ExtensionStore } from '@shared/storage/ExtensionStore';
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
|
||||
import createSchedule from '../lib/createSchedule';
|
||||
|
||||
/**
|
||||
* Called when the extension is updated (or when the extension is reloaded in development mode)
|
||||
@@ -8,4 +11,11 @@ export default async function onUpdate() {
|
||||
version: chrome.runtime.getManifest().version,
|
||||
lastUpdate: Date.now(),
|
||||
});
|
||||
|
||||
const schedules = await UserScheduleStore.get('schedules');
|
||||
|
||||
// By invariant, there must always be at least one schedule
|
||||
if (schedules.length === 0) {
|
||||
createSchedule('Schedule 1');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import openNewTab from '@background/util/openNewTab';
|
||||
import type { MessageHandler } from '@chrome-extension-toolkit';
|
||||
import type CESMessage from '@shared/messages/CESMessage';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
const CESFall2023Url = 'https://utexas.bluera.com/utexas/rpvl.aspx?rid=d3db767b-049f-46c5-9a67-29c21c29c580®l=en-US';
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { MessageHandler } from '@chrome-extension-toolkit';
|
||||
import type BrowserActionMessages from '@shared/messages/BrowserActionMessages';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
const browserActionHandler: MessageHandler<BrowserActionMessages> = {
|
||||
disableBrowserAction({ sender, sendResponse }) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import type { TabWithId } from '@background/util/openNewTab';
|
||||
import openNewTab from '@background/util/openNewTab';
|
||||
import type { MessageHandler } from '@chrome-extension-toolkit';
|
||||
import { tabs } from '@shared/messages';
|
||||
import type { CalendarBackgroundMessages } from '@shared/messages/CalendarMessages';
|
||||
import { OptionsStore } from '@shared/storage/OptionsStore';
|
||||
import { CRX_PAGES } from '@shared/types/CRXPages';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
const getAllTabInfos = async () => {
|
||||
const openTabs = (await chrome.tabs.query({})).filter((tab): tab is TabWithId => tab.id !== undefined);
|
||||
const results = await Promise.allSettled(openTabs.map(tab => tabs.getTabInfo(undefined, tab.id)));
|
||||
const results = await Promise.allSettled(openTabs.map(tab => tabs.getTabInfo({ tabId: tab.id })));
|
||||
|
||||
type TabInfo = PromiseFulfilledResult<Awaited<ReturnType<typeof tabs.getTabInfo>>>;
|
||||
return results
|
||||
@@ -34,7 +34,7 @@ const calendarBackgroundHandler: MessageHandler<CalendarBackgroundMessages> = {
|
||||
|
||||
await chrome.tabs.update(tabid, { active: true });
|
||||
await chrome.windows.update(openCalendarTabInfo.tab.windowId, { focused: true, drawAttention: true });
|
||||
if (uniqueId !== undefined) await tabs.openCoursePopup({ uniqueId }, tabid);
|
||||
if (uniqueId !== undefined) await tabs.openCoursePopup({ uniqueId }, { tabId: tabid });
|
||||
|
||||
sendResponse(openCalendarTabInfo.tab);
|
||||
} else {
|
||||
|
||||
31
src/pages/background/handler/gitHubStatsHandler.ts
Normal file
31
src/pages/background/handler/gitHubStatsHandler.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { MessageHandler } from '@chrome-extension-toolkit';
|
||||
import type GitHubStatsMessages from '@shared/messages/GitHubStatsMessages';
|
||||
import { GitHubStatsService } from '@views/lib/getGitHubStats';
|
||||
|
||||
const gitHubStatsService = new GitHubStatsService();
|
||||
|
||||
/**
|
||||
* Handler for GitHub stats related messages
|
||||
*/
|
||||
const gitHubStatsHandler: MessageHandler<GitHubStatsMessages> = {
|
||||
async fetchGitHubStats({ data, sendResponse }) {
|
||||
try {
|
||||
const includeMergedPRs = data ?? false;
|
||||
const stats = await gitHubStatsService.fetchGitHubStats({ includeMergedPRs });
|
||||
sendResponse(stats);
|
||||
} catch (error) {
|
||||
console.error('Error fetching GitHub stats in background:', error);
|
||||
sendResponse({
|
||||
adminGitHubStats: {},
|
||||
userGitHubStats: {},
|
||||
contributors: [],
|
||||
names: {},
|
||||
dataFetched: new Date(),
|
||||
lastUpdated: new Date(),
|
||||
isCached: false,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default gitHubStatsHandler;
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { MessageHandler } from '@chrome-extension-toolkit';
|
||||
import openNewTab from '@pages/background/util/openNewTab';
|
||||
import type TabManagementMessages from '@shared/messages/TabManagementMessages';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
const tabManagementHandler: MessageHandler<TabManagementMessages> = {
|
||||
getTabId({ sendResponse, sender }) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import type { MessageHandler } from '@chrome-extension-toolkit';
|
||||
import addCourse from '@pages/background/lib/addCourse';
|
||||
import clearCourses from '@pages/background/lib/clearCourses';
|
||||
import createSchedule from '@pages/background/lib/createSchedule';
|
||||
@@ -9,7 +10,6 @@ import switchSchedule from '@pages/background/lib/switchSchedule';
|
||||
import type { UserScheduleMessages } from '@shared/messages/UserScheduleMessages';
|
||||
import { Course } from '@shared/types/Course';
|
||||
import { validateLoginStatus } from '@shared/util/checkLoginStatus';
|
||||
import type { MessageHandler } from 'chrome-extension-toolkit';
|
||||
|
||||
const userScheduleHandler: MessageHandler<UserScheduleMessages> = {
|
||||
addCourse({ data, sendResponse }) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { Serialized } from '@chrome-extension-toolkit';
|
||||
import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
|
||||
import type { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import { generateRandomId } from '@shared/util/random';
|
||||
import type { Serialized } from 'chrome-extension-toolkit';
|
||||
|
||||
/**
|
||||
* Creates a new schedule with the given name
|
||||
@@ -36,5 +36,14 @@ export default async function createSchedule(scheduleName: string) {
|
||||
schedules.push(newSchedule);
|
||||
|
||||
await UserScheduleStore.set('schedules', schedules);
|
||||
|
||||
// Automatically switch to the new schedule
|
||||
await UserScheduleStore.set('activeIndex', schedules.length - 1);
|
||||
|
||||
// If there is only one schedule, set the active index to the new schedule
|
||||
if (schedules.length <= 1) {
|
||||
await UserScheduleStore.set('activeIndex', 0);
|
||||
}
|
||||
|
||||
return newSchedule.id;
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ export default async function deleteSchedule(scheduleId: string): Promise<string
|
||||
schedules.splice(scheduleIndex, 1);
|
||||
await UserScheduleStore.set('schedules', schedules);
|
||||
|
||||
// By invariant, there must always be at least one schedule
|
||||
if (schedules.length === 0) {
|
||||
createSchedule('Schedule 1');
|
||||
}
|
||||
|
||||
let newActiveIndex = activeIndex;
|
||||
if (scheduleIndex < activeIndex) {
|
||||
newActiveIndex = activeIndex - 1;
|
||||
|
||||
@@ -31,5 +31,9 @@ export default async function duplicateSchedule(scheduleId: string): Promise<str
|
||||
} satisfies typeof schedule);
|
||||
|
||||
await UserScheduleStore.set('schedules', schedules);
|
||||
|
||||
// Automatically switch to the duplicated schedule
|
||||
await UserScheduleStore.set('activeIndex', scheduleIndex + 1);
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Serialized } from '@chrome-extension-toolkit';
|
||||
import { Course } from '@shared/types/Course';
|
||||
import type { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import type { Serialized } from 'chrome-extension-toolkit';
|
||||
|
||||
import addCourse from './addCourse';
|
||||
import createSchedule from './createSchedule';
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { MessageListener } from '@chrome-extension-toolkit';
|
||||
import type TabInfoMessages from '@shared/messages/TabInfoMessages';
|
||||
import Calendar from '@views/components/calendar/Calendar';
|
||||
import DialogProvider from '@views/components/common/DialogProvider/DialogProvider';
|
||||
import ExtensionRoot from '@views/components/common/ExtensionRoot/ExtensionRoot';
|
||||
import { MigrationDialog } from '@views/components/common/MigrationDialog';
|
||||
import { WhatsNewDialog } from '@views/components/common/WhatsNewPopup';
|
||||
import SentryProvider from '@views/contexts/SentryContext';
|
||||
import { MessageListener } from 'chrome-extension-toolkit';
|
||||
import useKC_DABR_WASM from 'kc-dabr-wasm';
|
||||
import React, { useEffect } from 'react';
|
||||
|
||||
@@ -34,6 +35,7 @@ export default function CalendarMain() {
|
||||
<ExtensionRoot className='h-full w-full'>
|
||||
<DialogProvider>
|
||||
<MigrationDialog />
|
||||
<WhatsNewDialog />
|
||||
<Calendar />
|
||||
</DialogProvider>
|
||||
</ExtensionRoot>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import CourseCatalogMain from '@views/components/CourseCatalogMain';
|
||||
import InjectedButton from '@views/components/injected/AddAllButton';
|
||||
import DaysCheckbox from '@views/components/injected/DaysCheckbox';
|
||||
import ShadedResults from '@views/components/injected/SearchResultShader';
|
||||
import getSiteSupport, { SiteSupport } from '@views/lib/getSiteSupport';
|
||||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
@@ -25,3 +27,11 @@ if (support === SiteSupport.COURSE_CATALOG_DETAILS || support === SiteSupport.CO
|
||||
if (support === SiteSupport.MY_UT) {
|
||||
renderComponent(InjectedButton);
|
||||
}
|
||||
|
||||
if (support === SiteSupport.COURSE_CATALOG_SEARCH) {
|
||||
renderComponent(DaysCheckbox);
|
||||
}
|
||||
|
||||
if (support === SiteSupport.COURSE_CATALOG_KWS) {
|
||||
renderComponent(ShadedResults);
|
||||
}
|
||||
|
||||
19
src/pages/map/Map.tsx
Normal file
19
src/pages/map/Map.tsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import DialogProvider from '@views/components/common/DialogProvider/DialogProvider';
|
||||
import ExtensionRoot from '@views/components/common/ExtensionRoot/ExtensionRoot';
|
||||
import Map from '@views/components/map/Map';
|
||||
import useKC_DABR_WASM from 'kc-dabr-wasm';
|
||||
import React from 'react';
|
||||
|
||||
/**
|
||||
* Renders the map page for the UTRP (UT Registration Plus) extension.
|
||||
*/
|
||||
export default function MapPage() {
|
||||
useKC_DABR_WASM();
|
||||
return (
|
||||
<ExtensionRoot>
|
||||
<DialogProvider>
|
||||
<Map />
|
||||
</DialogProvider>
|
||||
</ExtensionRoot>
|
||||
);
|
||||
}
|
||||
16
src/pages/map/index.html
Normal file
16
src/pages/map/index.html
Normal file
@@ -0,0 +1,16 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<title>UTRP Map</title>
|
||||
</head>
|
||||
|
||||
<body style="min-height: 100vh; height: 0; margin: 0">
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
|
||||
<script src="./index.tsx" type="module"></script>
|
||||
</body>
|
||||
</html>
|
||||
6
src/pages/map/index.tsx
Normal file
6
src/pages/map/index.tsx
Normal file
@@ -0,0 +1,6 @@
|
||||
import React from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
|
||||
import Map from './Map';
|
||||
|
||||
createRoot(document.getElementById('root')!).render(<Map />);
|
||||
12
src/shared/messages/GitHubStatsMessages.ts
Normal file
12
src/shared/messages/GitHubStatsMessages.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { GitHubStatsResult } from '@shared/types/GitHubStats';
|
||||
|
||||
/* eslint-disable jsdoc/require-jsdoc */
|
||||
|
||||
export default interface GitHubStatsMessages {
|
||||
/**
|
||||
* Fetch GitHub statistics for all contributors
|
||||
* @param includeMergedPRs - Whether to include merged PR counts (optional, default: false)
|
||||
* @returns GitHub stats including commits, lines added/deleted, and optionally merged PRs
|
||||
*/
|
||||
fetchGitHubStats: (includeMergedPRs?: boolean) => GitHubStatsResult;
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
import { createMessenger } from 'chrome-extension-toolkit';
|
||||
import { createMessenger } from '@chrome-extension-toolkit';
|
||||
|
||||
import type BrowserActionMessages from './BrowserActionMessages';
|
||||
import type { CalendarBackgroundMessages, CalendarTabMessages } from './CalendarMessages';
|
||||
import type CESMessage from './CESMessage';
|
||||
import type GitHubStatsMessages from './GitHubStatsMessages';
|
||||
import type TabInfoMessages from './TabInfoMessages';
|
||||
import type TabManagementMessages from './TabManagementMessages';
|
||||
import type { UserScheduleMessages } from './UserScheduleMessages';
|
||||
@@ -14,7 +15,8 @@ export type BACKGROUND_MESSAGES = BrowserActionMessages &
|
||||
TabManagementMessages &
|
||||
UserScheduleMessages &
|
||||
CESMessage &
|
||||
CalendarBackgroundMessages;
|
||||
CalendarBackgroundMessages &
|
||||
GitHubStatsMessages;
|
||||
|
||||
/**
|
||||
* This is a type with all the message definitions that can be sent TO specific tabs
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createLocalStore } from '@chrome-extension-toolkit';
|
||||
import type { CachedData } from '@shared/types/CachedData';
|
||||
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
|
||||
|
||||
interface ICacheStore {
|
||||
github: Record<string, CachedData<unknown>>;
|
||||
@@ -8,8 +8,8 @@ interface ICacheStore {
|
||||
/**
|
||||
* A store that is used for storing cached data such as GitHub contributors
|
||||
*/
|
||||
export const CacheStore = createLocalStore<ICacheStore>({
|
||||
export const CacheStore = createLocalStore<ICacheStore>('CacheStore', {
|
||||
github: {},
|
||||
});
|
||||
|
||||
debugStore({ cacheStore: CacheStore });
|
||||
// debugStore({ cacheStore: CacheStore });
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
|
||||
import { createLocalStore } from '@chrome-extension-toolkit';
|
||||
|
||||
/**
|
||||
* A store that is used to store data that is only relevant during development
|
||||
*/
|
||||
interface IDevStore {
|
||||
/** whether the user is a developer */
|
||||
isDeveloper: boolean;
|
||||
/** the tabId for the debug tab */
|
||||
debugTabId?: number;
|
||||
/** whether the debug tab is visible */
|
||||
@@ -16,7 +18,8 @@ interface IDevStore {
|
||||
reloadTabId?: number;
|
||||
}
|
||||
|
||||
export const DevStore = createLocalStore<IDevStore>({
|
||||
export const DevStore = createLocalStore<IDevStore>('DevStore', {
|
||||
isDeveloper: false,
|
||||
debugTabId: undefined,
|
||||
isTabReloading: true,
|
||||
wasDebugTabVisible: false,
|
||||
@@ -24,4 +27,4 @@ export const DevStore = createLocalStore<IDevStore>({
|
||||
reloadTabId: undefined,
|
||||
});
|
||||
|
||||
debugStore({ devStore: DevStore });
|
||||
// debugStore({ devStore: DevStore });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
|
||||
import { createLocalStore } from '@chrome-extension-toolkit';
|
||||
|
||||
/**
|
||||
* A store that is used for storing user options
|
||||
@@ -8,11 +8,14 @@ interface IExtensionStore {
|
||||
version: string;
|
||||
/** When was the last update */
|
||||
lastUpdate: number;
|
||||
/** The last version of the "What's New" popup that was shown to the user */
|
||||
lastWhatsNewPopupVersion: number;
|
||||
}
|
||||
|
||||
export const ExtensionStore = createLocalStore<IExtensionStore>({
|
||||
export const ExtensionStore = createLocalStore<IExtensionStore>('ExtensionStore', {
|
||||
version: chrome.runtime.getManifest().version,
|
||||
lastUpdate: Date.now(),
|
||||
lastWhatsNewPopupVersion: 0,
|
||||
});
|
||||
|
||||
debugStore({ ExtensionStore });
|
||||
// debugStore({ ExtensionStore });
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { createSyncStore, debugStore } from 'chrome-extension-toolkit';
|
||||
import { createSyncStore } from '@chrome-extension-toolkit';
|
||||
|
||||
/**
|
||||
* A store that is used for storing user options
|
||||
@@ -18,14 +18,25 @@ export interface IOptionsStore {
|
||||
|
||||
/** whether we should open the calendar in a new tab; default is to focus an existing calendar tab */
|
||||
alwaysOpenCalendarInNewTab: boolean;
|
||||
|
||||
/** whether the calendar sidebar should be shown when the calendar is opened */
|
||||
showCalendarSidebar: boolean;
|
||||
|
||||
/** whether the promo should be shown */
|
||||
showUTDiningPromo: boolean;
|
||||
/** whether users are allowed to bypass the 10 schedule limit */
|
||||
allowMoreSchedules: boolean;
|
||||
}
|
||||
|
||||
export const OptionsStore = createSyncStore<IOptionsStore>({
|
||||
export const OptionsStore = createSyncStore<IOptionsStore>('OptionsStore', {
|
||||
enableCourseStatusChips: false,
|
||||
enableHighlightConflicts: true,
|
||||
enableScrollToLoad: true,
|
||||
enableDataRefreshing: false,
|
||||
alwaysOpenCalendarInNewTab: false,
|
||||
showCalendarSidebar: true,
|
||||
showUTDiningPromo: true,
|
||||
allowMoreSchedules: false,
|
||||
});
|
||||
|
||||
/**
|
||||
@@ -40,8 +51,11 @@ export const initSettings = async () =>
|
||||
enableScrollToLoad: await OptionsStore.get('enableScrollToLoad'),
|
||||
enableDataRefreshing: await OptionsStore.get('enableDataRefreshing'),
|
||||
alwaysOpenCalendarInNewTab: await OptionsStore.get('alwaysOpenCalendarInNewTab'),
|
||||
showCalendarSidebar: await OptionsStore.get('showCalendarSidebar'),
|
||||
showUTDiningPromo: await OptionsStore.get('showUTDiningPromo'),
|
||||
allowMoreSchedules: await OptionsStore.get('allowMoreSchedules'),
|
||||
}) satisfies IOptionsStore;
|
||||
|
||||
// Clothing retailer right
|
||||
|
||||
debugStore({ OptionsStore });
|
||||
// debugStore({ OptionsStore });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createLocalStore } from '@chrome-extension-toolkit';
|
||||
import { UserSchedule } from '@shared/types/UserSchedule';
|
||||
import { createLocalStore, debugStore } from 'chrome-extension-toolkit';
|
||||
|
||||
import { generateRandomId } from '../util/random';
|
||||
|
||||
@@ -11,7 +11,7 @@ interface IUserScheduleStore {
|
||||
/**
|
||||
* A store that is used for storing user schedules (and the active schedule)
|
||||
*/
|
||||
export const UserScheduleStore = createLocalStore<IUserScheduleStore>({
|
||||
export const UserScheduleStore = createLocalStore<IUserScheduleStore>('UserScheduleStore', {
|
||||
schedules: [
|
||||
new UserSchedule({
|
||||
courses: [],
|
||||
@@ -24,4 +24,4 @@ export const UserScheduleStore = createLocalStore<IUserScheduleStore>({
|
||||
activeIndex: 0,
|
||||
});
|
||||
|
||||
debugStore({ userScheduleStore: UserScheduleStore });
|
||||
// debugStore({ userScheduleStore: UserScheduleStore });
|
||||
|
||||
@@ -5,6 +5,7 @@ export const CRX_PAGES = {
|
||||
DEBUG: '/debug.html',
|
||||
CALENDAR: '/calendar.html',
|
||||
OPTIONS: '/options.html',
|
||||
MAP: '/map.html',
|
||||
REPORT: '/report.html',
|
||||
} as const;
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user