@corva/chat-core 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -16,6 +16,9 @@ It holds everything that is not UI: the Revolt/Stoat API and socket client, chat
|
|
|
16
16
|
- **No React.** Stores use `zustand/vanilla`; each app wraps them in its own hooks.
|
|
17
17
|
- **No UI dependencies** (`@corva/ui`, MUI, React Native).
|
|
18
18
|
|
|
19
|
+
Runtime dependencies must also resolve through a `main` field: the mobile app runs Metro with
|
|
20
|
+
package `exports` turned off, which is why `uuid` stays on v11 (v12+ ship only `exports`).
|
|
21
|
+
|
|
19
22
|
Hosts must provide a global `crypto.getRandomValues` for `uuid`: browsers have it, and the mobile
|
|
20
23
|
app installs it with `polyfillWebCrypto()` from `expo-standard-web-crypto` in its root layout.
|
|
21
24
|
|
package/dist/index.js
CHANGED
|
@@ -2554,7 +2554,10 @@ function wasRecentlyActive(userId, thresholdDays = DEFAULT_ACTIVITY_THRESHOLD_DA
|
|
|
2554
2554
|
try {
|
|
2555
2555
|
const timestamp = getChatStorage().getItem(getActivityKey(userId));
|
|
2556
2556
|
if (!timestamp) return false;
|
|
2557
|
-
|
|
2557
|
+
const now = Date.now();
|
|
2558
|
+
const then = Number(timestamp);
|
|
2559
|
+
const dstShift = (new Date(now).getTimezoneOffset() - new Date(then).getTimezoneOffset()) * 6e4;
|
|
2560
|
+
return now - then - dstShift < thresholdDays * DAY_MS;
|
|
2558
2561
|
} catch {
|
|
2559
2562
|
return false;
|
|
2560
2563
|
}
|
|
@@ -2740,7 +2743,7 @@ var removeMessageFromList = (messages, messageId) => {
|
|
|
2740
2743
|
};
|
|
2741
2744
|
|
|
2742
2745
|
// src/store/utils/messageHelpers.ts
|
|
2743
|
-
var isUploadFile = (file) => !!file && typeof file.name === "string";
|
|
2746
|
+
var isUploadFile = (file) => !!file && typeof file.name === "string" && typeof file.size === "number" && typeof file.type === "string";
|
|
2744
2747
|
async function uploadAndSend(api, data, nonce) {
|
|
2745
2748
|
if (data.uploadedFileIds?.length) {
|
|
2746
2749
|
const response2 = await api.sendMessage(
|