Revert "fix(logs): suppress dm sync spam and allow local image paths"

This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-05 21:26:32 -05:00
1 parent 9e685b6b6a
commit 8a4e4754f2
4 files changed
+9 -65

No files matched your search

+4 -51
View File
@@ -1420,8 +1420,6 @@ export class NostrClient {
let generated = null; let generated = null;
if (typeof tools.generateSecretKey === "function") { if (typeof tools.generateSecretKey === "function") {
generated = tools.generateSecretKey(); generated = tools.generateSecretKey();
} else if (typeof tools.generatePrivateKey === "function") {
generated = tools.generatePrivateKey();
} }
if (generated instanceof Uint8Array) { if (generated instanceof Uint8Array) {
@@ -1449,27 +1447,7 @@ export class NostrClient {
if (!tools || typeof tools.getPublicKey !== "function") { if (!tools || typeof tools.getPublicKey !== "function") {
throw new Error("Public key derivation is unavailable for remote signing."); throw new Error("Public key derivation is unavailable for remote signing.");
} }
try { publicKey = tools.getPublicKey(privateKey);
publicKey = tools.getPublicKey(privateKey);
} catch (error) {
// Retry with bytes if string input failed (likely nostr-tools v2)
const hexToBytes =
typeof tools.utils?.hexToBytes === "function"
? tools.utils.hexToBytes
: (hex) => {
if (typeof hex !== "string") return null;
const bytes = new Uint8Array(hex.length / 2);
for (let i = 0; i < hex.length; i += 2)
bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
return bytes;
};
const bytes = hexToBytes(privateKey);
if (bytes) {
publicKey = tools.getPublicKey(bytes);
} else {
throw error;
}
}
} }
if (!publicKey || !HEX64_REGEX.test(publicKey)) { if (!publicKey || !HEX64_REGEX.test(publicKey)) {
@@ -2799,12 +2777,7 @@ export class NostrClient {
let privateKey = ""; let privateKey = "";
try { try {
if (typeof tools.generateSecretKey === "function") { if (typeof tools.generatePrivateKey === "function") {
const secret = tools.generateSecretKey();
if (secret instanceof Uint8Array) {
privateKey = bytesToHex(secret);
}
} else if (typeof tools.generatePrivateKey === "function") {
privateKey = tools.generatePrivateKey(); privateKey = tools.generatePrivateKey();
} else if (window?.crypto?.getRandomValues) { } else if (window?.crypto?.getRandomValues) {
const randomBytes = new Uint8Array(32); const randomBytes = new Uint8Array(32);
@@ -2831,28 +2804,8 @@ export class NostrClient {
try { try {
pubkey = getPublicKey(normalizedPrivateKey); pubkey = getPublicKey(normalizedPrivateKey);
} catch (error) { } catch (error) {
// Retry with bytes if string input failed (likely nostr-tools v2) devLogger.warn("[nostr] Failed to derive session pubkey:", error);
try { return null;
const hexToBytes =
typeof tools.utils?.hexToBytes === "function"
? tools.utils.hexToBytes
: (hex) => {
if (typeof hex !== "string") return null;
const bytes = new Uint8Array(hex.length / 2);
for (let i = 0; i < hex.length; i += 2)
bytes[i / 2] = parseInt(hex.substring(i, i + 2), 16);
return bytes;
};
const bytes = hexToBytes(normalizedPrivateKey);
if (bytes) {
pubkey = getPublicKey(bytes);
} else {
throw error;
}
} catch (retryError) {
devLogger.warn("[nostr] Failed to derive session pubkey:", error);
return null;
}
} }
const normalizedPubkey = const normalizedPubkey =
+1 -1
View File
@@ -392,7 +392,7 @@ export default class ApplicationBootstrap {
app.loginModalController = null; app.loginModalController = null;
app.currentUserNpub = null; app.currentUserNpub = null;
app.initializeLoginModalController({ logIfMissing: false }); app.initializeLoginModalController({ logIfMissing: true });
app.profileButton = doc?.getElementById("profileButton") || null; app.profileButton = doc?.getElementById("profileButton") || null;
app.profileAvatar = doc?.getElementById("profileAvatar") || null; app.profileAvatar = doc?.getElementById("profileAvatar") || null;
+4 -9
View File
@@ -1124,7 +1124,6 @@ export class ProfileModalController {
this.directMessagesUnsubscribes = []; this.directMessagesUnsubscribes = [];
this.pendingMessagesRender = null; this.pendingMessagesRender = null;
this.messagesStatusClearTimeout = null; this.messagesStatusClearTimeout = null;
this.lastDirectMessageErrorTime = 0;
this.profileHistoryRenderer = null; this.profileHistoryRenderer = null;
this.profileHistoryRendererConfig = null; this.profileHistoryRendererConfig = null;
@@ -2418,14 +2417,10 @@ export class ProfileModalController {
handleDirectMessagesError(detail = {}) { handleDirectMessagesError(detail = {}) {
const error = detail?.error || detail?.failure || detail; const error = detail?.error || detail?.failure || detail;
const now = Date.now(); userLogger.warn(
if (now - this.lastDirectMessageErrorTime > 5000) { "[profileModal] Direct message sync issue detected:",
userLogger.warn( error,
"[profileModal] Direct message sync issue detected:", );
error,
);
this.lastDirectMessageErrorTime = now;
}
if (this.activeMessagesRequest) { if (this.activeMessagesRequest) {
return; return;
-4
View File
@@ -62,10 +62,6 @@ export function sanitizeProfileMediaUrl(value) {
return trimmed; return trimmed;
} }
if (/^images\//i.test(trimmed)) {
return trimmed;
}
if (!/^https?:\/\//i.test(trimmed)) { if (!/^https?:\/\//i.test(trimmed)) {
if (LOCALHOST_PATTERN.test(trimmed)) { if (LOCALHOST_PATTERN.test(trimmed)) {
trimmed = `http://${trimmed}`; trimmed = `http://${trimmed}`;