Skip to content

Commit

Permalink
update blob
Browse files Browse the repository at this point in the history
  • Loading branch information
Sianao committed Dec 13, 2024
1 parent 2b55479 commit 4afc2e6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
5 changes: 3 additions & 2 deletions router/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,13 @@ func NewRouter(c *cache.Redis) *mux.Router {
http.Error(w, "bad address", 512)
return
}
fmt.Println(r.RequestURI)
r.RequestURI = strings.TrimPrefix(r.RequestURI, "/blob")
var address = fmt.Sprintf("https://raw.githubusercontent.com/%s/%s%s",
userBaisc[0], userBaisc[1], r.URL.Path)
userBaisc[0], userBaisc[1], r.RequestURI)
path := fmt.Sprintf("raw.githubusercontent.com/%s/%s%s",
userBaisc[0], userBaisc[1], r.URL.Path)

fmt.Println(address)
if c.Exists(path) {
r.URL.Path = path
http.FileServer(http.Dir("./cache/")).ServeHTTP(w, r)
Expand Down
3 changes: 1 addition & 2 deletions service/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ func PacketProxy(w http.ResponseWriter, r *http.Request, address string) {
if !ok {
v = []string{r.RemoteAddr}
}
length, _ := strconv.Atoi(w.Header().Get("Content-Length"))

length, _ := strconv.Atoi(r.Header.Get("Content-Length"))
DefaultLogFormatter(
LogFormatterParams{StatusCode: resp.StatusCode,
ContentLength: humanize.Bytes(uint64(length)), ClientIP: v[0], Method: r.Method, Path: r.URL.Path})
Expand Down
4 changes: 0 additions & 4 deletions src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,10 @@ export default function Home() {

</Head>
<AppTheme >
{/* <SimpleDialogDemo></SimpleDialogDemo> */}
<CssBaseline enableColorScheme />
<Hero />
<Features></Features>
<AppAppBar></AppAppBar>
<WalineComment></WalineComment>
<Footer></Footer>

</AppTheme>
</>

Expand Down

0 comments on commit 4afc2e6

Please sign in to comment.