mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-10-03 07:46:18 +00:00
Updated AWG
This commit is contained in:
277
src/dashboard.py
277
src/dashboard.py
@@ -41,23 +41,6 @@ from modules.DashboardPlugins import DashboardPlugins
|
||||
from modules.DashboardWebHooks import DashboardWebHooks
|
||||
from modules.NewConfigurationTemplates import NewConfigurationTemplates
|
||||
|
||||
dictConfig({
|
||||
'version': 1,
|
||||
'formatters': {'default': {
|
||||
'format': '[%(asctime)s] [%(levelname)s] in [%(module)s] %(message)s',
|
||||
}},
|
||||
'root': {
|
||||
'level': 'INFO'
|
||||
}
|
||||
})
|
||||
|
||||
SystemStatus = SystemStatus()
|
||||
|
||||
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
|
||||
app = Flask("WGDashboard", template_folder=os.path.abspath("./static/dist/WGDashboardAdmin"))
|
||||
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 5206928
|
||||
app.secret_key = secrets.token_urlsafe(32)
|
||||
|
||||
class CustomJsonEncoder(DefaultJSONProvider):
|
||||
def __init__(self, app):
|
||||
super().__init__(app)
|
||||
@@ -70,7 +53,8 @@ class CustomJsonEncoder(DefaultJSONProvider):
|
||||
if type(o) is datetime:
|
||||
return o.strftime("%Y-%m-%d %H:%M:%S")
|
||||
return super().default(self)
|
||||
app.json = CustomJsonEncoder(app)
|
||||
|
||||
|
||||
|
||||
'''
|
||||
Response Object
|
||||
@@ -83,16 +67,151 @@ def ResponseObject(status=True, message=None, data=None, status_code = 200) -> F
|
||||
})
|
||||
response.status_code = status_code
|
||||
response.content_type = "application/json"
|
||||
return response
|
||||
return response
|
||||
|
||||
'''
|
||||
Flask App
|
||||
'''
|
||||
app = Flask("WGDashboard", template_folder=os.path.abspath("./static/dist/WGDashboardAdmin"))
|
||||
|
||||
def peerInformationBackgroundThread():
|
||||
global WireguardConfigurations
|
||||
app.logger.info("Background Thread #1 Started")
|
||||
app.logger.info("Background Thread #1 PID:" + str(threading.get_native_id()))
|
||||
delay = 6
|
||||
time.sleep(10)
|
||||
while True:
|
||||
with app.app_context():
|
||||
try:
|
||||
curKeys = list(WireguardConfigurations.keys())
|
||||
for name in curKeys:
|
||||
if name in WireguardConfigurations.keys() and WireguardConfigurations.get(name) is not None:
|
||||
c = WireguardConfigurations.get(name)
|
||||
if c.getStatus():
|
||||
c.getPeersLatestHandshake()
|
||||
c.getPeersTransfer()
|
||||
c.getPeersEndpoint()
|
||||
c.getPeers()
|
||||
if delay == 6:
|
||||
c.logPeersTraffic()
|
||||
c.logPeersHistoryEndpoint()
|
||||
c.getRestrictedPeersList()
|
||||
except Exception as e:
|
||||
app.logger.error(f"[WGDashboard] Background Thread #1 Error", e)
|
||||
|
||||
if delay == 6:
|
||||
delay = 1
|
||||
else:
|
||||
delay += 1
|
||||
time.sleep(10)
|
||||
|
||||
def peerJobScheduleBackgroundThread():
|
||||
with app.app_context():
|
||||
app.logger.info(f"Background Thread #2 Started")
|
||||
app.logger.info(f"Background Thread #2 PID:" + str(threading.get_native_id()))
|
||||
time.sleep(10)
|
||||
while True:
|
||||
try:
|
||||
AllPeerJobs.runJob()
|
||||
time.sleep(180)
|
||||
except Exception as e:
|
||||
app.logger.error("Background Thread #2 Error", e)
|
||||
|
||||
def gunicornConfig():
|
||||
_, app_ip = DashboardConfig.GetConfig("Server", "app_ip")
|
||||
_, app_port = DashboardConfig.GetConfig("Server", "app_port")
|
||||
return app_ip, app_port
|
||||
|
||||
def ProtocolsEnabled() -> list[str]:
|
||||
from shutil import which
|
||||
protocols = []
|
||||
if which('awg') is not None and which('awg-quick') is not None:
|
||||
protocols.append("awg")
|
||||
if which('wg') is not None and which('wg-quick') is not None:
|
||||
protocols.append("wg")
|
||||
return protocols
|
||||
|
||||
def InitWireguardConfigurationsList(startup: bool = False):
|
||||
if os.path.exists(DashboardConfig.GetConfig("Server", "wg_conf_path")[1]):
|
||||
confs = os.listdir(DashboardConfig.GetConfig("Server", "wg_conf_path")[1])
|
||||
confs.sort()
|
||||
for i in confs:
|
||||
if RegexMatch("^(.{1,}).(conf)$", i):
|
||||
i = i.replace('.conf', '')
|
||||
try:
|
||||
if i in WireguardConfigurations.keys():
|
||||
if WireguardConfigurations[i].configurationFileChanged():
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = WireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i)
|
||||
else:
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = WireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i, startup=startup)
|
||||
except WireguardConfiguration.InvalidConfigurationFileException as e:
|
||||
app.logger.error(f"{i} have an invalid configuration file.")
|
||||
|
||||
if "awg" in ProtocolsEnabled():
|
||||
confs = os.listdir(DashboardConfig.GetConfig("Server", "awg_conf_path")[1])
|
||||
confs.sort()
|
||||
for i in confs:
|
||||
if RegexMatch("^(.{1,}).(conf)$", i):
|
||||
i = i.replace('.conf', '')
|
||||
try:
|
||||
if i in WireguardConfigurations.keys():
|
||||
if WireguardConfigurations[i].configurationFileChanged():
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = AmneziaWireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i)
|
||||
else:
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = AmneziaWireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i, startup=startup)
|
||||
except WireguardConfiguration.InvalidConfigurationFileException as e:
|
||||
app.logger.error(f"{i} have an invalid configuration file.")
|
||||
|
||||
def startThreads():
|
||||
bgThread = threading.Thread(target=peerInformationBackgroundThread, daemon=True)
|
||||
bgThread.start()
|
||||
scheduleJobThread = threading.Thread(target=peerJobScheduleBackgroundThread, daemon=True)
|
||||
scheduleJobThread.start()
|
||||
|
||||
dictConfig({
|
||||
'version': 1,
|
||||
'formatters': {'default': {
|
||||
'format': '[%(asctime)s] [%(levelname)s] in [%(module)s] %(message)s',
|
||||
}},
|
||||
'root': {
|
||||
'level': 'INFO'
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
WireguardConfigurations: dict[str, WireguardConfiguration] = {}
|
||||
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
|
||||
|
||||
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 5206928
|
||||
app.secret_key = secrets.token_urlsafe(32)
|
||||
app.json = CustomJsonEncoder(app)
|
||||
with app.app_context():
|
||||
SystemStatus = SystemStatus()
|
||||
DashboardConfig = DashboardConfig()
|
||||
EmailSender = EmailSender(DashboardConfig)
|
||||
AllPeerShareLinks: PeerShareLinks = PeerShareLinks(DashboardConfig, WireguardConfigurations)
|
||||
AllPeerJobs: PeerJobs = PeerJobs(DashboardConfig, WireguardConfigurations)
|
||||
DashboardLogger: DashboardLogger = DashboardLogger()
|
||||
DashboardPlugins: DashboardPlugins = DashboardPlugins(app, WireguardConfigurations)
|
||||
DashboardWebHooks: DashboardWebHooks = DashboardWebHooks(DashboardConfig)
|
||||
NewConfigurationTemplates: NewConfigurationTemplates = NewConfigurationTemplates()
|
||||
InitWireguardConfigurationsList(startup=True)
|
||||
DashboardClients: DashboardClients = DashboardClients(WireguardConfigurations)
|
||||
app.register_blueprint(createClientBlueprint(WireguardConfigurations, DashboardConfig, DashboardClients))
|
||||
|
||||
DashboardConfig = DashboardConfig()
|
||||
EmailSender = EmailSender(DashboardConfig)
|
||||
_, APP_PREFIX = DashboardConfig.GetConfig("Server", "app_prefix")
|
||||
cors = CORS(app, resources={rf"{APP_PREFIX}/api/*": {
|
||||
"origins": "*",
|
||||
"methods": "DELETE, POST, GET, OPTIONS",
|
||||
"allow_headers": ["Content-Type", "wg-dashboard-apikey"]
|
||||
}})
|
||||
_, app_ip = DashboardConfig.GetConfig("Server", "app_ip")
|
||||
_, app_port = DashboardConfig.GetConfig("Server", "app_port")
|
||||
_, WG_CONF_PATH = DashboardConfig.GetConfig("Server", "wg_conf_path")
|
||||
|
||||
'''
|
||||
API Routes
|
||||
@@ -1544,122 +1663,6 @@ Index Page
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
def peerInformationBackgroundThread():
|
||||
global WireguardConfigurations
|
||||
app.logger.info("Background Thread #1 Started")
|
||||
app.logger.info("Background Thread #1 PID:" + str(threading.get_native_id()))
|
||||
delay = 6
|
||||
time.sleep(10)
|
||||
while True:
|
||||
with app.app_context():
|
||||
try:
|
||||
curKeys = list(WireguardConfigurations.keys())
|
||||
for name in curKeys:
|
||||
if name in WireguardConfigurations.keys() and WireguardConfigurations.get(name) is not None:
|
||||
c = WireguardConfigurations.get(name)
|
||||
if c.getStatus():
|
||||
c.getPeersLatestHandshake()
|
||||
c.getPeersTransfer()
|
||||
c.getPeersEndpoint()
|
||||
c.getPeers()
|
||||
if delay == 6:
|
||||
c.logPeersTraffic()
|
||||
c.logPeersHistoryEndpoint()
|
||||
c.getRestrictedPeersList()
|
||||
except Exception as e:
|
||||
app.logger.error(f"[WGDashboard] Background Thread #1 Error", e)
|
||||
|
||||
if delay == 6:
|
||||
delay = 1
|
||||
else:
|
||||
delay += 1
|
||||
time.sleep(10)
|
||||
|
||||
def peerJobScheduleBackgroundThread():
|
||||
with app.app_context():
|
||||
app.logger.info(f"Background Thread #2 Started")
|
||||
app.logger.info(f"Background Thread #2 PID:" + str(threading.get_native_id()))
|
||||
time.sleep(10)
|
||||
while True:
|
||||
try:
|
||||
AllPeerJobs.runJob()
|
||||
time.sleep(180)
|
||||
except Exception as e:
|
||||
app.logger.error("Background Thread #2 Error", e)
|
||||
|
||||
def gunicornConfig():
|
||||
_, app_ip = DashboardConfig.GetConfig("Server", "app_ip")
|
||||
_, app_port = DashboardConfig.GetConfig("Server", "app_port")
|
||||
return app_ip, app_port
|
||||
|
||||
def ProtocolsEnabled() -> list[str]:
|
||||
from shutil import which
|
||||
protocols = []
|
||||
if which('awg') is not None and which('awg-quick') is not None:
|
||||
protocols.append("awg")
|
||||
if which('wg') is not None and which('wg-quick') is not None:
|
||||
protocols.append("wg")
|
||||
return protocols
|
||||
|
||||
def InitWireguardConfigurationsList(startup: bool = False):
|
||||
if os.path.exists(DashboardConfig.GetConfig("Server", "wg_conf_path")[1]):
|
||||
confs = os.listdir(DashboardConfig.GetConfig("Server", "wg_conf_path")[1])
|
||||
confs.sort()
|
||||
for i in confs:
|
||||
if RegexMatch("^(.{1,}).(conf)$", i):
|
||||
i = i.replace('.conf', '')
|
||||
try:
|
||||
if i in WireguardConfigurations.keys():
|
||||
if WireguardConfigurations[i].configurationFileChanged():
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = WireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i)
|
||||
else:
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = WireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i, startup=startup)
|
||||
except WireguardConfiguration.InvalidConfigurationFileException as e:
|
||||
app.logger.error(f"{i} have an invalid configuration file.")
|
||||
|
||||
if "awg" in ProtocolsEnabled():
|
||||
confs = os.listdir(DashboardConfig.GetConfig("Server", "awg_conf_path")[1])
|
||||
confs.sort()
|
||||
for i in confs:
|
||||
if RegexMatch("^(.{1,}).(conf)$", i):
|
||||
i = i.replace('.conf', '')
|
||||
try:
|
||||
if i in WireguardConfigurations.keys():
|
||||
if WireguardConfigurations[i].configurationFileChanged():
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = AmneziaWireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i)
|
||||
else:
|
||||
with app.app_context():
|
||||
WireguardConfigurations[i] = AmneziaWireguardConfiguration(DashboardConfig, AllPeerJobs, AllPeerShareLinks, DashboardWebHooks, i, startup=startup)
|
||||
except WireguardConfiguration.InvalidConfigurationFileException as e:
|
||||
app.logger.error(f"{i} have an invalid configuration file.")
|
||||
|
||||
|
||||
_, app_ip = DashboardConfig.GetConfig("Server", "app_ip")
|
||||
_, app_port = DashboardConfig.GetConfig("Server", "app_port")
|
||||
_, WG_CONF_PATH = DashboardConfig.GetConfig("Server", "wg_conf_path")
|
||||
|
||||
WireguardConfigurations: dict[str, WireguardConfiguration] = {}
|
||||
|
||||
with app.app_context():
|
||||
AllPeerShareLinks: PeerShareLinks = PeerShareLinks(DashboardConfig, WireguardConfigurations)
|
||||
AllPeerJobs: PeerJobs = PeerJobs(DashboardConfig, WireguardConfigurations)
|
||||
DashboardLogger: DashboardLogger = DashboardLogger()
|
||||
DashboardPlugins: DashboardPlugins = DashboardPlugins(app, WireguardConfigurations)
|
||||
DashboardWebHooks: DashboardWebHooks = DashboardWebHooks(DashboardConfig)
|
||||
NewConfigurationTemplates: NewConfigurationTemplates = NewConfigurationTemplates()
|
||||
InitWireguardConfigurationsList(startup=True)
|
||||
DashboardClients: DashboardClients = DashboardClients(WireguardConfigurations)
|
||||
app.register_blueprint(createClientBlueprint(WireguardConfigurations, DashboardConfig, DashboardClients))
|
||||
|
||||
def startThreads():
|
||||
bgThread = threading.Thread(target=peerInformationBackgroundThread, daemon=True)
|
||||
bgThread.start()
|
||||
scheduleJobThread = threading.Thread(target=peerJobScheduleBackgroundThread, daemon=True)
|
||||
scheduleJobThread.start()
|
||||
|
||||
if __name__ == "__main__":
|
||||
startThreads()
|
||||
DashboardPlugins.startThreads()
|
||||
|
@@ -13,85 +13,6 @@ class AmneziaWGPeer(Peer):
|
||||
self.advanced_security = tableData["advanced_security"]
|
||||
super().__init__(tableData, configuration)
|
||||
|
||||
def downloadPeer(self) -> dict[str, str]:
|
||||
filename = self.name
|
||||
if len(filename) == 0:
|
||||
filename = "UntitledPeer"
|
||||
filename = "".join(filename.split(' '))
|
||||
filename = f"{filename}_{self.configuration.Name}"
|
||||
illegal_filename = [".", ",", "/", "?", "<", ">", "\\", ":", "*", '|' '\"', "com1", "com2", "com3",
|
||||
"com4", "com5", "com6", "com7", "com8", "com9", "lpt1", "lpt2", "lpt3", "lpt4",
|
||||
"lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "con", "nul", "prn"]
|
||||
for i in illegal_filename:
|
||||
filename = filename.replace(i, "")
|
||||
|
||||
finalFilename = ""
|
||||
for i in filename:
|
||||
if re.match("^[a-zA-Z0-9_=+.-]$", i):
|
||||
finalFilename += i
|
||||
|
||||
interfaceSection = {
|
||||
"PrivateKey": self.private_key,
|
||||
"Address": self.allowed_ip,
|
||||
"MTU": self.mtu,
|
||||
"DNS": self.DNS,
|
||||
"Jc": self.configuration.Jc,
|
||||
"Jmin": self.configuration.Jmin,
|
||||
"Jmax": self.configuration.Jmax,
|
||||
"S1": self.configuration.S1,
|
||||
"S2": self.configuration.S2,
|
||||
"H1": self.configuration.H1,
|
||||
"H2": self.configuration.H2,
|
||||
"H3": self.configuration.H3,
|
||||
"H4": self.configuration.H4
|
||||
}
|
||||
peerSection = {
|
||||
"PublicKey": self.configuration.PublicKey,
|
||||
"AllowedIPs": self.endpoint_allowed_ip,
|
||||
"Endpoint": f'{self.configuration.DashboardConfig.GetConfig("Peers", "remote_endpoint")[1]}:{self.configuration.ListenPort}',
|
||||
"PersistentKeepalive": self.keepalive,
|
||||
"PresharedKey": self.preshared_key
|
||||
}
|
||||
combine = [interfaceSection.items(), peerSection.items()]
|
||||
peerConfiguration = ""
|
||||
for s in range(len(combine)):
|
||||
if s == 0:
|
||||
peerConfiguration += "[Interface]\n"
|
||||
else:
|
||||
peerConfiguration += "\n[Peer]\n"
|
||||
for (key, val) in combine[s]:
|
||||
if val is not None and ((type(val) is str and len(val) > 0) or (type(val) is int and val > 0)):
|
||||
peerConfiguration += f"{key} = {val}\n"
|
||||
|
||||
# peerConfiguration = f'''[Interface]
|
||||
# PrivateKey = {self.private_key}
|
||||
# Address = {self.allowed_ip}
|
||||
# MTU = {str(self.mtu)}
|
||||
# Jc = {self.configuration.Jc}
|
||||
# Jmin = {self.configuration.Jmin}
|
||||
# Jmax = {self.configuration.Jmax}
|
||||
# S1 = {self.configuration.S1}
|
||||
# S2 = {self.configuration.S2}
|
||||
# H1 = {self.configuration.H1}
|
||||
# H2 = {self.configuration.H2}
|
||||
# H3 = {self.configuration.H3}
|
||||
# H4 = {self.configuration.H4}
|
||||
# '''
|
||||
# if len(self.DNS) > 0:
|
||||
# peerConfiguration += f"DNS = {self.DNS}\n"
|
||||
# peerConfiguration += f'''
|
||||
# [Peer]
|
||||
# PublicKey = {self.configuration.PublicKey}
|
||||
# AllowedIPs = {self.endpoint_allowed_ip}
|
||||
# Endpoint = {self.configuration.DashboardConfig.GetConfig("Peers", "remote_endpoint")[1]}:{self.configuration.ListenPort}
|
||||
# PersistentKeepalive = {str(self.keepalive)}
|
||||
# '''
|
||||
# if len(self.preshared_key) > 0:
|
||||
# peerConfiguration += f"PresharedKey = {self.preshared_key}\n"
|
||||
return {
|
||||
"fileName": finalFilename,
|
||||
"file": peerConfiguration
|
||||
}
|
||||
|
||||
def updatePeer(self, name: str, private_key: str,
|
||||
preshared_key: str,
|
||||
|
@@ -150,6 +150,20 @@ class Peer:
|
||||
if self.configuration.configurationInfo.OverridePeerSettings.DNS else self.DNS
|
||||
)
|
||||
}
|
||||
|
||||
if self.configuration.Protocol == "awg":
|
||||
interfaceSection.update({
|
||||
"Jc": self.configuration.Jc,
|
||||
"Jmin": self.configuration.Jmin,
|
||||
"Jmax": self.configuration.Jmax,
|
||||
"S1": self.configuration.S1,
|
||||
"S2": self.configuration.S2,
|
||||
"H1": self.configuration.H1,
|
||||
"H2": self.configuration.H2,
|
||||
"H3": self.configuration.H3,
|
||||
"H4": self.configuration.H4
|
||||
})
|
||||
|
||||
peerSection = {
|
||||
"PublicKey": self.configuration.PublicKey,
|
||||
"AllowedIPs": (
|
||||
|
@@ -55,9 +55,9 @@ window.dayjs = dayjs
|
||||
</small>
|
||||
<span class="badge rounded-3 ms-sm-auto"
|
||||
:class="[props.config.protocol === 'wg' ? 'wireguardBg' : 'amneziawgBg' ]"
|
||||
v-if="props.config.protocol === 'wg'">
|
||||
{{ props.config.protocol === 'wg' ? 'WireGuard': 'AmneziaWG' }}
|
||||
</span>
|
||||
>
|
||||
{{ props.config.protocol === 'wg' ? 'WireGuard': 'AmneziaWG' }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="card-body p-3 d-flex gap-3 flex-column">
|
||||
<div>
|
||||
@@ -92,6 +92,8 @@ window.dayjs = dayjs
|
||||
<Transition name="app">
|
||||
<ConfigurationQRCode
|
||||
v-if="showQRCode"
|
||||
:config="props.config"
|
||||
:protocol="props.config.protocol"
|
||||
@back="showQRCode = false"
|
||||
:qrcode-data="config.peer_configuration_data.file"></ConfigurationQRCode>
|
||||
</Transition>
|
||||
|
@@ -1,29 +1,40 @@
|
||||
<script setup>
|
||||
import Qrcode from "@/components/SignIn/qrcode.vue";
|
||||
import {computed} from "vue";
|
||||
|
||||
const props = defineProps([
|
||||
'qrcodeData'
|
||||
'qrcodeData', 'protocol'
|
||||
])
|
||||
|
||||
const emits = defineEmits([
|
||||
'back'
|
||||
])
|
||||
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="p-2 position-fixed top-0 start-0 vw-100 vh-100 d-flex qrcodeContainer p-3 overflow-scroll">
|
||||
<div class="m-auto d-flex gap-3 flex-column p-3">
|
||||
<div>
|
||||
<a role="button" @click="emits('back')" class="btn btn-body rounded-3 btn-sm">
|
||||
<i class="me-2 bi bi-x-lg"></i> Dismiss
|
||||
</a>
|
||||
</div>
|
||||
<Qrcode :content="props.qrcodeData"></Qrcode>
|
||||
<button class="btn bg-primary-subtle border-primary-subtle rounded-3">
|
||||
<i class="bi bi-download me-2"></i>Download
|
||||
</button>
|
||||
<div class="p-2 position-fixed top-0 start-0 vw-100 vh-100 d-flex qrcodeContainer p-3 overflow-scroll flex-column">
|
||||
<div>
|
||||
<a role="button" @click="emits('back')" class="btn btn-outline-body rounded-3 btn-sm">
|
||||
<i class="me-2 bi bi-chevron-left"></i> Back
|
||||
</a>
|
||||
</div>
|
||||
<div class="m-auto d-flex gap-3 flex-column p-3" style="width: 400px">
|
||||
|
||||
<div class="d-flex flex-column gap-2 align-items-center">
|
||||
<Qrcode :content="props.qrcodeData"></Qrcode>
|
||||
<small>
|
||||
Scan with {{ protocol === "wg" ? 'WireGuard':'AmneziaWG'}} App
|
||||
</small>
|
||||
<hr class="border-white w-100 my-2">
|
||||
<button class="btn bg-primary-subtle border-primary-subtle rounded-3">
|
||||
<i class="bi bi-download me-2"></i>Download
|
||||
</button>
|
||||
<small v-if="protocol === 'wg'" class="text-center text-muted">
|
||||
For AmneziaVPN App, please download the configuration file and import into it.
|
||||
</small>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
@@ -14,7 +14,7 @@ onMounted(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<div class="d-flex gap-2 flex-column">
|
||||
<canvas :id="'qrcode_' + id" class="rounded-3"></canvas>
|
||||
</div>
|
||||
</template>
|
||||
|
Reference in New Issue
Block a user