diff --git a/.gitignore b/.gitignore index 9ab870d..7398339 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ generated/ +output/ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 26be3ae..04f0775 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,27 @@ # Contributing guide -Thank you for investing your time in contributing to our project! Any contribution you make will be reflected on [mshibanami.github.io/redirect-web](https://mshibanami.github.io/redirect-web/). +Thank you for investing your time in contributing to our project! -## Livereload +## File structure -This website is powered by Docsify, and you can livereload it with their `docsify-cli`. +- `docs/`: A documentation of Redirect Web for Safari, which is hosted as [mshibanami.github.io/redirect-web](https://mshibanami.github.io/redirect-web/). +- `library/`: Data of the library available on the app, such as rules and categories. + +### Documentation + +#### Livereload + +The documentation is powered by Docsify, and you can livereload it with their `docsify-cli`. Please check [their repository](https://github.com/docsifyjs/docsify-cli), and install it. -Once it's ready, run this command in the repository root of redirect-web. +Once it's ready, run this command in the repository root: ```sh $ docsify serve docs/ ``` Livereload makes maintaining the documentation easier. + +### Library + +Please check [Library's README](./library/README.md). diff --git a/README.md b/README.md index d4e1b78..544fa17 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Redirect Web for Safari -This is a repository for [the support website of Redirect Web for Safari](https://mshibanami.github.io/redirect-web). +This is a repository for [the support website of Redirect Web for Safari](https://mshibanami.github.io/redirect-web) and a library of redirect rules. In addition, we provides these on GitHub: diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..e420c47 --- /dev/null +++ b/build.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +cd "$(dirname "${BASH_SOURCE:-$0}")" + +./docs/scripts/generate-rule-set-list.sh + +rm -rf output +mkdir -p output/redirect-web +cp -R docs/* output/redirect-web diff --git a/docs/_sidebar.md b/docs/_sidebar.md index 9996f29..3c19a6a 100644 --- a/docs/_sidebar.md +++ b/docs/_sidebar.md @@ -2,6 +2,8 @@ - How to Use - [Redirect Rule](redirect-rule) - [Export/Import Rules](export-or-import-rules) +- Library + - [Add Your Rules to Library](add-your-rules-to-library) - Q&A - [FAQ](faq) - [Contact Us](contact-us) diff --git a/docs/rules-in-library/8_twitter_redirect_to_nitter/rule-set.json b/docs/rules-in-library/8_twitter_redirect_to_nitter/rule-set.json deleted file mode 100644 index 54b2610..0000000 --- a/docs/rules-in-library/8_twitter_redirect_to_nitter/rule-set.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "bundleID": "io.github.mshibanami.RedirectWebForSafari", - "kind": "RedirectList", - "redirects": [ - { - "comments": "This is a rule that automatically redirects users from twitter.com to nitter.com, providing a faster and more privacy-focused browsing experience by avoiding Elon Musk's tracking and advertisements. You can change the nitter.net to another instance of Nitter if you want. Find the list of other instances in https://github.com/zedeus/nitter/wiki/Instances .", - "destinationURLPattern": "https:\/\/nitter.net\/$2", - "exampleURLs": [ - "https:\/\/twitter.com\/mshibanami\/status\/1556979987244523520", - "https:\/\/x.com\/mshibanami\/status\/1556979987244523520" - ], - "kind": "Redirect", - "sourceURLPattern": { - "type": "regularExpression", - "value": "https:\\\/\\\/(twitter\\.com|x\\.com)\\\/(.*)" - }, - "title": "Twitter: Redirect to Nitter" - } - ] -} diff --git a/docs/scripts/generate-rule-set-list.sh b/docs/scripts/generate-rule-set-list.sh deleted file mode 100755 index 7a29999..0000000 --- a/docs/scripts/generate-rule-set-list.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -cd "$(dirname "${BASH_SOURCE:-$0}")" - -supported_json_files=( - "rule-set.json" - "rule-set.redirectweb" -) - -combined='[]' -for dir in ../rules-in-library/*; do - if [ -d "$dir" ]; then - id=$(basename "$dir" | cut -d'_' -f1) - - if ! [[ $id =~ ^[0-9]+$ ]]; then - echo "❌ Error: Directory $dir does not start with '_' format." - exit 1 - fi - - json_file="" - for file in "${supported_json_files[@]}"; do - if [ -f "$dir/$file" ]; then - json_file="$dir/$file" - break - fi - done - - if [ -n "$json_file" ]; then - processed_json=$(jq --argjson id "$id" '{id: $id|tonumber, redirectList: .}' "$json_file") - combined=$(echo "$combined" | jq --argjson newElement "$processed_json" '. += [$newElement]') - fi - fi -done - -wrapped=$(echo "$combined" | jq '{ "ruleSets": . }') -output_dir="../generated/rule-set/" -mkdir -p $output_dir -echo "$wrapped" > $output_dir/list.json -echo "✅ Created list.json" diff --git a/library/README.md b/library/README.md new file mode 100644 index 0000000..de8cf28 --- /dev/null +++ b/library/README.md @@ -0,0 +1,93 @@ +# Library + +The library is shown in the Redirect Web apps and the data under the `library` folder may be used in the app. + +## Rule Sets + +Rule sets within the library are managed at [library/rule-sets](https://github.com/mshibanami/redirect-web/tree/main/library/rule-sets). + +Each rule is identified by a unique integer ID. All data in a rule set should be in a folder named `{id}_{short-title-of-rule-set}`. This folder should contain: + +- `rule-set.json` +- `metadata.json` + +Folders of deleted rule sets remain like `8_DELETED`, ensuring that IDs remain unique. + +You can submit a pull request to add your rule to the library. + +> [!WARNING] +> Old rules will persist in the Git history, although you can modify or remove your rules after creation. + +## `rule-set.json` + +This file defines a rule set containing one or more rules. It's essentially equivalent to the `redirectweb` file you can get by exporting your rules from the Redirect Web apps. + +> [!NOTE] +> The file extension is `json` because it's easier to browse on GitHub. + +Below is an example of `rule-set.json` that configures Google Meet links to open in Google Chrome: + +```json +{ + "bundleID": "io.github.mshibanami.RedirectWebForSafari", + "kind": "RedirectList", + "redirects": [ + { + "appURL": "file:\/\/\/Applications\/Google%20Chrome.app", + "comments": "This is a rule to open Google Meet links in Google Chrome automatically.", + "destinationURLPattern": "$0", + "exampleURLs": [ + "https:\/\/meet.google.com\/xxx-yyyy-zzz" + ], + "kind": "Redirect", + "sourceURLPattern": { + "type": "regularExpression", + "value": "https:\/\/meet.google.com\/[a-z]*-[a-z]*-[a-z]*" + }, + "title": "Google Meet: Open in Chrome" + } + ] +} +``` + +## `metadata.json` + +This file contains metadata of a rule set. + +```json +{ + "authors": [ + { + "name": "Author Name 1", + "gitHubID": "author-github-id1" + }, + { + "name": "Author Name 2", + "gitHubID": "author-github-id2", + } + ], + "imageURLs": [ + "https://somewhere-on-the-internet.com/path/to/your-rule-set-image.jpg" + ], + "aboutURL": "https://somewhere-on-the-internet.com/path/to/the-rule-set-details.html", + "title": "A title of the rule set", + "description": "A description of the rule set.", + "version": "1.0.0", + "primaryCategoryID": "gaming", + "secondaryCategoryID": "productivity" +} +``` + +- `authors`: A list of rule set's authors. + - `name`: The name of an author. + - `gitHubID`: The GitHub ID of an author. +- `imageURLs` (optional): A list of image URLs of the rule set. +- `videoURLs` (optional): A list of video URLs for the rule set, including: + - A direct link to a video file that QuickTime Player can play, or, + - A YouTube video URL. +- `aboutURL` (optional): A link to a webpage where users can learn more about the rule set. +- `title`: A short title of the rule set. +- `description`: A description of the rule set. This is optional when the first rule in the rule set has non-empty `comments`. +- `version`: A version of the rule set, which should follow [Semantic Versioning](https://semver.org). +- `primaryCategoryID`: A primary category ID of the rule set. Find a list of the categories in [categories.json](./categories.json). +- `secondaryCategoryID` (optional): A secondary category ID of the rule set. diff --git a/library/categories.json b/library/categories.json new file mode 100644 index 0000000..16608e4 --- /dev/null +++ b/library/categories.json @@ -0,0 +1,134 @@ +{ + "categories": [ + { + "id": "social_media", + "name": "Social Media", + "emoji": "👍" + }, + { + "id": "search", + "name": "Search", + "emoji": "🔍" + }, + { + "id": "education", + "name": "Education", + "emoji": "🎓" + }, + { + "id": "reference", + "name": "Reference", + "emoji": "📖" + }, + { + "id": "productivity", + "name": "Productivity", + "emoji": "🧠" + }, + { + "id": "software_development", + "name": "Software Development", + "emoji": "💻" + }, + { + "id": "entertainment", + "name": "Entertainment", + "emoji": "🍿" + }, + { + "id": "shopping", + "name": "Shopping", + "emoji": "👜" + }, + { + "id": "health_and_fitness", + "name": "Health", + "emoji": "💊" + }, + { + "id": "travel", + "name": "Travel", + "emoji": "🏝️" + }, + { + "id": "news", + "name": "News", + "emoji": "🗞️" + }, + { + "id": "finance", + "name": "Finance", + "emoji": "📈" + }, + { + "id": "business", + "name": "Business", + "emoji": "📊" + }, + { + "id": "government", + "name": "Government", + "emoji": "🏢" + }, + { + "id": "science", + "name": "Science", + "emoji": "🔬" + }, + { + "id": "arts_and_crafts", + "name": "Arts & Crafts", + "emoji": "🎨" + }, + { + "id": "sports", + "name": "Sports", + "emoji": "⚽️" + }, + { + "id": "photo_and_video", + "name": "Lifestyle", + "emoji": "🌇" + }, + { + "id": "legal", + "name": "Legal", + "emoji": "🧑‍⚖️" + }, + { + "id": "gaming", + "name": "Gaming", + "emoji": "🎮" + }, + { + "id": "real_estate", + "name": "Real Estate", + "emoji": "🏠" + }, + { + "id": "transport", + "name": "Transport", + "emoji": "🚅" + }, + { + "id": "jobs_and_careers", + "name": "Jobs & Careers", + "emoji": "🧑‍💼" + }, + { + "id": "nonprofits", + "name": "Nonprofits", + "emoji": "🖐️" + }, + { + "id": "food_and_cooking", + "name": "Food & Cooking", + "emoji": "🥗" + }, + { + "id": "other", + "name": "Other", + "emoji": null + } + ] +} diff --git a/library/rule-sets/0_example-rule/metadata.json b/library/rule-sets/0_example-rule/metadata.json new file mode 100644 index 0000000..7c8a878 --- /dev/null +++ b/library/rule-sets/0_example-rule/metadata.json @@ -0,0 +1,15 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "Example Redirect Rule", + "description": "An example rule.", + "version": "1.0.0", + "primaryCategoryID": "other" +} diff --git a/docs/rules-in-library/0_example_rule/rule-set.json b/library/rule-sets/0_example-rule/rule-set.json similarity index 100% rename from docs/rules-in-library/0_example_rule/rule-set.json rename to library/rule-sets/0_example-rule/rule-set.json diff --git a/library/rule-sets/1_google-meet-open-in-chrome/metadata.json b/library/rule-sets/1_google-meet-open-in-chrome/metadata.json new file mode 100644 index 0000000..20c2893 --- /dev/null +++ b/library/rule-sets/1_google-meet-open-in-chrome/metadata.json @@ -0,0 +1,16 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "Google Meet: Open in Chrome", + "description": "A rule to open Google Meet links in Google Chrome automatically.", + "version": "1.0.0", + "primaryCategoryID": "productivity", + "secondaryCategoryID": "business" +} diff --git a/docs/rules-in-library/1_google-meet-open-in-chrome/rule-set.json b/library/rule-sets/1_google-meet-open-in-chrome/rule-set.json similarity index 100% rename from docs/rules-in-library/1_google-meet-open-in-chrome/rule-set.json rename to library/rule-sets/1_google-meet-open-in-chrome/rule-set.json diff --git a/library/rule-sets/2_notion-open-in-notion-app/metadata.json b/library/rule-sets/2_notion-open-in-notion-app/metadata.json new file mode 100644 index 0000000..427a422 --- /dev/null +++ b/library/rule-sets/2_notion-open-in-notion-app/metadata.json @@ -0,0 +1,15 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "Notion: Open in Notion App", + "description": "A rule to open Notion links in the Notion app automatically.", + "version": "1.0.0", + "primaryCategoryID": "productivity" +} diff --git a/docs/rules-in-library/2_notion-open-in-notion-app/rule-set.json b/library/rule-sets/2_notion-open-in-notion-app/rule-set.json similarity index 94% rename from docs/rules-in-library/2_notion-open-in-notion-app/rule-set.json rename to library/rule-sets/2_notion-open-in-notion-app/rule-set.json index 42524d5..f4d8a60 100644 --- a/docs/rules-in-library/2_notion-open-in-notion-app/rule-set.json +++ b/library/rule-sets/2_notion-open-in-notion-app/rule-set.json @@ -4,7 +4,7 @@ "redirects": [ { "appURL": "file:\/\/\/Applications\/Notion.app", - "comments": "Notion allows you to open the Notion app by changing the scheme of the Notion page URL from https to notion. This rule automates this process.", + "comments": "Notion allows you to open the Notion app by changing the scheme of the Notion page URL from https to notion. This rule automates that process.", "destinationURLPattern": "notion:\/\/$1", "exampleURLs": [ "https:\/\/www.notion.so\/Quick-Note-c5a2f0fa248e4de38ab1866c25cffe10" diff --git a/library/rule-sets/3_wikipedia-open-in-wikiwand/metadata.json b/library/rule-sets/3_wikipedia-open-in-wikiwand/metadata.json new file mode 100644 index 0000000..d270efb --- /dev/null +++ b/library/rule-sets/3_wikipedia-open-in-wikiwand/metadata.json @@ -0,0 +1,15 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "Wikipedia: Open in Wikiwand", + "description": "Open Wikipedia pages in Wikiwand automatically.", + "version": "1.0.0", + "primaryCategoryID": "reference" +} diff --git a/docs/rules-in-library/3_wikipedia-open-in-wikiwand/rule-set.json b/library/rule-sets/3_wikipedia-open-in-wikiwand/rule-set.json similarity index 100% rename from docs/rules-in-library/3_wikipedia-open-in-wikiwand/rule-set.json rename to library/rule-sets/3_wikipedia-open-in-wikiwand/rule-set.json diff --git a/library/rule-sets/4_github-hide-whitespace-changes-in-pull-request/metadata.json b/library/rule-sets/4_github-hide-whitespace-changes-in-pull-request/metadata.json new file mode 100644 index 0000000..b8e613a --- /dev/null +++ b/library/rule-sets/4_github-hide-whitespace-changes-in-pull-request/metadata.json @@ -0,0 +1,15 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "GitHub: Ignore Whitespace Changes in a Pull Request", + "description": "This hides whitespace changes in a pull request on GitHub automatically.", + "version": "1.0.0", + "primaryCategoryID": "software_development" +} diff --git a/docs/rules-in-library/4_github-hide-whitespace-changes-in-pull-request/rule-set.json b/library/rule-sets/4_github-hide-whitespace-changes-in-pull-request/rule-set.json similarity index 100% rename from docs/rules-in-library/4_github-hide-whitespace-changes-in-pull-request/rule-set.json rename to library/rule-sets/4_github-hide-whitespace-changes-in-pull-request/rule-set.json diff --git a/library/rule-sets/5_figma-open-in-figma-app/metadata.json b/library/rule-sets/5_figma-open-in-figma-app/metadata.json new file mode 100644 index 0000000..3225d46 --- /dev/null +++ b/library/rule-sets/5_figma-open-in-figma-app/metadata.json @@ -0,0 +1,15 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "Figma: Open in Figma App", + "description": "Open Figma links in the Figma app automatically.", + "version": "1.0.0", + "primaryCategoryID": "arts_and_crafts" +} diff --git a/docs/rules-in-library/5_figma-open-in-figma-app/rule-set.json b/library/rule-sets/5_figma-open-in-figma-app/rule-set.json similarity index 86% rename from docs/rules-in-library/5_figma-open-in-figma-app/rule-set.json rename to library/rule-sets/5_figma-open-in-figma-app/rule-set.json index 4e8a68b..179fc16 100644 --- a/docs/rules-in-library/5_figma-open-in-figma-app/rule-set.json +++ b/library/rule-sets/5_figma-open-in-figma-app/rule-set.json @@ -4,7 +4,7 @@ "redirects": [ { "appURL": "file:\/\/\/Applications\/Figma.app", - "comments": "", + "comments": "This is a rule to open Figma links in the Figma app automatically.", "destinationURLPattern": "figma:\/\/$1", "exampleURLs": [ "https:\/\/www.figma.com\/file\/XZp2hMcv4s3gmqKtXg4uupfX\/Personal-Colors?node-id=2%3A22" diff --git a/library/rule-sets/6_redirect-from-google-search-to-youtube/metadata.json b/library/rule-sets/6_redirect-from-google-search-to-youtube/metadata.json new file mode 100644 index 0000000..d42127f --- /dev/null +++ b/library/rule-sets/6_redirect-from-google-search-to-youtube/metadata.json @@ -0,0 +1,17 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": [ + "https://private-user-images.githubusercontent.com/1333214/241560627-ef8abf48-fa9d-4bb4-9298-7e78cde5e5d9.mov?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTAwNTEzNTAsIm5iZiI6MTcxMDA1MTA1MCwicGF0aCI6Ii8xMzMzMjE0LzI0MTU2MDYyNy1lZjhhYmY0OC1mYTlkLTRiYjQtOTI5OC03ZTc4Y2RlNWU1ZDkubW92P1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDMxMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDAzMTBUMDYxMDUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NGI1MDJiZTc5NzkzYzQ4OWJlMzg5YTcyNjUzMDA3MzU0ODZlZTY3YzU3ZjA2NTZlNjNjNzY5Y2MzMmIxOGI5MiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.cDgH4bPIqDqoze6_v39IFXEA-OhACgheG_VYvF4n6t4" + ], + "aboutURL": null, + "title": "Google Search: From Video Tab to YouTube's Search Results", + "description": "This redirects from the Videos tab on Google Search to the search results on YouTube automatically.", + "version": "1.0.0", + "primaryCategoryID": "search" +} diff --git a/docs/rules-in-library/6_redirect-from-google-search-to-youtube/rule-set.json b/library/rule-sets/6_redirect-from-google-search-to-youtube/rule-set.json similarity index 100% rename from docs/rules-in-library/6_redirect-from-google-search-to-youtube/rule-set.json rename to library/rule-sets/6_redirect-from-google-search-to-youtube/rule-set.json diff --git a/library/rule-sets/7_minecraft-fandom-wiki-to-mincraft-wiki/metadata.json b/library/rule-sets/7_minecraft-fandom-wiki-to-mincraft-wiki/metadata.json new file mode 100644 index 0000000..c3aa7bb --- /dev/null +++ b/library/rule-sets/7_minecraft-fandom-wiki-to-mincraft-wiki/metadata.json @@ -0,0 +1,15 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "Minecraft Wiki: From Fandom to minecraft.wiki", + "description": "This redirects from Minecraft Wiki on Fandom to the new domain at minecraft.wiki.", + "version": "1.0.0", + "primaryCategoryID": "gaming" +} diff --git a/docs/rules-in-library/7_minecraft_fandom_wiki_to_mincraft_wiki/rule-set.json b/library/rule-sets/7_minecraft-fandom-wiki-to-mincraft-wiki/rule-set.json similarity index 100% rename from docs/rules-in-library/7_minecraft_fandom_wiki_to_mincraft_wiki/rule-set.json rename to library/rule-sets/7_minecraft-fandom-wiki-to-mincraft-wiki/rule-set.json diff --git a/library/rule-sets/8_DELETED/.gitkeep b/library/rule-sets/8_DELETED/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/library/rule-sets/9_terraria-fandom-wiki-to-wiki-gg/metadata.json b/library/rule-sets/9_terraria-fandom-wiki-to-wiki-gg/metadata.json new file mode 100644 index 0000000..f44e10f --- /dev/null +++ b/library/rule-sets/9_terraria-fandom-wiki-to-wiki-gg/metadata.json @@ -0,0 +1,15 @@ +{ + "authors": [ + { + "name": "Manabu Nakazawa", + "gitHubID": "mshibanami" + } + ], + "imageURLs": null, + "videoURLs": null, + "aboutURL": null, + "title": "Terraria Wiki: From Fandom to wiki.gg", + "description": "This redirects from Terraria Wiki on Fandom to the new domain at wiki.gg.", + "version": "1.0.0", + "primaryCategoryID": "gaming" +} diff --git a/docs/rules-in-library/9_terraria_fandom_wiki_to_wiki_gg/rule-set.json b/library/rule-sets/9_terraria-fandom-wiki-to-wiki-gg/rule-set.json similarity index 100% rename from docs/rules-in-library/9_terraria_fandom_wiki_to_wiki_gg/rule-set.json rename to library/rule-sets/9_terraria-fandom-wiki-to-wiki-gg/rule-set.json