Skip to content

MamoruDS/redir_page

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Redir Page

URL scheme is a nice to have feature, but it is not as easy to use as a normal URL, which you can access with a single click on a website or any IM app. This repository allows you to access your URL scheme easily through redirection.

Usage

You have the option to use either the Redir Page through GitHub Page or Cloudflare Worker. The GH Pager version will simply open the target URL in your browser, whereas the CF Worker version uses HTTP redirection and offers additional features, such as UA filtering and token authentication.

Use via GitHub Page

https://mamoruds.github.io/redir_page/?redir=<your_url>

Example:

shortcuts://run-shortcut?name=Show clipboard content

Original url should be encoded:

https://mamoruds.github.io/redir_page?redir=shortcuts%3A%2F%2Frun-shortcut%3Fname%3DShow%20clipboard%20content

Use via Cloudflare Worker

First, deploy the worker to your Cloudflare account

git clone https://github.com/MamoruDS/redir_page.git \
    && cd redir_page/worker

# fill in the KV binding in wrangler.toml before publishing
wrangle publish

You can now access your URL scheme with the same usage as the GH Pager version

https://<worker_route>/?redir=<your_url>

# example
https://redir.foo.workers.dev/?redir=shortcuts%3A%2F%2Frun-shortcut%3Fname%3DShow%20clipboard%20content

To enable more advanced features, you can add redir records in the KV. The records are stored in YAML and have the following interface:

type RedirRec = {
    value: string
    fake_value?: string
    ua_excludes?: string[] // regex patterns
    require_token?: boolean
    tokens?: {
        value: string
        expire: number // -1 for never expire
    }[]
    enabled: boolean
}

Example:

# key=demo01
value: tg://open
fake_value: shortcuts://run-shortcut?name=Show clipboard content
ua_excludes:
  - Macintosh.*Safari
  - Chrome
  - Firefox\/1\d{2}
enabled: true
curl -A 'Chrome' -I 'https://redir.foo.workers.dev/?key=demo01'
# HTTP/1.1 302 Found
# date: Sun, 09 Apr 2023 10:41:11 GMT
# location: shortcuts://run-shortcut?name=Show%20clipboard%20content
# ...

About

Github page for url redirection

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published