diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 4d8e8e98..5baf4c10 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -7,32 +7,42 @@ assignees: ["sameerasw"] --- ## Describe the bug + A clear and concise description of what the bug is. ## Steps to reproduce + Steps to reproduce the behavior: -1. -2. -3. + +1. +2. +3. ## Expected behavior + A clear and concise description of what you expected to happen. ## Actual behavior + Describe what actually happened. ## ZenInternet Backup JSON (optional) + If possible, please attach the JSON file from a ZenInternet backup (found in Advanced Settings of the addon). -*This is optional, but may help with debugging.* +_This is optional, but may help with debugging._ ## Zen Browser Version + Please specify the version of the Zen browser you are using: ## Platform + What platform are you using? (e.g., Windows, macOS, Linux, Android, iOS, etc.) ## Website (if applicable) + If this bug relates to a specific website, please provide its URL: ## Additional context + Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/website-theme-request.md b/.github/ISSUE_TEMPLATE/website-theme-request.md index e2c39db6..6bf68470 100644 --- a/.github/ISSUE_TEMPLATE/website-theme-request.md +++ b/.github/ISSUE_TEMPLATE/website-theme-request.md @@ -4,7 +4,6 @@ about: Request your favorite site to be themed and added to the repository so th title: "[THEME]" labels: Theme assignees: sameerasw - --- Provide the website URL diff --git a/.github/workflows/check_commits.yml b/.github/workflows/check_commits.yml index 00c302eb..8ceecb68 100644 --- a/.github/workflows/check_commits.yml +++ b/.github/workflows/check_commits.yml @@ -3,7 +3,7 @@ name: Check New Commits and Assign Issues on: push: paths: - - '**.css' + - "**.css" jobs: check-commits: diff --git a/.github/workflows/create-pre-release.yml b/.github/workflows/create-pre-release.yml index 3060ccf3..4cf1aa8c 100644 --- a/.github/workflows/create-pre-release.yml +++ b/.github/workflows/create-pre-release.yml @@ -11,39 +11,39 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository - uses: actions/checkout@v3 + - name: Checkout repository + uses: actions/checkout@v3 - - name: Calculate Diff - id: diff - run: | - if [ $(git rev-parse --is-shallow-repository) = true ]; then - git fetch --unshallow - fi - if [ $(git rev-list --count HEAD) -gt 1 ]; then - git diff HEAD^ HEAD -- userChrome.css > diff.txt - else - echo "No previous commit to compare." > diff.txt - fi + - name: Calculate Diff + id: diff + run: | + if [ $(git rev-parse --is-shallow-repository) = true ]; then + git fetch --unshallow + fi + if [ $(git rev-list --count HEAD) -gt 1 ]; then + git diff HEAD^ HEAD -- userChrome.css > diff.txt + else + echo "No previous commit to compare." > diff.txt + fi - - name: Read Diff - id: read_diff - run: echo "::set-output name=diff::$(cat diff.txt)" + - name: Read Diff + id: read_diff + run: echo "::set-output name=diff::$(cat diff.txt)" - - name: Create Pre-Release - id: create_pre_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: "pre-release-${{ github.sha }}" - release_name: "Pre-Release ${{ github.sha }}" - body: | - Pre-release for commit ${{ github.sha }} + - name: Create Pre-Release + id: create_pre_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "pre-release-${{ github.sha }}" + release_name: "Pre-Release ${{ github.sha }}" + body: | + Pre-release for commit ${{ github.sha }} - Changes in userChrome.css: - ${{ steps.read_diff.outputs.diff }} - draft: false - prerelease: true - files: userChrome.css - make_latest: true + Changes in userChrome.css: + ${{ steps.read_diff.outputs.diff }} + draft: false + prerelease: true + files: userChrome.css + make_latest: true diff --git a/.github/workflows/format_repo.yml b/.github/workflows/format_repo.yml new file mode 100644 index 00000000..45b44169 --- /dev/null +++ b/.github/workflows/format_repo.yml @@ -0,0 +1,28 @@ +name: Format Repository + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + format: + name: Format code + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{ github.head_ref }} + + - name: Run Prettier + uses: creyD/prettier_action@v4.6 + with: + prettier_options: ${{ github.event_name == 'pull_request' && '--check .' || '--write .' }} + commit_message: "gh-actions: format code" + github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/issue_comment.yml b/.github/workflows/issue_comment.yml index 7450349f..f44a76c1 100644 --- a/.github/workflows/issue_comment.yml +++ b/.github/workflows/issue_comment.yml @@ -9,36 +9,36 @@ jobs: runs-on: ubuntu-latest steps: - - name: Check if comment contains specific text - if: contains(github.event.comment.body, 'I do not have a login for this website so contributions are welcome. :)') - run: | - echo "Comment contains the specified text." + - name: Check if comment contains specific text + if: contains(github.event.comment.body, 'I do not have a login for this website so contributions are welcome. :)') + run: | + echo "Comment contains the specified text." - # Add labels to the issue - curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels \ - -d '{"labels":["help wanted", "no account"]}' + # Add labels to the issue + curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels \ + -d '{"labels":["help wanted", "no account"]}' - # Unassign the current user from the issue - curl -s -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees \ - -d '{"assignees":["${{ github.actor }}"]}' + # Unassign the current user from the issue + curl -s -X DELETE -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees \ + -d '{"assignees":["${{ github.actor }}"]}' - # Assign the issue creator to the issue - curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees \ - -d '{"assignees":["${{ github.event.issue.user.login }}"]}' + # Assign the issue creator to the issue + curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/assignees \ + -d '{"assignees":["${{ github.event.issue.user.login }}"]}' - - name: Add issue to "Need help" status and "No login" priority in project - env: - PROJECT_ID: "USER_PROJECT_ID" # Replace with your project's ID - TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - # Add issue to project - curl -X POST -H "Authorization: Bearer $TOKEN" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/projects/${PROJECT_ID}/columns/COLUMN_ID/cards \ - -d '{"content_id": "${{ github.event.issue.id }}", "content_type": "Issue"}' + - name: Add issue to "Need help" status and "No login" priority in project + env: + PROJECT_ID: "USER_PROJECT_ID" # Replace with your project's ID + TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + # Add issue to project + curl -X POST -H "Authorization: Bearer $TOKEN" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/projects/${PROJECT_ID}/columns/COLUMN_ID/cards \ + -d '{"content_id": "${{ github.event.issue.id }}", "content_type": "Issue"}' diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index 01974f16..38274d75 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -1,7 +1,7 @@ # Sample workflow for building and deploying a Jekyll site to GitHub Pages name: Deployment -on: +on: workflow_run: workflows: ["Update styles.json"] # Match this to the name of your first workflow types: diff --git a/.github/workflows/map-issues.yml b/.github/workflows/map-issues.yml index ec5dd711..879914f8 100644 --- a/.github/workflows/map-issues.yml +++ b/.github/workflows/map-issues.yml @@ -18,7 +18,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v3 with: - node-version: '16' + node-version: "16" - name: Install GitHub CLI run: | @@ -45,7 +45,7 @@ jobs: run: | # Extract project ID from the URL PROJECT_ID=$(echo "${PROJECT_URL}" | grep -oE "projects/[0-9]+" | cut -d'/' -f2) - + # Iterate through all issues and add them to the project for issue_number in $(jq -r '.[].number' all_issues.json); do issue_data=$(jq ".[] | select(.number == ${issue_number})" all_issues.json) diff --git a/.github/workflows/pr-comment.yml b/.github/workflows/pr-comment.yml index a79cef30..7a65ae82 100644 --- a/.github/workflows/pr-comment.yml +++ b/.github/workflows/pr-comment.yml @@ -9,82 +9,82 @@ jobs: runs-on: ubuntu-latest steps: - - name: Add comment to new pull request - uses: actions/github-script@v6 - with: - script: | - github.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - body: ` - ## Contributing styles + - name: Add comment to new pull request + uses: actions/github-script@v6 + with: + script: | + github.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + body: ` + ## Contributing styles - > ### Please make sure you go through all the provided instructions before submitting a new theme with a PR. + > ### Please make sure you go through all the provided instructions before submitting a new theme with a PR. - 1. You can use the [example.com.css](https://github.com/sameerasw/my-internet/raw/refs/heads/main/websites/example.com.css) as a starter for most websites to grab the stylesheet format. - 2. Make sure the file is named in the correct format [website domain].css (google.com.css and docs.google.com.css are 2 styles which are not merged unless you do 9.) - 3. Please respect auto theming for day and night themes. If the website does not have a dark theme, account for dark reader. - 4. Do not use wildcards such as applying transparency for all div elements since that is handled with force theming in the addon. - 5. Every property should include \`!important\` to make sure it gets applied. - 6. Do NOT leave commented out code. - 7. Don't include \`www\` in the stylesheet file name. - 8. Add proper comments for each section of a feature at the beginning with a clear but compact description. - 9. For theming similar domains like app.arduino.cc , login.arduino.cc ..... similar urls with \`prefixes\`, you can add a general style with a leading \`+\` symbol when creating the stylesheet. ( \`+arduino.cc.css\` ) [example](https://github.com/sameerasw/my-internet/blob/main/websites/%2Bnixos.org.css) - 10. Similarly, for theming websites with a shared domain but with different \`suffixes\` (like google.com, google.lk...), you can add the \`-\` symbol to the start of the stylesheet file name so it will replace the provided domain of the file name's domain. (\`-google.com.css\`). [example](https://github.com/sameerasw/my-internet/blob/main/websites/-ebay.com.css) - 11. [optional] Each comment of the same file should have a unique domain specific identified prefix (yt- ytm- gh- ...) which will help the browser to separately apply themes. - - \`\`\` - /* yt-transparency */ - :root{ - --colorBgApp: transparent !important; - } - - /* yt-no footer */ - footer.app-footer { - display: none !important; - } - \`\`\` + 1. You can use the [example.com.css](https://github.com/sameerasw/my-internet/raw/refs/heads/main/websites/example.com.css) as a starter for most websites to grab the stylesheet format. + 2. Make sure the file is named in the correct format [website domain].css (google.com.css and docs.google.com.css are 2 styles which are not merged unless you do 9.) + 3. Please respect auto theming for day and night themes. If the website does not have a dark theme, account for dark reader. + 4. Do not use wildcards such as applying transparency for all div elements since that is handled with force theming in the addon. + 5. Every property should include \`!important\` to make sure it gets applied. + 6. Do NOT leave commented out code. + 7. Don't include \`www\` in the stylesheet file name. + 8. Add proper comments for each section of a feature at the beginning with a clear but compact description. + 9. For theming similar domains like app.arduino.cc , login.arduino.cc ..... similar urls with \`prefixes\`, you can add a general style with a leading \`+\` symbol when creating the stylesheet. ( \`+arduino.cc.css\` ) [example](https://github.com/sameerasw/my-internet/blob/main/websites/%2Bnixos.org.css) + 10. Similarly, for theming websites with a shared domain but with different \`suffixes\` (like google.com, google.lk...), you can add the \`-\` symbol to the start of the stylesheet file name so it will replace the provided domain of the file name's domain. (\`-google.com.css\`). [example](https://github.com/sameerasw/my-internet/blob/main/websites/-ebay.com.css) + 11. [optional] Each comment of the same file should have a unique domain specific identified prefix (yt- ytm- gh- ...) which will help the browser to separately apply themes. + + \`\`\` + /* yt-transparency */ + :root{ + --colorBgApp: transparent !important; + } + + /* yt-no footer */ + footer.app-footer { + display: none !important; + } + \`\`\` - 12. Always make sure the first feature is \`transparency\` and also use the exact feature name without a difference allowing the global transparency toggle to work. Prefixes with \`-\` are acceptable. - 13. Don't keep the firefox selectors if you are copying over from the userContent.css (remove \`@-moz-document domain(" ")\` ) - 14. Once committed to the repository, github actions will parse the css file and update/ generate the [styles.js](https://github.com/sameerasw/my-internet/blob/main/styles.json) and then will be deployed to the github pages allowing the add-on to fetch from it. + 12. Always make sure the first feature is \`transparency\` and also use the exact feature name without a difference allowing the global transparency toggle to work. Prefixes with \`-\` are acceptable. + 13. Don't keep the firefox selectors if you are copying over from the userContent.css (remove \`@-moz-document domain(" ")\` ) + 14. Once committed to the repository, github actions will parse the css file and update/ generate the [styles.js](https://github.com/sameerasw/my-internet/blob/main/styles.json) and then will be deployed to the github pages allowing the add-on to fetch from it. - > + > - ### Thank you <3 - ` - }) + ### Thank you <3 + ` + }) - - name: Assign PR to author - uses: actions/github-script@v6 - with: - script: | - github.issues.addAssignees({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - assignees: [context.payload.pull_request.user.login] - }) + - name: Assign PR to author + uses: actions/github-script@v6 + with: + script: | + github.issues.addAssignees({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + assignees: [context.payload.pull_request.user.login] + }) - - name: Add reviewer to PR - uses: actions/github-script@v6 - with: - script: | - github.pulls.requestReviewers({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: context.payload.pull_request.number, - reviewers: ['sameerasw'] - }) + - name: Add reviewer to PR + uses: actions/github-script@v6 + with: + script: | + github.pulls.requestReviewers({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: context.payload.pull_request.number, + reviewers: ['sameerasw'] + }) - - name: Add 'theme' label to PR - uses: actions/github-script@v6 - with: - script: | - github.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: context.payload.pull_request.number, - labels: ['theme'] - }) + - name: Add 'theme' label to PR + uses: actions/github-script@v6 + with: + script: | + github.issues.addLabels({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.payload.pull_request.number, + labels: ['theme'] + }) diff --git a/.github/workflows/update-styles-json.yml b/.github/workflows/update-styles-json.yml index 36e73a24..45ba072f 100644 --- a/.github/workflows/update-styles-json.yml +++ b/.github/workflows/update-styles-json.yml @@ -3,7 +3,7 @@ name: Update styles.json on: push: paths: - - 'websites/**/*.css' + - "websites/**/*.css" workflow_dispatch: jobs: @@ -17,7 +17,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '14' + node-version: "14" - name: Install dependencies run: npm install diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..a80a997f --- /dev/null +++ b/.prettierignore @@ -0,0 +1,5 @@ +LICENSE +package-lock.json +node_modules +.github/workflows/*.yml +styles.json diff --git a/.prettierrc.json b/.prettierrc.json new file mode 100644 index 00000000..1fc13ef5 --- /dev/null +++ b/.prettierrc.json @@ -0,0 +1,6 @@ +{ + "tabWidth": 2, + "useTabs": false, + "singleQuote": false, + "printWidth": 200 +}