mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-07-14 02:01:43 +02:00
Compare commits
5 Commits
v3.2.3
...
4f1cd8a571
Author | SHA1 | Date | |
---|---|---|---|
4f1cd8a571 | |||
f6b3656bb1 | |||
f276040ad0 | |||
2f40593daf | |||
0b6dbd49bb |
@ -44,7 +44,7 @@ import (
|
|||||||
const (
|
const (
|
||||||
/* Build Constants */
|
/* Build Constants */
|
||||||
SYSTEM_NAME = "Zoraxy"
|
SYSTEM_NAME = "Zoraxy"
|
||||||
SYSTEM_VERSION = "3.2.3"
|
SYSTEM_VERSION = "3.2.4"
|
||||||
DEVELOPMENT_BUILD = false
|
DEVELOPMENT_BUILD = false
|
||||||
|
|
||||||
/* System Constants */
|
/* System Constants */
|
||||||
|
@ -4,13 +4,14 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"golang.org/x/oauth2"
|
"golang.org/x/oauth2"
|
||||||
"imuslab.com/zoraxy/mod/database"
|
"imuslab.com/zoraxy/mod/database"
|
||||||
"imuslab.com/zoraxy/mod/info/logger"
|
"imuslab.com/zoraxy/mod/info/logger"
|
||||||
"imuslab.com/zoraxy/mod/utils"
|
"imuslab.com/zoraxy/mod/utils"
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type OAuth2RouterOptions struct {
|
type OAuth2RouterOptions struct {
|
||||||
@ -250,7 +251,19 @@ func (ar *OAuth2Router) HandleOAuth2Auth(w http.ResponseWriter, r *http.Request)
|
|||||||
cookie.SameSite = http.SameSiteLaxMode
|
cookie.SameSite = http.SameSiteLaxMode
|
||||||
}
|
}
|
||||||
w.Header().Add("Set-Cookie", cookie.String())
|
w.Header().Add("Set-Cookie", cookie.String())
|
||||||
|
|
||||||
|
//Fix for #695
|
||||||
|
location := strings.TrimPrefix(state, "/internal/")
|
||||||
|
//Check if the location starts with http:// or https://. if yes, this is full URL
|
||||||
|
decodedLocation, err := url.PathUnescape(location)
|
||||||
|
if err == nil && (strings.HasPrefix(decodedLocation, "http://") || strings.HasPrefix(decodedLocation, "https://")) {
|
||||||
|
//Redirect to the full URL
|
||||||
|
http.Redirect(w, r, decodedLocation, http.StatusTemporaryRedirect)
|
||||||
|
} else {
|
||||||
|
//Redirect to a relative path
|
||||||
http.Redirect(w, r, state, http.StatusTemporaryRedirect)
|
http.Redirect(w, r, state, http.StatusTemporaryRedirect)
|
||||||
|
}
|
||||||
|
|
||||||
return errors.New("authorized")
|
return errors.New("authorized")
|
||||||
}
|
}
|
||||||
unauthorized := false
|
unauthorized := false
|
||||||
|
@ -330,7 +330,10 @@ func (p *ReverseProxy) ProxyHTTP(rw http.ResponseWriter, req *http.Request, rrr
|
|||||||
locationRewrite := res.Header.Get("Location")
|
locationRewrite := res.Header.Get("Location")
|
||||||
originLocation := res.Header.Get("Location")
|
originLocation := res.Header.Get("Location")
|
||||||
res.Header.Set("zr-origin-location", originLocation)
|
res.Header.Set("zr-origin-location", originLocation)
|
||||||
|
decodedOriginLocation, err := url.PathUnescape(originLocation)
|
||||||
|
if err == nil {
|
||||||
|
originLocation = decodedOriginLocation
|
||||||
|
}
|
||||||
if strings.HasPrefix(originLocation, "http://") || strings.HasPrefix(originLocation, "https://") {
|
if strings.HasPrefix(originLocation, "http://") || strings.HasPrefix(originLocation, "https://") {
|
||||||
//Full path
|
//Full path
|
||||||
//Replace the forwarded target with expected Host
|
//Replace the forwarded target with expected Host
|
||||||
|
@ -90,8 +90,8 @@ func (c *ProxyRelayConfig) ForwardUDP(address1, address2 string, stopChan chan b
|
|||||||
address1 = ":" + address1
|
address1 = ":" + address1
|
||||||
}
|
}
|
||||||
if strings.HasPrefix(address1, ":") {
|
if strings.HasPrefix(address1, ":") {
|
||||||
//Prepend 127.0.0.1 to the address
|
//Prepend 0.0.0.0 to the address
|
||||||
address1 = "127.0.0.1" + address1
|
address1 = "0.0.0.0" + address1
|
||||||
}
|
}
|
||||||
|
|
||||||
lisener, targetAddr, err := initUDPConnections(address1, address2)
|
lisener, targetAddr, err := initUDPConnections(address1, address2)
|
||||||
|
@ -203,7 +203,7 @@
|
|||||||
<th>Destination</th>
|
<th>Destination</th>
|
||||||
<th>Virtual Directory</th>
|
<th>Virtual Directory</th>
|
||||||
<th class="no-sort">Tags</th>
|
<th class="no-sort">Tags</th>
|
||||||
<th class="no-sort" style="width:50px; cursor: default !important;"></th>
|
<th class="no-sort" style="width:100px; cursor: default !important;"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="httpProxyList">
|
<tbody id="httpProxyList">
|
||||||
@ -588,7 +588,7 @@
|
|||||||
</td> -->
|
</td> -->
|
||||||
<td class="center aligned ignoremw" editable="true" datatype="action" data-label="">
|
<td class="center aligned ignoremw" editable="true" datatype="action" data-label="">
|
||||||
<button title="Edit Proxy Rule" class="ui circular small basic icon button editBtn inlineEditActionBtn" onclick='editEndpoint("${(subd.RootOrMatchingDomain).hexEncode()}")'><i class="ellipsis vertical icon"></i></button>
|
<button title="Edit Proxy Rule" class="ui circular small basic icon button editBtn inlineEditActionBtn" onclick='editEndpoint("${(subd.RootOrMatchingDomain).hexEncode()}")'><i class="ellipsis vertical icon"></i></button>
|
||||||
<!-- <button title="Remove Proxy Rule" class="ui circular mini red basic icon button inlineEditActionBtn" onclick='deleteEndpoint("${(subd.RootOrMatchingDomain).hexEncode()}")'><i class="trash icon"></i></button> -->
|
<button title="Remove Proxy Rule" class="ui circular mini red basic icon button inlineEditActionBtn" onclick='deleteEndpoint("${(subd.RootOrMatchingDomain).hexEncode()}")'><i class="trash icon"></i></button>
|
||||||
</td>
|
</td>
|
||||||
</tr>`);
|
</tr>`);
|
||||||
});
|
});
|
||||||
|
@ -343,7 +343,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$(editorSideWrapper).each(function(){
|
$(editorSideWrapper).each(function(){
|
||||||
|
if ($(this)[0].contentWindow.setDarkTheme){
|
||||||
$(this)[0].contentWindow.setDarkTheme(false);
|
$(this)[0].contentWindow.setDarkTheme(false);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if ($("#pluginContextLoader").is(":visible")){
|
if ($("#pluginContextLoader").is(":visible")){
|
||||||
@ -356,7 +358,9 @@
|
|||||||
$(".sideWrapper iframe")[0].contentWindow.setDarkTheme(true);
|
$(".sideWrapper iframe")[0].contentWindow.setDarkTheme(true);
|
||||||
}
|
}
|
||||||
$(editorSideWrapper).each(function(){
|
$(editorSideWrapper).each(function(){
|
||||||
|
if ($(this)[0].contentWindow.setDarkTheme){
|
||||||
$(this)[0].contentWindow.setDarkTheme(true);
|
$(this)[0].contentWindow.setDarkTheme(true);
|
||||||
|
}
|
||||||
})
|
})
|
||||||
if ($("#pluginContextLoader").is(":visible")){
|
if ($("#pluginContextLoader").is(":visible")){
|
||||||
$("#pluginContextLoader")[0].contentWindow.setDarkTheme(true);
|
$("#pluginContextLoader")[0].contentWindow.setDarkTheme(true);
|
||||||
|
Reference in New Issue
Block a user