Browse Source

improve

pull/2518/head
Bernd Storath 4 months ago
parent
commit
861878f13d
  1. 2
      src/cli/clients/qr.ts
  2. 7
      src/server/utils/qr.ts

2
src/cli/clients/qr.ts

@ -1,5 +1,5 @@
import { defineCommand } from 'citty';
import consola from 'consola';
import { consola } from 'consola';
import { eq } from 'drizzle-orm';
import { wg } from '../../server/utils/wgHelper';

7
src/server/utils/qr.ts

@ -1,7 +1,7 @@
// ! Auto Imports are not supported in this file
import type { ECMode } from 'qr';
import { encodeQR } from 'qr';
import type { ErrorCorrection } from 'qr';
import { encodeQR, ECMode } from 'qr';
export function encodeQRCode(config: string): string {
return tryECCModes((ecc) => {
@ -22,8 +22,7 @@ export function encodeQRCodeTerm(config: string): string {
});
}
function tryECCModes<T>(callback: (ecc: (typeof ECMode)[number]) => T): T {
const ECMode = ['high', 'quartile', 'medium', 'low'] as const;
function tryECCModes<T>(callback: (ecc: ErrorCorrection) => T): T {
for (const ecc of ECMode) {
try {
return callback(ecc);

Loading…
Cancel
Save