-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ab61ae
commit 4788e1f
Showing
4 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,13 @@ function App() { | |
https://open.lightxi.com/unpkg/<strong className={`point`}>[email protected]/umd/react.production.min.js</strong> | ||
</div> | ||
</div> | ||
|
||
<div className={`app`}> | ||
<a className={`title`} href={`https://cdnjs.com`} target={`_blank`}>Cdnjs</a> | ||
<div className={`code`}> | ||
https://open.lightxi.com/cdnjs/<strong className={`point`}>ajax/libs/vue/3.3.4/vue.cjs.js</strong> | ||
</div> | ||
</div> | ||
</div> | ||
<div className={`card-footer`}> | ||
powered by | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package packages | ||
|
||
import ( | ||
"fmt" | ||
"github.com/gofiber/fiber/v2" | ||
"proxy/utils" | ||
"strings" | ||
) | ||
|
||
func RegisterCdnJs(app *fiber.App) { | ||
app.All("/cdnjs/*", func(c *fiber.Ctx) error { | ||
source := strings.TrimPrefix(c.Path(), "/cdnjs") | ||
uri := fmt.Sprintf("https://cdnjs.cloudflare.com%s", source) | ||
data, err := utils.Get(uri, nil) | ||
if err != nil { | ||
return Catch(c, err) | ||
} | ||
|
||
return End(c, data, func(data string) string { | ||
return strings.Replace(data, "/ajax/libs", "/cdnjs/ajax/libs", -1) | ||
}) | ||
}) | ||
} |