8282 copy-text =" Copy API Key"
8383 notification-text =" API Key copied successfully"
8484 ></copy-button >
85+ <v-btn
86+ color =" primary"
87+ @click =" showQrCodeDialog = true"
88+ class =" ml-4"
89+ >
90+ <v-icon left >{{ mdiQrcode }}</v-icon >
91+ Show QR Code
92+ </v-btn >
93+ <v-dialog v-model =" showQrCodeDialog" max-width =" 400px" >
94+ <v-card >
95+ <v-card-title >API Key QR Code</v-card-title >
96+ <v-card-text >
97+ <canvas ref =" qrCodeCanvas" ></canvas >
98+ </v-card-text >
99+ <v-card-actions >
100+ <v-spacer ></v-spacer >
101+ <v-btn color =" primary" text @click =" showQrCodeDialog = false" >Close</v-btn >
102+ </v-card-actions >
103+ </v-card >
104+ </v-dialog >
85105 <v-btn
86106 v-if =" $vuetify.breakpoint.lgAndUp"
87107 class =" ml-4"
@@ -714,7 +734,9 @@ import {
714734 mdiLinkVariant ,
715735 mdiEyeOff ,
716736 mdiSquareEditOutline ,
737+ mdiQrcode ,
717738} from ' @mdi/js'
739+ import QRCode from ' qrcode'
718740import { ErrorMessages } from ' ~/plugins/errors'
719741import LoadingButton from ' ~/components/LoadingButton.vue'
720742
@@ -731,6 +753,7 @@ export default Vue.extend({
731753 mdiAccountCircle,
732754 mdiShieldCheck,
733755 mdiDelete,
756+ mdiQrcode,
734757 mdiLinkVariant,
735758 mdiContentSave,
736759 mdiSquareEditOutline,
@@ -741,6 +764,7 @@ export default Vue.extend({
741764 showDiscordEdit: false ,
742765 showRotateApiKey: false ,
743766 rotatingApiKey: false ,
767+ showQrCodeDialog: false ,
744768 activeWebhook: {
745769 id: null ,
746770 url: ' ' ,
@@ -803,6 +827,15 @@ export default Vue.extend({
803827 })
804828 },
805829 },
830+ watch: {
831+ showQrCodeDialog (newVal ) {
832+ if (newVal && this .apiKey ) {
833+ this .$nextTick (() => {
834+ this .generateQrCode (this .apiKey );
835+ });
836+ }
837+ },
838+ },
806839 async mounted () {
807840 await Promise .all ([
808841 this .$store .dispatch (' clearAxiosError' ),
@@ -818,6 +851,16 @@ export default Vue.extend({
818851 },
819852
820853 methods: {
854+ generateQrCode (text ) {
855+ const canvas = this .$refs .qrCodeCanvas ;
856+ if (canvas) {
857+ QRCode .toCanvas (canvas, text, { errorCorrectionLevel: ' H' }, (err ) => {
858+ if (err) {
859+ console .error (err);
860+ }
861+ });
862+ }
863+ },
821864 updateEmailNotifications () {
822865 this .notificationSettings = {
823866 webhook_enabled:
0 commit comments