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 ( var (
name = "Zoraxy" name = "Zoraxy"
version = "3.1.0" version = "3.1.1"
nodeUUID = "generic" //System uuid, in uuidv4 format 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() bootTime = time.Now().Unix()
/* /*
@ -117,8 +117,8 @@ func SetupCloseHandler() {
func ShutdownSeq() { func ShutdownSeq() {
SystemWideLogger.Println("Shutting down " + name) SystemWideLogger.Println("Shutting down " + name)
SystemWideLogger.Println("Closing GeoDB ") //SystemWideLogger.Println("Closing GeoDB")
geodbStore.Close() //geodbStore.Close()
SystemWideLogger.Println("Closing Netstats Listener") SystemWideLogger.Println("Closing Netstats Listener")
netstatBuffers.Close() netstatBuffers.Close()
SystemWideLogger.Println("Closing Statistic Collector") 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 //Add debug X-Proxy-By tracker
res.Header.Set("x-proxy-by", "zoraxy/"+rrr.Version) 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 // Construct the absolute path to the target directory
targetDir := filepath.Join(fm.Directory, 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 // Open the target directory
dirEntries, err := os.ReadDir(targetDir) dirEntries, err := os.ReadDir(targetDir)
if err != nil { if err != nil {

View File

@ -583,14 +583,14 @@
url: '/api/stats/netstatgraph?array=true', url: '/api/stats/netstatgraph?array=true',
success: function(data){ success: function(data){
if (rxValues.length == 0){ if (rxValues.length == 0){
rxValues = JSON.parse(JSON.stringify(data.Rx)); rxValues.push(...data.Rx);
}else{ }else{
rxValues.push(data.Rx[dataCount-1]); rxValues.push(data.Rx[dataCount-1]);
rxValues.shift(); rxValues.shift();
} }
if (txValues.length == 0){ if (txValues.length == 0){
txValues = JSON.parse(JSON.stringify(data.Tx)); txValues.push(...data.Tx);
}else{ }else{
txValues.push(data.Tx[dataCount-1]); txValues.push(data.Tx[dataCount-1]);
txValues.shift(); 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 //Add a new function to jquery for ajax override with csrf token injected
$.cjax = function(payload){ $.cjax = function(payload){
let requireTokenMethod = ["POST", "PUT", "DELETE"];; let requireTokenMethod = ["POST", "PUT", "DELETE"];
if (requireTokenMethod.includes(payload.method) || requireTokenMethod.includes(payload.type)){ if (requireTokenMethod.includes(payload.method) || requireTokenMethod.includes(payload.type)){
//csrf token is required //csrf token is required
let csrfToken = document.getElementsByTagName("meta")["zoraxy.csrf.Token"].getAttribute("content"); let csrfToken = document.getElementsByTagName("meta")["zoraxy.csrf.Token"].getAttribute("content");

View File

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