mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 13:32:24 +00:00
Compare commits
3 commits
f2e9a9e502
...
e18c22e6d2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e18c22e6d2 | ||
![]() |
d54e7a9b14 | ||
![]() |
45c3d730d4 |
2 changed files with 12 additions and 4 deletions
|
@ -85,7 +85,7 @@ func (a *SUBController) subs(c *gin.Context) {
|
||||||
// Add headers
|
// Add headers
|
||||||
c.Writer.Header().Set("Subscription-Userinfo", header)
|
c.Writer.Header().Set("Subscription-Userinfo", header)
|
||||||
c.Writer.Header().Set("Profile-Update-Interval", a.updateInterval)
|
c.Writer.Header().Set("Profile-Update-Interval", a.updateInterval)
|
||||||
c.Writer.Header().Set("Profile-Title", a.subTitle)
|
c.Writer.Header().Set("Profile-Title", "base64:" + base64.StdEncoding.EncodeToString([]byte(a.subTitle)))
|
||||||
|
|
||||||
if a.subEncrypt {
|
if a.subEncrypt {
|
||||||
c.String(200, base64.StdEncoding.EncodeToString([]byte(result)))
|
c.String(200, base64.StdEncoding.EncodeToString([]byte(result)))
|
||||||
|
@ -119,7 +119,7 @@ func (a *SUBController) subJsons(c *gin.Context) {
|
||||||
// Add headers
|
// Add headers
|
||||||
c.Writer.Header().Set("Subscription-Userinfo", header)
|
c.Writer.Header().Set("Subscription-Userinfo", header)
|
||||||
c.Writer.Header().Set("Profile-Update-Interval", a.updateInterval)
|
c.Writer.Header().Set("Profile-Update-Interval", a.updateInterval)
|
||||||
c.Writer.Header().Set("Profile-Title", a.subTitle)
|
c.Writer.Header().Set("Profile-Title", "base64:" + base64.StdEncoding.EncodeToString([]byte(a.subTitle)))
|
||||||
|
|
||||||
c.String(200, jsonSub)
|
c.String(200, jsonSub)
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,8 +140,10 @@ class RandomUtil {
|
||||||
|
|
||||||
static randomShadowsocksPassword() {
|
static randomShadowsocksPassword() {
|
||||||
const array = new Uint8Array(32);
|
const array = new Uint8Array(32);
|
||||||
|
|
||||||
window.crypto.getRandomValues(array);
|
window.crypto.getRandomValues(array);
|
||||||
return Base64.encode(String.fromCharCode(...array));
|
|
||||||
|
return Base64.alternativeEncode(String.fromCharCode(...array));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,6 +530,12 @@ class Base64 {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static alternativeEncode(content) {
|
||||||
|
return window.btoa(
|
||||||
|
content
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
static decode(content = "") {
|
static decode(content = "") {
|
||||||
return new TextDecoder()
|
return new TextDecoder()
|
||||||
.decode(
|
.decode(
|
||||||
|
@ -807,7 +815,7 @@ const MediaQueryMixin = {
|
||||||
}
|
}
|
||||||
|
|
||||||
class FileManager {
|
class FileManager {
|
||||||
static downloadTextFile(content, filename='file.txt', options = { type: "text/plain" }) {
|
static downloadTextFile(content, filename = 'file.txt', options = { type: "text/plain" }) {
|
||||||
let link = window.document.createElement('a');
|
let link = window.document.createElement('a');
|
||||||
|
|
||||||
link.download = filename;
|
link.download = filename;
|
||||||
|
|
Loading…
Reference in a new issue