Skip to content

Commit 3c43166

Browse files
committed
v3.66.410
1 parent a0411ee commit 3c43166

3 files changed

Lines changed: 24 additions & 19 deletions

File tree

functions/api/bot.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3659,7 +3659,7 @@ async function handleShopAction(context, body, botPrivkey, botPubkey) {
36593659
}
36603660

36613661
var BOT_NYM = "Nymbot";
3662-
var NYMCHAT_VERSION = "3.66.409";
3662+
var NYMCHAT_VERSION = "3.66.410";
36633663
var NYMCHAT_IOS_APP = "https://testflight.apple.com/join/k8FS8Mm3";
36643664
var NYMCHAT_ANDROID_APP = "https://play.google.com/store/apps/details?id=com.nym.bar";
36653665
var COMMAND_PREFIX = "?";
@@ -4296,7 +4296,7 @@ var NYMBOT_SYSTEM_PROMPT = [
42964296
"Games & Fun: ?trivia [category] — AI-generated trivia (general, history, science, crypto, nostr), ?joke — AI-generated joke, ?riddle — AI-generated riddle, ?wordplay [mode] — AI word game (wordle, anagram, scramble), ?flip — Coin flip, ?8ball — Magic 8-ball, ?pick <options> — Random pick.",
42974297
"Utility: ?math <expr> — Calculate, ?units <value> <from> to <to> — Convert units, ?time — UTC time, ?btc — Current Bitcoin price.",
42984298
"Channel Activity: ?who — Active nyms in channel, ?summarize — AI summary of channel discussion, ?top — Top channels by activity, ?last [N] — Recent messages, ?seen <nym> — Where was someone last seen.",
4299-
"Info: ?help — List all bot commands, ?about — About Nymchat (version, platform links), ?nostr — Nostr protocol tips, ?changelog [version] — Live Nymchat release notes pulled from GitHub (default shows the latest release; pass a tag like ?changelog v3.66.409 for a specific version).",
4299+
"Info: ?help — List all bot commands, ?about — About Nymchat (version, platform links), ?nostr — Nostr protocol tips, ?changelog [version] — Live Nymchat release notes pulled from GitHub (default shows the latest release; pass a tag like ?changelog v3.66.410 for a specific version).",
43004300
"Users can also type @Nymbot <question> to ask me directly.",
43014301
"Users can quote-reply any message and mention @Nymbot to ask about it, or reply to my responses to continue the conversation with context.",
43024302
"",
@@ -5129,7 +5129,7 @@ function findRelease(releases, query) {
51295129
var t = (releases[i].tag || "").toLowerCase().replace(/^v/, "");
51305130
if (t === normalized) return releases[i];
51315131
}
5132-
// Prefix match (e.g. "3.61" matches "3.66.409")
5132+
// Prefix match (e.g. "3.61" matches "3.66.410")
51335133
for (var j = 0; j < releases.length; j++) {
51345134
var tt = (releases[j].tag || "").toLowerCase().replace(/^v/, "");
51355135
if (tt.indexOf(normalized) === 0) return releases[j];
@@ -5184,7 +5184,7 @@ function needsChangelogContext(question) {
51845184
if (/\b(changelog|release notes?|what'?s new|whats new|patch notes?|update notes?)\b/.test(q)) return true;
51855185
if (/\b(latest|newest|recent|new|previous|last)\b.{0,30}\b(release|version|update)\b/.test(q)) return true;
51865186
if (/\b(release|version|update)\b.{0,30}\b(history|notes?|log|info)\b/.test(q)) return true;
5187-
// Specific version reference like "3.66.409", "v3.61", "version 3.60.300"
5187+
// Specific version reference like "3.66.410", "v3.61", "version 3.60.300"
51885188
if (/\bv?\d+\.\d+(?:\.\d+)?\b/.test(q) && /\b(nym|nymchat|app|version|release|update)\b/.test(q)) return true;
51895189
return false;
51905190
}

js/app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3541,7 +3541,7 @@ function initWallpaperUI() {
35413541
}
35423542
}
35433543

3544-
const NYMCHAT_VERSION = 'v3.66.409';
3544+
const NYMCHAT_VERSION = 'v3.66.410';
35453545

35463546
function showAbout(prefill) {
35473547
const modal = document.getElementById('aboutModal');

js/modules/nostr-core.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2371,38 +2371,43 @@ Object.assign(NYM.prototype, {
23712371
pubkey: ephPk
23722372
};
23732373

2374-
const psDifficulty = this._effectivePowDifficulty();
2375-
if (psDifficulty > 0) {
2376-
event = await this._minePow(event, psDifficulty);
2377-
}
2378-
2379-
// Sign with the ephemeral key (bypasses Nostr login signing)
2380-
const signedEvent = window.NostrTools.finalizeEvent(event, ephSk);
2381-
2374+
const tempId = '_optim_' + Math.random().toString(36).slice(2) + nowMs.toString(36);
2375+
const storageKey = geohash ? `#${geohash}` : channel;
23822376
const optimisticMessage = {
2383-
id: signedEvent.id,
2377+
id: tempId,
23842378
content: content,
23852379
author: anonNym,
23862380
pubkey: ephPk,
2387-
created_at: signedEvent.created_at,
2381+
created_at: now,
23882382
_ms: nowMs,
23892383
_seq: ++this._msgSeq,
2390-
timestamp: new Date(signedEvent.created_at * 1000),
2384+
timestamp: new Date(now * 1000),
23912385
channel: channel,
23922386
geohash: geohash,
23932387
isOwn: true,
23942388
isHistorical: false,
23952389
isPM: false,
2390+
_optimistic: true,
2391+
_storageKey: storageKey
23962392
};
23972393

23982394
this.userScrolledUp = false;
23992395
this.displayMessage(optimisticMessage);
24002396
this._scheduleScrollToBottom(true);
24012397
this.recordOwnActivity();
24022398

2403-
this.sendToRelay(["EVENT", signedEvent]);
2404-
2405-
if (wire.isGeohash) this.ensureGeoRelayDelivery(signedEvent, channelKey);
2399+
(async () => {
2400+
try {
2401+
const psDifficulty = this._effectivePowDifficulty();
2402+
if (psDifficulty > 0) event = await this._minePow(event, psDifficulty);
2403+
const signedEvent = window.NostrTools.finalizeEvent(event, ephSk);
2404+
this._replaceOptimisticMessage(tempId, signedEvent, storageKey, false);
2405+
this.sendToRelay(["EVENT", signedEvent]);
2406+
if (wire.isGeohash) this.ensureGeoRelayDelivery(signedEvent, channelKey);
2407+
} catch (err) {
2408+
this._markOptimisticFailed(tempId, storageKey, err);
2409+
}
2410+
})();
24062411

24072412
return true;
24082413
} catch (error) {

0 commit comments

Comments
 (0)