Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Take 1 (incorrect)

Manav Rathi0a01cac57baa
diff --git a/web/apps/auth/src/pages/auth.tsx b/web/apps/auth/src/pages/auth.tsx
index 4006cc9e19..5264897795 100644
--- a/web/apps/auth/src/pages/auth.tsx
+++ b/web/apps/auth/src/pages/auth.tsx
@@ -46,14 +46,11 @@ const AuthenticatorCodesPage = () => {
appContext.showNavBar(false);
}, []);
+ const lcSearch = searchTerm.toLowerCase();
const filteredCodes = codes.filter(
- (secret) =>
- (secret.issuer ?? "")
- .toLowerCase()
- .includes(searchTerm.toLowerCase()) ||
- (secret.account ?? "")
- .toLowerCase()
- .includes(searchTerm.toLowerCase()),
+ (code) =>
+ code.issuer?.toLowerCase().includes(lcSearch) ||
+ code.account?.toLowerCase().includes(lcSearch),
);
if (!hasFetched) {
@@ -270,7 +267,7 @@ const OTPDisplay: React.FC<OTPDisplayProps> = ({ code, otp, nextOTP }) => {
textAlign: "left",
}}
>
- {code.issuer}
+ {code.issuer ?? ""}
</p>
<p
style={{
@@ -283,7 +280,7 @@ const OTPDisplay: React.FC<OTPDisplayProps> = ({ code, otp, nextOTP }) => {
color: "grey",
}}
>
- {code.account}
+ {code.account ?? ""}
</p>
<p
style={{
diff --git a/web/apps/auth/src/services/code.ts b/web/apps/auth/src/services/code.ts
index 09e1ec5673..ff29c58fdd 100644
--- a/web/apps/auth/src/services/code.ts
+++ b/web/apps/auth/src/services/code.ts
@@ -12,7 +12,7 @@ export interface Code {
/** The type of the code. */
type: "totp" | "hotp";
/** The user's account or email for which this code is used. */
- account: string;
+ account?: string;
/** The name of the entity that issued this code. */
issuer: string;
/** Number of digits in the generated OTP. */
@@ -52,7 +52,7 @@ export const codeFromURIString = (id: string, uriString: string): Code => {
return {
id,
type: parseType(url),
- account: _getAccount(uriPath),
+ account: parseAccount(url),
issuer: _getIssuer(uriPath, uriParams),
digits: parseDigits(url),
period: parsePeriod(url),
@@ -68,18 +68,9 @@ const parseType = (url: URL): Code["type"] => {
throw new Error(`Unsupported code with host ${t}`);
};
-const _getAccount = (uriPath: string): string => {
- try {
- const path = decodeURIComponent(uriPath);
- if (path.includes(":")) {
- return path.split(":")[1];
- } else if (path.includes("/")) {
- return path.split("/")[1];
- }
- } catch (e) {
- return "";
- }
-};
+/** Convert the pathname from "/ACME:[email protected]" => "[email protected]" */
+const parseAccount = (url: URL): string =>
+ url.pathname.split(":").at(-1).split("/").at(-1);
const _getIssuer = (uriPath: string, uriParams: { get?: any }): string => {
try {
diff --git a/web/apps/photos/package.json b/web/apps/photos/package.json
index 1541878c51..0ec924b29b 100644
--- a/web/apps/photos/package.json
+++ b/web/apps/photos/package.json
@@ -43,7 +43,6 @@
"similarity-transformation": "^0.0.1",
"transformation-matrix": "^2.16",
"uuid": "^9.0.1",
- "vscode-uri": "^3.0.7",
"xml-js": "^1.6.11",
"zxcvbn": "^4.4.2"
},
diff --git a/web/yarn.lock b/web/yarn.lock
index 894a44dd02..aaa0d517a8 100644
--- a/web/yarn.lock
+++ b/web/yarn.lock
@@ -4804,11 +4804,6 @@ [email protected]:
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-3.1.0.tgz#614f7fbf8d801f0bb5f0661f5b2f5785750e4f09"
integrity sha512-Dhxzh5HZuiHQhbvTW9AMetFfBHDMYpo23Uo9btPXgdYP+3T5S+p+jgNy7spra+veYhBP2dCSgxR/i2Y02h5/6w==
-vscode-uri@^3.0.7:
- version "3.0.8"
- resolved "https://registry.yarnpkg.com/vscode-uri/-/vscode-uri-3.0.8.tgz#1770938d3e72588659a172d0fd4642780083ff9f"
- integrity sha512-AyFQ0EVmsOZOlAnxoFOGOq1SQDWAB7C6aqMGS23svWAllfOaxbuFvcT8D1i8z3Gyn8fraVeZNNmN6e9bxxXkKw==
-
webidl-conversions@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"