Skip to content

Commit

Permalink
Update worker.js
Browse files Browse the repository at this point in the history
  • Loading branch information
crazypeace authored Jul 7, 2024
1 parent fb7c689 commit 7da4a87
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,11 @@ async function fetchHandler(e) {
const newUrl = path.replace(/(?<=com\/.+?\/.+?)\/(.+?\/)/, '@$1').replace(/^(?:https?:\/\/)?raw\.(?:githubusercontent|github)\.com/, 'https://cdn.jsdelivr.net/gh')
return Response.redirect(newUrl, 302)
} else if (path==='perl-pe-para') {
let reponseText = 's#(bash.*?\\.sh)([^/\\w\\d])#\\1 | perl -pe "\\$(curl -L ' + urlObj.origin + '/perl-pe-para)" \\2#g; s# (git)# https://\\1#g; s#(http.*?git[^/]*?/)#' + urlObj.origin + '/\\1#g';
return new Response( reponseText, { status: 200,
let perlstr = 'perl -pe'
let responseText = 's#(bash.*?\\.sh)([^/\\w\\d])#\\1 | ' + perlstr + ' "\\$(curl -L ' + urlObj.origin + '/perl-pe-para)" \\2#g; ' +
's# (git)# https://\\1#g; ' +
's#(http.*?git[^/]*?/)#' + urlObj.origin + '/\\1#g';
return new Response( responseText, { status: 200,
headers: {
'Content-Type': 'text/plain',
'Cache-Control': 'max-age=300'
Expand Down

0 comments on commit 7da4a87

Please sign in to comment.