top | item 33147327

(no title)

theowenyoung | 3 years ago

I have the same problem, so I use my personal domain [0] to redirect to repos page, it works great. here is the javascript code:

    async function handleRequest(request) {
      const requestUrl = new URL(request.url);
      let target = "https://github.com/theowenyoung?tab=repositories"
      if(requestUrl.pathname!=="/"){
        target = "https://github.com/theowenyoung"+requestUrl.pathname
      }
      return Response.redirect(target, 302);
    }
    addEventListener('fetch', async event => {
      event.respondWith(handleRequest(event.request));
    });
[0]: https://git.owenyoung.com

discuss

order

No comments yet.