Compare commits

..

9 Commits

Author SHA1 Message Date
WJQSERVER
52fdaf5f81 24w18b 2024-10-17 10:43:36 +08:00
WJQSERVER
d6b8f2b812 hotfix 2024-10-17 09:57:14 +08:00
WJQSERVER
00d2113904 hotfix 2024-10-17 00:04:29 +08:00
WJQSERVER
670bca31ca 24w18a 2024-10-16 23:52:07 +08:00
WJQSERVER
f77de0d37a 24w18a 2024-10-16 23:32:25 +08:00
WJQSERVER
1c18ccc363 24w18a 2024-10-16 21:51:24 +08:00
WJQSERVER
a386304d42 update 2024-10-16 17:45:51 +08:00
WJQSERVER
a1fdd0f477 1.5.2 2024-10-16 15:19:10 +08:00
WJQSERVER
e94a98668e 24w17b 2024-10-16 13:08:58 +08:00
11 changed files with 78 additions and 33 deletions

View File

@@ -1,5 +1,23 @@
# 更新日志
24w18b
---
- PRE-RELEASE: 此版本是预发布版本,请勿在生产环境中使用
- CHANGE: 经团队考量,移除 Docker 代理功能,若造成了不便敬请谅解
- CHANGE: 修改日志检查周期
24w18a
---
- PRE-RELEASE: 此版本是预发布版本,请勿在生产环境中使用
- CHANGE: 改进Docker 代理
- CHANGE: 改进前端页面的copy提示,弃用alert提示
v1.5.2
---
- FIX: 修正flag传入问题
- CHANGE: 去除/路径重定向,改为返回403,并记录对应请求日志
- CHANGE: 优化Proxy模块的日志记录,记录请求详细信息
24w17b
---
- PRE-RELEASE: 此版本是v1.5.2的预发布版本,请勿在生产环境中使用

View File

@@ -1 +1 @@
24w17b
24w18b

View File

