Try it on the clientside instead

master
Keith Irwin 2022-11-07 13:10:59 -07:00
parent 17b8720e91
commit e91f2bf45e
Signed by: ki9
GPG Key ID: DF773B3F4A88DA86
10 changed files with 13 additions and 6 deletions

View File

@ -6,7 +6,7 @@ ENV ADMIN_EMAIL='me@example.com'
# Install deps # Install deps
RUN apt-get update && apt-get install --yes \ RUN apt-get update && apt-get install --yes \
sudo curl apache2 openssl wireguard-tools dnsutils ipv6calc jq qrencode \ sudo curl apache2 openssl wireguard-tools dnsutils ipv6calc jq \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Create dirs and temp files # Create dirs and temp files

View File

@ -6,7 +6,7 @@ ENV ADMIN_EMAIL='me@example.com'
# Install deps # Install deps
RUN apt-get update && apt-get install --yes \ RUN apt-get update && apt-get install --yes \
sudo curl apache2 openssl wireguard-tools dnsutils ipv6calc jq qrencode \ sudo curl apache2 openssl wireguard-tools dnsutils ipv6calc jq \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Create dirs and temp files # Create dirs and temp files

View File

@ -159,5 +159,4 @@ while IFS=$'\t' read -r server_hostname server_ipv4 server_ipv6 server_pubkey se
fi fi
done <"${SERVERS_FILE}" done <"${SERVERS_FILE}"
wg_config="[Interface] # ${hostname}.${username}.${TLD}\nPrivateKey=${privkey:?}\nAddress=${address:?}\n${WG_DNS}\n${server_blocks:?}" wg_config="[Interface] # ${hostname}.${username}.${TLD}\nPrivateKey=${privkey:?}\nAddress=${address:?}\n${WG_DNS}\n${server_blocks:?}"
qr_code="$(qrencode -t ansiutf8 <<<"${wg_config}")" <<<"${wg_config}" "${LIB_DIR}/http_res" 202
printf '%s\n\n%s\n' "${wg_config}" "${qr_code}" | "${LIB_DIR}/http_res" 202

View File

@ -1,3 +1,3 @@
FROM httpd:2.4 FROM httpd:2.4
COPY admin.html /usr/local/apache2/htdocs/index.html COPY admin.html /usr/local/apache2/htdocs/index.html
COPY admin.js knockout.min.js /usr/local/apache2/htdocs/ COPY admin.js knockout.min.js qrcode.min.js /usr/local/apache2/htdocs/

View File

@ -49,8 +49,10 @@
<br><hr> <br><hr>
<pre data-bind="text:newConfigText"></pre> <pre data-bind="text:newConfigText"></pre>
<div id="qrcode"></div>
<script src="/knockout.min.js" integrity="sha512-vs7+jbztHoMto5Yd/yinM4/y2DOkPLt0fATcN+j+G4ANY2z4faIzZIOMkpBmWdcxt+596FemCh9M18NUJTZwvw=="></script> <script src="/knockout.min.js" integrity="sha512-vs7+jbztHoMto5Yd/yinM4/y2DOkPLt0fATcN+j+G4ANY2z4faIzZIOMkpBmWdcxt+596FemCh9M18NUJTZwvw=="></script>
<script src="/qrcode.min.js" integrity="sha512-CNgIRecGo7nphbeZ04Sc13ka07paqdeTu0WR1IM4kNcpmBAUSHSQX0FslNhTDadL4O5SAGapGt4FodqL8My0mA=="></script>
<script src="/admin.js"></script> <script src="/admin.js"></script>
</body> </body>
</html> </html>

View File

@ -107,6 +107,7 @@ function PeerList() {
cantDelete: true, cantDelete: true,
})) }))
self.newConfigText(parsedRes) self.newConfigText(parsedRes)
new QRCode(document.getElementById('qrcode'),parsedRes)
} }
} }
} }
@ -184,6 +185,7 @@ function PeerList() {
cantDelete: true, cantDelete: true,
})) }))
self.newConfigText(parsedRes) self.newConfigText(parsedRes)
new QRCode(document.getElementById('qrcode'),parsedRes)
} }
} }
} }

View File

@ -1,3 +1,3 @@
FROM httpd:2.4 FROM httpd:2.4
COPY dashboard.html /usr/local/apache2/htdocs/index.html COPY dashboard.html /usr/local/apache2/htdocs/index.html
COPY dashboard.js knockout.min.js /usr/local/apache2/htdocs/ COPY dashboard.js knockout.min.js qrcode.min.js /usr/local/apache2/htdocs/

View File

@ -28,9 +28,11 @@
<p>After clicking "Add", the new peer's config will appear below. Copy and paste it into your wireguard client and start the service. <b>This configuration will not be shown again!</b>If you lose the config, you will need to delete the peer and recreate it. </p> <p>After clicking "Add", the new peer's config will appear below. Copy and paste it into your wireguard client and start the service. <b>This configuration will not be shown again!</b>If you lose the config, you will need to delete the peer and recreate it. </p>
<hr> <hr>
<pre data-bind="text:newConfigText"></pre> <pre data-bind="text:newConfigText"></pre>
<div id="qrcode"></div>
<script src="/knockout.min.js" integrity="sha512-vs7+jbztHoMto5Yd/yinM4/y2DOkPLt0fATcN+j+G4ANY2z4faIzZIOMkpBmWdcxt+596FemCh9M18NUJTZwvw== <script src="/knockout.min.js" integrity="sha512-vs7+jbztHoMto5Yd/yinM4/y2DOkPLt0fATcN+j+G4ANY2z4faIzZIOMkpBmWdcxt+596FemCh9M18NUJTZwvw==
"></script> "></script>
<script src="/qrcode.min.js" integrity="sha512-CNgIRecGo7nphbeZ04Sc13ka07paqdeTu0WR1IM4kNcpmBAUSHSQX0FslNhTDadL4O5SAGapGt4FodqL8My0mA=="></script>
<script src="/dashboard.js"></script> <script src="/dashboard.js"></script>
</body> </body>
</html> </html>

View File

@ -86,6 +86,7 @@ function PeerList() {
cantDelete: true, cantDelete: true,
})) }))
self.newConfigText(parsedRes) self.newConfigText(parsedRes)
new QRCode(document.getElementById('qrcode'),parsedRes)
} }
} }
} }

1
front/qrcode.min.js vendored Normal file

File diff suppressed because one or more lines are too long