Skip to content

Commit

Permalink
암것도안함
Browse files Browse the repository at this point in the history
  • Loading branch information
archmagece committed Jul 19, 2024
1 parent c239ee8 commit 706bf74
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 40 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

Proxy, Mirror를 같이 하려고 했는데... 귀찮아서 proxy만 남길 예정

- [v] Maven
- [ ] Apt
- [x] Maven
- [x] Apt
- [ ] Npm
- [ ] Go
- [ ] Python
Expand Down
7 changes: 7 additions & 0 deletions conf/global.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
base_dir: ~/tmp
config_dir: ~/tmp/config

cache_enabled: false
cache_dir: ~/tmp/cache
mirror_enabled: false
mirror_dir: ~/tmp/mirror
17 changes: 8 additions & 9 deletions conf/mirror-apt.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
server:
path: ~/tmp/cachedir/mirror/apt
servers:
- name: official
url: http://archive.ubuntu.com/ubuntu
- name: kakao
url: http://mirror.kakao.com/ubuntu
- name: ubuntu-security
url: http://security.ubuntu.com/ubuntu
path: ~/tmp/cachedir/mirror/apt
servers:
- name: official
url: http://archive.ubuntu.com/ubuntu
- name: kakao
url: http://mirror.kakao.com/ubuntu
- name: ubuntu-security
url: http://security.ubuntu.com/ubuntu
5 changes: 3 additions & 2 deletions conf/mirror-git.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
server:
path: ~/tmp/cachedir/mirror/apt
servers:
gitrepo:
service: git
url: https://github.com/zitryss/go-sample.git
Expand All @@ -9,4 +10,4 @@ server:
steamit:
service: github
type: org
url:
url:
16 changes: 14 additions & 2 deletions routers/base_router.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
package routers

import (
"deproxy/configs"
"github.com/gin-gonic/gin"
)

//SetupRouter function will perform all route operations
// SetupRouter function will perform all route operations
func SetupRouter() *gin.Engine {
r := gin.Default()

//Giving access to storage folder
r.Static("/storage", "storage")

//Giving access to template folder
r.Static("/templates", "templates")
//r.Static("/templates", "templates")
r.LoadHTMLGlob("templates/*")

r.GET("/", func(c *gin.Context) {
mvnSite := configs.MavenConfig{}
mvnSite.ReadConfig("conf/proxy-maven.yaml")
aptSite := configs.AptConfig{}
aptSite.ReadConfig("conf/proxy-apt.yaml")
c.HTML(200, "dashboard.html", gin.H{
"maven": mvnSite.Servers,
"apt": aptSite.Servers,
})
})

//r.Use(func(c *gin.Context) {
// // add header Access-Control-Allow-Origin
// c.Writer.Header().Set("Content-Type", "application/json")
Expand Down
34 changes: 29 additions & 5 deletions templates/dashboard.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,34 @@
<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="UTF-8">
<title>Title</title>
<meta name="viewport" content="width=device-width"/>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Deproxy Dashboard</title>
<style type="text/css">
body {
margin: 0 auto;
padding: 0;
min-width: 100%;
font-family: sans-serif;
}
</style>
</head>
<body>

<body bgcolor="#009587">

<h1>Deproxy Dashboard</h1>

<h2>Maven</h2>
{{range .maven}}
<div><a href="{{.Url}}">{{.Name}}</a> {{.Url}}</div>
{{end}}

<h2>Apt</h2>
{{range .apt}}
<div><a href="{{.Url}}">{{.Name}}</a> {{.Url}}</div>
{{end}}

</body>
</html>
</html>
20 changes: 0 additions & 20 deletions templates/demo.html

This file was deleted.

0 comments on commit 706bf74

Please sign in to comment.