v3.1.1 init

- Fixed path traverse bug in web server file manager
- Merged docker container list from main
- Updated version code
- Merged network status fix from PR
- Removed unused comments in dpcore
-
This commit is contained in:
tobychui 2024-08-07 13:53:43 +08:00
parent 1d965da7d0
commit a5ef6456c6
6 changed files with 22 additions and 22 deletions

View File

@ -59,9 +59,9 @@ var enableAutoUpdate = flag.Bool("cfgupgrade", true, "Enable auto config upgrade
var (
name = "Zoraxy"
version = "3.1.0"
version = "3.1.1"
nodeUUID = "generic" //System uuid, in uuidv4 format
development = false //Set this to false to use embedded web fs
development = true //Set this to false to use embedded web fs
bootTime = time.Now().Unix()
/*
@ -117,8 +117,8 @@ func SetupCloseHandler() {
func ShutdownSeq() {
SystemWideLogger.Println("Shutting down " + name)
SystemWideLogger.Println("Closing GeoDB ")
geodbStore.Close()
//SystemWideLogger.Println("Closing GeoDB")
//geodbStore.Close()
SystemWideLogger.Println("Closing Netstats Listener")
netstatBuffers.Close()
SystemWideLogger.Println("Closing Statistic Collector")

View File

@ -350,13 +350,6 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
}
}
//TODO: Figure out a way to proxy for proxmox
//if res.StatusCode == 501 || res.StatusCode == 500 {
// fmt.Println(outreq.Proto, outreq.RemoteAddr, outreq.RequestURI)
// fmt.Println(">>>", outreq.Method, res.Header, res.ContentLength, res.StatusCode)
// fmt.Println(outreq.Header, req.Host)
//}
//Add debug X-Proxy-By tracker
res.Header.Set("x-proxy-by", "zoraxy/"+rrr.Version)

View File

@ -42,6 +42,10 @@ func (fm *FileManager) HandleList(w http.ResponseWriter, r *http.Request) {
// Construct the absolute path to the target directory
targetDir := filepath.Join(fm.Directory, directory)
// Clean path to prevent path escape #274
targetDir = filepath.ToSlash(filepath.Clean(targetDir))
targetDir = strings.ReplaceAll(targetDir, "../", "")
// Open the target directory
dirEntries, err := os.ReadDir(targetDir)
if err != nil {

View File

@ -583,14 +583,14 @@
url: '/api/stats/netstatgraph?array=true',
success: function(data){
if (rxValues.length == 0){
rxValues = JSON.parse(JSON.stringify(data.Rx));
rxValues.push(...data.Rx);
}else{
rxValues.push(data.Rx[dataCount-1]);
rxValues.shift();
}
if (txValues.length == 0){
txValues = JSON.parse(JSON.stringify(data.Tx));
txValues.push(...data.Tx);
}else{
txValues.push(data.Tx[dataCount-1]);
txValues.shift();

View File

@ -30,7 +30,7 @@ Object.defineProperty(String.prototype, 'capitalize', {
//Add a new function to jquery for ajax override with csrf token injected
$.cjax = function(payload){
let requireTokenMethod = ["POST", "PUT", "DELETE"];;
let requireTokenMethod = ["POST", "PUT", "DELETE"];
if (requireTokenMethod.includes(payload.method) || requireTokenMethod.includes(payload.type)){
//csrf token is required
let csrfToken = document.getElementsByTagName("meta")["zoraxy.csrf.Token"].getAttribute("content");

View File

@ -34,7 +34,7 @@
<script>
const lines = {};
const linesAded = [];
const linesAded = {};
function getDockerContainers() {
const hostRequest = $.get("/api/proxy/list?type=host");
@ -54,7 +54,9 @@
Config: [{ Gateway: gateway }],
},
} = bridge;
const existedDomains = hostData.map(({ Domain }) => Domain);
const existedDomains = hostData.reduce((acc, { ActiveOrigins }) => {
return acc.concat(ActiveOrigins.map(({ OriginIpOrDomain }) => OriginIpOrDomain));
}, []);
for (const container of containers) {
const {
@ -63,19 +65,20 @@
} = container;
for (const portObject of Ports.filter(
({ IP: ip }) => ip === "::"
({ IP: ip }) => ip === "::" || ip === '0.0.0.0'
)) {
const { IP: ip, PublicPort: port } = portObject;
const key = `${name}-${port}`;
if (
existedDomains.some((item) => item === `${gateway}:${port}`)
existedDomains.some((item) => item === `${gateway}:${port}`) &&
!linesAded[key]
) {
linesAded.push({
linesAded[key] = {
name: name.replace(/^\//, ""),
ip: gateway,
port,
});
};
} else if (!lines[key]) {
lines[key] = {
name: name.replace(/^\//, ""),
@ -100,7 +103,7 @@
</div>`
);
}
for (const line of linesAded) {
for (const [key, line] of Object.entries(linesAded)) {
$("#containersAddedList").append(
`<div class="item">
<div class="content">
@ -111,7 +114,7 @@
</div>`
);
}
linesAded.length &&
Object.entries(linesAded).length &&
$("#containersAddedListHeader").removeAttr("hidden");
$("#containersList .loader").removeClass("active");
} else {