@@ -7,6 +7,8 @@
[DEMO](https://ghproxy.1888866.xyz)
[TG讨论群组](https://t.me/ghproxy_go)
## 项目说明
### 项目特点

View File

@@ -16,6 +16,7 @@
使用本项目,请遵循 **[WSL (WJQSERVER-STUDIO LICENSE)](https://wjqserver-studio.github.io/LICENSE/LICENSE.html)** 协议。
本项目所有文件均受到 WSL (WJQSERVER-STUDIO LICENSE) 协议保护,任何人不得在任何情况下以非 WSL (WJQSERVER-STUDIO LICENSE) 协议内规定的方式使用,复制,修改,编译,发布,分发,再许可,或者出售本项目的任何部分。
## 报告漏洞
如果您发现本项目存在安全漏洞,请通过发送ISSUES或尝试联系项目维护者来报告。请在您的报告中包含以下信息:

View File

@@ -1 +1 @@
1.5.1
1.5.2

View File

@@ -88,22 +88,11 @@
file_server
import cache 0s 24h
}
handle_errors {
@redirects `{err.status_code} in [301, 302, 307]`
reverse_proxy @redirects {
header_up Location {http.response.header.Location}
}
}
route /v2* {
reverse_proxy https://registry-1.docker.io {
header_up Host registry-1.docker.io
header_up X-Real-IP {remote}
header_up X-Forwarded-For {http.request.header.X-Forwarded-For}
header_up X-Forwarded-Proto {scheme}
header_up Authorization {http.request.header.Authorization}
}
}
route /api* {
rate_limit 15r/m 10000 429
import cache 0s 6h
}
}
import /data/caddy/config.d/*

View File

@@ -66,7 +66,7 @@ chmod +x /root/data/ghproxy/ghproxy
if [ -f /root/data/ghproxy/config/config.toml ]; then
echo "配置文件已存在, 跳过下载"
else
wget -O /root/data/ghproxy/config/config.toml https://raw.githubusercontent.com/WJQSERVER-STUDIO/ghproxy/main/config.toml
wget -O /root/data/ghproxy/config/config.toml https://raw.githubusercontent.com/WJQSERVER-STUDIO/ghproxy/main/deploy/config.toml
fi
# 替换 port = 8080

View File

@@ -66,7 +66,7 @@ chmod +x /root/data/ghproxy/ghproxy
if [ -f /root/data/ghproxy/config/config.toml ]; then
echo "配置文件已存在, 跳过下载"
else
wget -O /root/data/ghproxy/config/config.toml https://raw.githubusercontent.com/WJQSERVER-STUDIO/ghproxy/main/config.toml
wget -O /root/data/ghproxy/config/config.toml https://raw.githubusercontent.com/WJQSERVER-STUDIO/ghproxy/main/deploy/config.toml
fi
# 替换 port = 8080

View File

@@ -18,11 +18,11 @@ var (
logger *log.Logger
logChannel = make(chan string, 100)
quitChannel = make(chan struct{})
logFileMutex sync.Mutex // 保护 logFile 的互斥锁
logFileMutex sync.Mutex
logFilePath = "/data/ghproxy/log/ghproxy.log"
)
// Init 初始化日志记录器,接受日志文件路径作为参数
// 初始化,接受日志文件路径作为参数
func Init(logFilePath_input string, maxLogsize int) error {
logFileMutex.Lock()
defer logFileMutex.Unlock()
@@ -40,7 +40,6 @@ func Init(logFilePath_input string, maxLogsize int) error {
return nil
}
// logWorker 处理日志记录
func logWorker() {
for {
select {
@@ -53,38 +52,37 @@ func logWorker() {
}
}
// Log 直接记录日志的函数
func Log(customMessage string) {
logChannel <- customMessage
}
// Logw 用于格式化日志记录
// 格式化日志记录
func Logw(format string, args ...interface{}) {
message := fmt.Sprintf(format, args...)
Log(message)
}
// 日志等级INFO
// INFO
func LogInfo(format string, args ...interface{}) {
message := fmt.Sprintf(format, args...)
output := fmt.Sprintf("[INFO] %s", message)
Log(output)
}
// 日志等级WARNING
// WARNING
func LogWarning(format string, args ...interface{}) {
message := fmt.Sprintf(format, args...)
output := fmt.Sprintf("[WARNING] %s", message)
Log(output)
}
// 日志等级ERROR
// ERROR
func LogError(format string, args ...interface{}) {
message := fmt.Sprintf(format, args...)
Log(message)
}
// Close 关闭日志文件
// 关闭日志文件
func Close() {
logFileMutex.Lock()
defer logFileMutex.Unlock()
@@ -100,7 +98,7 @@ func Close() {
func monitorLogSize(logFilePath string, maxLogsize int) {
var maxLogsizeBytes int64 = int64(maxLogsize) * 1024 * 1024 // 最大日志文件大小单位为MB
for {
time.Sleep(600 * time.Second) // 每10分钟检查一次
time.Sleep(120 * time.Minute) // 每120分钟检查一次日志文件大小
logFileMutex.Lock()
info, err := logFile.Stat()
logFileMutex.Unlock()

View File

@@ -131,6 +131,28 @@
text-align: center;
line-height: 0.5;
}
#toast {
position: fixed;
top: 10%;
/* 垂直居中 */
left: 50%;
/* 水平居中 */
transform: translate(-50%, -50%);
/* 调整使其中心对齐 */
background-color: rgba(97, 97, 97, 0.7);
/* 半透明黑色背景 */
color: white;
/* 字体颜色 */
padding: 15px 20px;
/* 内边距 */
border-radius: 10px;
/* 圆角 */
font-size: 16px;
/* 字体大小 */
z-index: 1000;
/* 确保显示在其他元素上面 */
}
</style>
</head>
@@ -143,7 +165,7 @@
<button class="btn rounded-button" id="formatButton">获取文件链接</button>
<div class="code" id="outputBlock">
<button class="copy-button" id="copyButton" onclick="copyCode(this)">Copy</button>
<button class="copy-button" id="copyButton">Copy</button>
<pre id="formattedLinkOutput"></pre>
</div>
<div class="tips">
@@ -155,6 +177,10 @@
</div>
</div>
</div>
<div id="toast" style="display:none;">
链接已复制到剪贴板
</div>
<script>
function formatGithubLink() {
@@ -186,9 +212,20 @@
window.getSelection().addRange(range);
document.execCommand('copy');
window.getSelection().removeAllRanges();
alert('链接已复制到剪贴板');
//alert('链接已复制到剪贴板');
showToast('链接已复制到剪贴板');
});
function showToast(message) {
const toast = document.getElementById('toast');
toast.textContent = message;
toast.style.display = 'block';
setTimeout(() => {
toast.style.display = 'none';
}, 3000); // 3秒后隐藏
}
function fetchSizeLimit() {
fetch(window.location.origin + '/api/size_limit')
.then(response => response.json())
@@ -249,7 +286,7 @@
Copyright &copy; 2024 WJQSERVER-STUDIO
</p>
<p>
GitHub仓库地址<a href="https://github.com/WJQSERVER-STUDIO/ghproxy">https://github.com/WJQSERVER-STUDIO/ghproxy</a>
GitHub仓库地址<a href="https://github.com/WJQSERVER-STUDIO/ghproxy">https://github.com/WJQSERVER-STUDIO/ghproxy</a> <br><a href="https://t.me/ghproxy_go">Telegram交流群</a>
</p>
<div id="visitor-info" style="text-align: center; margin-top: 15px;">
<p>您的IP地址: <span id="visitor-ip"></span></p>

View File

@@ -155,7 +155,7 @@ func createHTTPClient(mode string) *req.Client {
client := req.C()
switch mode {
case "chrome":
client.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36").
client.SetUserAgent("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36").
SetTLSFingerprintChrome().
ImpersonateChrome()
case "git":