@takosjp/yurucommu-api 3.0.3 → 3.2.1
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/dist/index.js +467 -10
- package/dist/lib/api/browser-push.d.ts +78 -0
- package/dist/lib/api/browser-push.d.ts.map +1 -0
- package/dist/lib/api/communities.d.ts +14 -1
- package/dist/lib/api/communities.d.ts.map +1 -1
- package/dist/lib/api/dm.d.ts +8 -2
- package/dist/lib/api/dm.d.ts.map +1 -1
- package/dist/lib/api/gateway-url-fixtures.d.ts +18 -0
- package/dist/lib/api/gateway-url-fixtures.d.ts.map +1 -0
- package/dist/lib/api/normalize.d.ts.map +1 -1
- package/dist/lib/api/notification-target.d.ts +26 -0
- package/dist/lib/api/notification-target.d.ts.map +1 -0
- package/dist/lib/api/notifications.d.ts +19 -1
- package/dist/lib/api/notifications.d.ts.map +1 -1
- package/dist/lib/api/push-config.d.ts +57 -0
- package/dist/lib/api/push-config.d.ts.map +1 -0
- package/dist/lib/api.d.ts +3 -0
- package/dist/lib/api.d.ts.map +1 -1
- package/dist/social-server.d.ts +9 -0
- package/dist/social-server.d.ts.map +1 -1
- package/dist/types/index.d.ts +43 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -154,6 +154,63 @@ async function createAccount(username, name) {
|
|
|
154
154
|
return data.account;
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
// src/lib/api/notification-target.ts
|
|
158
|
+
function hasControlChar(value) {
|
|
159
|
+
for (let index = 0;index < value.length; index += 1) {
|
|
160
|
+
if (value.charCodeAt(index) < 32)
|
|
161
|
+
return true;
|
|
162
|
+
}
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
function safeNotificationPath(value) {
|
|
166
|
+
if (!value || !value.startsWith("/") || value.startsWith("//") || value.includes("\\") || hasControlChar(value)) {
|
|
167
|
+
return null;
|
|
168
|
+
}
|
|
169
|
+
return value;
|
|
170
|
+
}
|
|
171
|
+
function isStoryNotification(notification) {
|
|
172
|
+
return notification.target_kind === "story" || !!notification.object_ap_id?.includes("/ap/stories/");
|
|
173
|
+
}
|
|
174
|
+
function resolveNotificationTarget(notification) {
|
|
175
|
+
const declaredKind = notification.target_kind;
|
|
176
|
+
const declaredUrl = safeNotificationPath(notification.target_url);
|
|
177
|
+
if (declaredKind && declaredUrl) {
|
|
178
|
+
return {
|
|
179
|
+
target_kind: declaredKind,
|
|
180
|
+
target_id: notification.target_id ?? null,
|
|
181
|
+
target_url: declaredUrl
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
if (notification.type === "follow" || notification.type === "follow_request") {
|
|
185
|
+
const actorApId = notification.actor?.ap_id ?? null;
|
|
186
|
+
return {
|
|
187
|
+
target_kind: "profile",
|
|
188
|
+
target_id: actorApId,
|
|
189
|
+
target_url: actorApId ? `/profile/${encodeURIComponent(actorApId)}` : "/notifications"
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
const objectApId = notification.object_ap_id;
|
|
193
|
+
if (objectApId && isStoryNotification(notification)) {
|
|
194
|
+
return {
|
|
195
|
+
target_kind: "story",
|
|
196
|
+
target_id: objectApId,
|
|
197
|
+
target_url: `/?story=${encodeURIComponent(objectApId)}`
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
if (objectApId) {
|
|
201
|
+
return {
|
|
202
|
+
target_kind: "post",
|
|
203
|
+
target_id: objectApId,
|
|
204
|
+
target_url: `/post/${encodeURIComponent(objectApId)}`
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
target_kind: "notifications",
|
|
209
|
+
target_id: null,
|
|
210
|
+
target_url: "/notifications"
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
|
|
157
214
|
// src/lib/api/normalize.ts
|
|
158
215
|
function formatUsernameFromApId(apId, preferred) {
|
|
159
216
|
try {
|
|
@@ -195,10 +252,16 @@ var normalizeActorNote = (note) => ({
|
|
|
195
252
|
...note,
|
|
196
253
|
actor: normalizeActor(note.actor)
|
|
197
254
|
});
|
|
198
|
-
var normalizeNotification = (notification) =>
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
255
|
+
var normalizeNotification = (notification) => {
|
|
256
|
+
const target = resolveNotificationTarget(notification);
|
|
257
|
+
return {
|
|
258
|
+
...notification,
|
|
259
|
+
actor: normalizeActor(notification.actor),
|
|
260
|
+
target_kind: target.target_kind,
|
|
261
|
+
target_id: target.target_id,
|
|
262
|
+
target_url: target.target_url
|
|
263
|
+
};
|
|
264
|
+
};
|
|
202
265
|
|
|
203
266
|
// src/lib/api/actors.ts
|
|
204
267
|
async function fetchActor(identifier) {
|
|
@@ -453,11 +516,15 @@ async function fetchCommunityMessages(identifier, options) {
|
|
|
453
516
|
const data = await res.json();
|
|
454
517
|
return {
|
|
455
518
|
messages: (data.messages || []).map(normalizeCommunityMessage),
|
|
456
|
-
hasMore: data.has_more ?? false
|
|
519
|
+
hasMore: data.has_more ?? false,
|
|
520
|
+
readStates: data.read_states ?? []
|
|
457
521
|
};
|
|
458
522
|
}
|
|
459
|
-
async function sendCommunityMessage(identifier, content) {
|
|
460
|
-
const res = await apiPost(`/api/communities/${encodeURIComponent(identifier)}/messages`, {
|
|
523
|
+
async function sendCommunityMessage(identifier, content, attachments) {
|
|
524
|
+
const res = await apiPost(`/api/communities/${encodeURIComponent(identifier)}/messages`, {
|
|
525
|
+
content,
|
|
526
|
+
...attachments && attachments.length > 0 ? { attachments } : {}
|
|
527
|
+
});
|
|
461
528
|
await assertOk(res, "Failed to send message");
|
|
462
529
|
const data = await res.json();
|
|
463
530
|
return normalizeCommunityMessage(data.message);
|
|
@@ -570,11 +637,15 @@ async function fetchUserDMMessages(userApId, options) {
|
|
|
570
637
|
return {
|
|
571
638
|
messages: (data.messages || []).map(normalizeDmMessage),
|
|
572
639
|
conversation_id: data.conversation_id ?? null,
|
|
573
|
-
hasMore: data.has_more ?? false
|
|
640
|
+
hasMore: data.has_more ?? false,
|
|
641
|
+
partnerLastReadAt: data.partner_last_read_at ?? null
|
|
574
642
|
};
|
|
575
643
|
}
|
|
576
|
-
async function sendUserDMMessage(userApId, content) {
|
|
577
|
-
const res = await apiPost(`/api/dm/user/${encodeURIComponent(userApId)}/messages`, {
|
|
644
|
+
async function sendUserDMMessage(userApId, content, attachments) {
|
|
645
|
+
const res = await apiPost(`/api/dm/user/${encodeURIComponent(userApId)}/messages`, {
|
|
646
|
+
content,
|
|
647
|
+
...attachments && attachments.length > 0 ? { attachments } : {}
|
|
648
|
+
});
|
|
578
649
|
await assertOk(res, "Failed to send message");
|
|
579
650
|
const data = await res.json();
|
|
580
651
|
return {
|
|
@@ -678,6 +749,380 @@ async function archiveAllNotifications() {
|
|
|
678
749
|
const data = await res.json();
|
|
679
750
|
return data.archived_count ?? 0;
|
|
680
751
|
}
|
|
752
|
+
async function registerNotificationPusher(input) {
|
|
753
|
+
const res = await apiPost("/api/notifications/pushers", input);
|
|
754
|
+
await assertOk(res, "Failed to register notification pusher");
|
|
755
|
+
const data = await res.json();
|
|
756
|
+
return data.pusher;
|
|
757
|
+
}
|
|
758
|
+
async function unregisterNotificationPusher(input) {
|
|
759
|
+
const res = await apiDelete("/api/notifications/pushers", input);
|
|
760
|
+
await assertOk(res, "Failed to unregister notification pusher");
|
|
761
|
+
}
|
|
762
|
+
async function fetchNotificationPusherPublicConfig() {
|
|
763
|
+
const res = await apiFetch("/api/notifications/pushers/config");
|
|
764
|
+
await assertOk(res, "Failed to load notification pusher configuration");
|
|
765
|
+
const value = await res.json();
|
|
766
|
+
const gatewayUrl = typeof value.gateway_url === "string" ? value.gateway_url : null;
|
|
767
|
+
const publicKey = typeof value.web_push_public_key === "string" ? value.web_push_public_key : null;
|
|
768
|
+
return {
|
|
769
|
+
enabled: Boolean(gatewayUrl && publicKey),
|
|
770
|
+
gateway_url: gatewayUrl,
|
|
771
|
+
web_push_public_key: publicKey
|
|
772
|
+
};
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
// src/lib/api/browser-push.ts
|
|
776
|
+
async function getBrowserNotificationPushState(config, runtime = browserPushRuntime()) {
|
|
777
|
+
if (!runtime.serviceWorker || !runtime.notification)
|
|
778
|
+
return "unsupported";
|
|
779
|
+
const normalized = normalizeBrowserPushConfig(config);
|
|
780
|
+
if (!normalized)
|
|
781
|
+
return "unconfigured";
|
|
782
|
+
if (runtime.notification.permission === "denied")
|
|
783
|
+
return "denied";
|
|
784
|
+
const registration = await runtime.serviceWorker.getRegistration();
|
|
785
|
+
const subscription = await registration?.pushManager.getSubscription();
|
|
786
|
+
return subscription && subscriptionMatchesConfig(normalized, subscription, runtime) ? "enabled" : "disabled";
|
|
787
|
+
}
|
|
788
|
+
async function enableBrowserNotificationPush(config, runtime = browserPushRuntime()) {
|
|
789
|
+
if (!runtime.serviceWorker || !runtime.notification) {
|
|
790
|
+
return { state: "unsupported" };
|
|
791
|
+
}
|
|
792
|
+
const normalized = requireBrowserPushConfig(config);
|
|
793
|
+
const permission = runtime.notification.permission === "default" ? await runtime.notification.requestPermission() : runtime.notification.permission;
|
|
794
|
+
if (permission !== "granted") {
|
|
795
|
+
return { state: permission === "denied" ? "denied" : "disabled" };
|
|
796
|
+
}
|
|
797
|
+
const serviceWorker = await runtime.serviceWorker.register(normalized.serviceWorkerPath, { scope: "/" });
|
|
798
|
+
let existing = await serviceWorker.pushManager.getSubscription();
|
|
799
|
+
if (existing && !subscriptionMatchesConfig(normalized, existing, runtime)) {
|
|
800
|
+
await retireBrowserSubscription(normalized, existing, runtime);
|
|
801
|
+
existing = null;
|
|
802
|
+
}
|
|
803
|
+
const subscription = existing ?? await serviceWorker.pushManager.subscribe({
|
|
804
|
+
userVisibleOnly: true,
|
|
805
|
+
applicationServerKey: normalized.applicationServerKey
|
|
806
|
+
});
|
|
807
|
+
const registration = await registerBrowserSubscription(normalized, subscription);
|
|
808
|
+
storeBrowserPushBinding(normalized, subscription, runtime);
|
|
809
|
+
return { state: "enabled", registration };
|
|
810
|
+
}
|
|
811
|
+
async function refreshBrowserNotificationPush(config, runtime = browserPushRuntime()) {
|
|
812
|
+
if (!runtime.serviceWorker || !runtime.notification)
|
|
813
|
+
return "unsupported";
|
|
814
|
+
const normalized = normalizeBrowserPushConfig(config);
|
|
815
|
+
if (!normalized)
|
|
816
|
+
return "unconfigured";
|
|
817
|
+
if (runtime.notification.permission !== "granted") {
|
|
818
|
+
return runtime.notification.permission === "denied" ? "denied" : "disabled";
|
|
819
|
+
}
|
|
820
|
+
const serviceWorker = await runtime.serviceWorker.register(normalized.serviceWorkerPath, { scope: "/" });
|
|
821
|
+
const subscription = await serviceWorker.pushManager.getSubscription();
|
|
822
|
+
if (!subscription)
|
|
823
|
+
return "disabled";
|
|
824
|
+
if (!subscriptionMatchesConfig(normalized, subscription, runtime)) {
|
|
825
|
+
await retireBrowserSubscription(normalized, subscription, runtime);
|
|
826
|
+
return "disabled";
|
|
827
|
+
}
|
|
828
|
+
await registerBrowserSubscription(normalized, subscription);
|
|
829
|
+
storeBrowserPushBinding(normalized, subscription, runtime);
|
|
830
|
+
return "enabled";
|
|
831
|
+
}
|
|
832
|
+
async function disableBrowserNotificationPush(config, runtime = browserPushRuntime()) {
|
|
833
|
+
if (!runtime.serviceWorker || !runtime.notification)
|
|
834
|
+
return "unsupported";
|
|
835
|
+
const normalized = requireBrowserPushConfig(config);
|
|
836
|
+
const serviceWorker = await runtime.serviceWorker.getRegistration();
|
|
837
|
+
const subscription = await serviceWorker?.pushManager.getSubscription();
|
|
838
|
+
if (!subscription) {
|
|
839
|
+
clearBrowserPushBinding(normalized, runtime);
|
|
840
|
+
return "disabled";
|
|
841
|
+
}
|
|
842
|
+
await retireBrowserSubscription(normalized, subscription, runtime, true);
|
|
843
|
+
return "disabled";
|
|
844
|
+
}
|
|
845
|
+
async function clearBrowserNotificationPush(identity, runtime = browserPushRuntime()) {
|
|
846
|
+
if (!runtime.serviceWorker)
|
|
847
|
+
return "unsupported";
|
|
848
|
+
const registration = await runtime.serviceWorker.getRegistration();
|
|
849
|
+
const subscription = await registration?.pushManager.getSubscription();
|
|
850
|
+
if (subscription)
|
|
851
|
+
await subscription.unsubscribe();
|
|
852
|
+
clearBrowserPushBindingForIdentity(identity, runtime);
|
|
853
|
+
return "disabled";
|
|
854
|
+
}
|
|
855
|
+
function browserPushRuntime() {
|
|
856
|
+
const navigatorValue = globalThis.navigator;
|
|
857
|
+
const notificationValue = globalThis.Notification;
|
|
858
|
+
let storage;
|
|
859
|
+
try {
|
|
860
|
+
storage = globalThis.localStorage;
|
|
861
|
+
} catch {
|
|
862
|
+
storage = undefined;
|
|
863
|
+
}
|
|
864
|
+
return {
|
|
865
|
+
...navigatorValue?.serviceWorker ? {
|
|
866
|
+
serviceWorker: navigatorValue.serviceWorker
|
|
867
|
+
} : {},
|
|
868
|
+
...notificationValue ? {
|
|
869
|
+
notification: notificationValue
|
|
870
|
+
} : {},
|
|
871
|
+
...storage ? { storage } : {}
|
|
872
|
+
};
|
|
873
|
+
}
|
|
874
|
+
function requireBrowserPushConfig(config) {
|
|
875
|
+
const normalized = normalizeBrowserPushConfig(config);
|
|
876
|
+
if (!normalized) {
|
|
877
|
+
throw new Error("Browser notification push requires a valid HTTPS gateway URL, VAPID public key, app id, and root-relative service worker path.");
|
|
878
|
+
}
|
|
879
|
+
return normalized;
|
|
880
|
+
}
|
|
881
|
+
function normalizeBrowserPushConfig(config) {
|
|
882
|
+
if (!config)
|
|
883
|
+
return null;
|
|
884
|
+
const appId = config.appId.trim();
|
|
885
|
+
const appDisplayName = config.appDisplayName.trim();
|
|
886
|
+
const serverOrigin = normalizeServerOrigin(config.serverOrigin);
|
|
887
|
+
const gatewayUrl = normalizeGatewayUrl(config.gatewayUrl);
|
|
888
|
+
const vapidPublicKey = config.vapidPublicKey.trim();
|
|
889
|
+
const applicationServerKey = decodeVapidPublicKey(vapidPublicKey);
|
|
890
|
+
const serviceWorkerPath = config.serviceWorkerPath.trim();
|
|
891
|
+
if (!/^[A-Za-z0-9][A-Za-z0-9._-]{0,254}$/.test(appId) || !appDisplayName || appDisplayName.length > 255 || !serverOrigin || !gatewayUrl || !applicationServerKey || !serviceWorkerPath.startsWith("/") || serviceWorkerPath.startsWith("//") || serviceWorkerPath.length > 512) {
|
|
892
|
+
return null;
|
|
893
|
+
}
|
|
894
|
+
return {
|
|
895
|
+
...config,
|
|
896
|
+
appId,
|
|
897
|
+
appDisplayName,
|
|
898
|
+
serverOrigin,
|
|
899
|
+
gatewayUrl,
|
|
900
|
+
vapidPublicKey,
|
|
901
|
+
serviceWorkerPath,
|
|
902
|
+
applicationServerKey
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
function normalizeServerOrigin(value) {
|
|
906
|
+
try {
|
|
907
|
+
const url = new URL(value.trim());
|
|
908
|
+
if (url.username || url.password || url.hash)
|
|
909
|
+
return null;
|
|
910
|
+
const loopback = url.hostname === "localhost" || url.hostname === "127.0.0.1" || url.hostname === "[::1]";
|
|
911
|
+
if (url.protocol !== "https:" && !(url.protocol === "http:" && loopback)) {
|
|
912
|
+
return null;
|
|
913
|
+
}
|
|
914
|
+
return url.origin;
|
|
915
|
+
} catch {
|
|
916
|
+
return null;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
function normalizeBrowserPushGatewayUrl(value) {
|
|
920
|
+
return normalizeGatewayUrl(value);
|
|
921
|
+
}
|
|
922
|
+
function normalizeGatewayUrl(value) {
|
|
923
|
+
try {
|
|
924
|
+
const url = new URL(value.trim());
|
|
925
|
+
if (url.username || url.password || url.hash)
|
|
926
|
+
return null;
|
|
927
|
+
if (url.protocol === "https:") {
|
|
928
|
+
if (url.port && url.port !== "443")
|
|
929
|
+
return null;
|
|
930
|
+
if (!isPublicHttpsHostname(url.hostname))
|
|
931
|
+
return null;
|
|
932
|
+
return url.toString();
|
|
933
|
+
}
|
|
934
|
+
if (url.protocol !== "http:" || !isLoopbackHostname(url.hostname)) {
|
|
935
|
+
return null;
|
|
936
|
+
}
|
|
937
|
+
return url.toString();
|
|
938
|
+
} catch {
|
|
939
|
+
return null;
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
function isLoopbackHostname(hostname) {
|
|
943
|
+
const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
944
|
+
if (normalized === "localhost" || normalized.endsWith(".localhost") || normalized === "::1") {
|
|
945
|
+
return true;
|
|
946
|
+
}
|
|
947
|
+
const octets = normalized.split(".").map(Number);
|
|
948
|
+
return octets.length === 4 && octets.every((part) => Number.isInteger(part) && part >= 0 && part <= 255) && octets[0] === 127;
|
|
949
|
+
}
|
|
950
|
+
function isPublicHttpsHostname(hostname) {
|
|
951
|
+
const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, "");
|
|
952
|
+
if (!normalized.includes(".") || normalized.endsWith(".localhost") || normalized.endsWith(".local") || normalized.endsWith(".internal") || normalized.endsWith(".home") || normalized.endsWith(".lan")) {
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
955
|
+
const ipv4 = normalized.split(".").map(Number);
|
|
956
|
+
if (ipv4.length === 4 && ipv4.every((part) => Number.isInteger(part) && part >= 0 && part <= 255)) {
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
959
|
+
return !normalized.includes(":");
|
|
960
|
+
}
|
|
961
|
+
function decodeVapidPublicKey(value) {
|
|
962
|
+
const normalized = value.trim().replace(/-/g, "+").replace(/_/g, "/");
|
|
963
|
+
if (!normalized || normalized.length > 256)
|
|
964
|
+
return null;
|
|
965
|
+
const padded = normalized.padEnd(Math.ceil(normalized.length / 4) * 4, "=");
|
|
966
|
+
try {
|
|
967
|
+
const binary = globalThis.atob(padded);
|
|
968
|
+
const bytes = Uint8Array.from(binary, (character) => character.charCodeAt(0));
|
|
969
|
+
return bytes.byteLength === 65 && bytes[0] === 4 ? bytes : null;
|
|
970
|
+
} catch {
|
|
971
|
+
return null;
|
|
972
|
+
}
|
|
973
|
+
}
|
|
974
|
+
async function registerBrowserSubscription(config, subscription) {
|
|
975
|
+
const registration = await registerNotificationPusher({
|
|
976
|
+
product: config.product,
|
|
977
|
+
...config.scope ? { scope: config.scope } : {},
|
|
978
|
+
pusher: {
|
|
979
|
+
kind: "http",
|
|
980
|
+
app_id: config.appId,
|
|
981
|
+
app_display_name: config.appDisplayName,
|
|
982
|
+
pushkey: subscription.endpoint,
|
|
983
|
+
...config.lang ? { lang: config.lang } : {},
|
|
984
|
+
data: {
|
|
985
|
+
url: config.gatewayUrl,
|
|
986
|
+
format: "event_id_only",
|
|
987
|
+
provider: "webpush",
|
|
988
|
+
ttl: 60,
|
|
989
|
+
urgency: "normal"
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
});
|
|
993
|
+
return registration;
|
|
994
|
+
}
|
|
995
|
+
function browserPushBindingKey(identity) {
|
|
996
|
+
return `yurucommu.browser-push.v1.${identity.product}.${identity.appId}`;
|
|
997
|
+
}
|
|
998
|
+
function readBrowserPushBinding(config, runtime) {
|
|
999
|
+
try {
|
|
1000
|
+
const value = runtime.storage?.getItem(browserPushBindingKey(config));
|
|
1001
|
+
if (!value || value.length > 4096)
|
|
1002
|
+
return null;
|
|
1003
|
+
const parsed = JSON.parse(value);
|
|
1004
|
+
return typeof parsed.endpoint === "string" && typeof parsed.serverOrigin === "string" && typeof parsed.vapidPublicKey === "string" ? {
|
|
1005
|
+
endpoint: parsed.endpoint,
|
|
1006
|
+
serverOrigin: parsed.serverOrigin,
|
|
1007
|
+
vapidPublicKey: parsed.vapidPublicKey
|
|
1008
|
+
} : null;
|
|
1009
|
+
} catch {
|
|
1010
|
+
return null;
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
function storeBrowserPushBinding(config, subscription, runtime) {
|
|
1014
|
+
try {
|
|
1015
|
+
runtime.storage?.setItem(browserPushBindingKey(config), JSON.stringify({
|
|
1016
|
+
endpoint: subscription.endpoint,
|
|
1017
|
+
serverOrigin: config.serverOrigin,
|
|
1018
|
+
vapidPublicKey: config.vapidPublicKey
|
|
1019
|
+
}));
|
|
1020
|
+
} catch {}
|
|
1021
|
+
}
|
|
1022
|
+
function clearBrowserPushBinding(config, runtime) {
|
|
1023
|
+
clearBrowserPushBindingForIdentity(config, runtime);
|
|
1024
|
+
}
|
|
1025
|
+
function clearBrowserPushBindingForIdentity(identity, runtime) {
|
|
1026
|
+
try {
|
|
1027
|
+
runtime.storage?.removeItem(browserPushBindingKey(identity));
|
|
1028
|
+
} catch {}
|
|
1029
|
+
}
|
|
1030
|
+
function subscriptionMatchesConfig(config, subscription, runtime) {
|
|
1031
|
+
const binding = readBrowserPushBinding(config, runtime);
|
|
1032
|
+
if (binding && (binding.endpoint !== subscription.endpoint || binding.serverOrigin !== config.serverOrigin || binding.vapidPublicKey !== config.vapidPublicKey)) {
|
|
1033
|
+
return false;
|
|
1034
|
+
}
|
|
1035
|
+
const existingKey = subscription.options?.applicationServerKey;
|
|
1036
|
+
if (!existingKey)
|
|
1037
|
+
return binding !== null;
|
|
1038
|
+
return equalBufferSources(existingKey, config.applicationServerKey);
|
|
1039
|
+
}
|
|
1040
|
+
function equalBufferSources(left, right) {
|
|
1041
|
+
const leftBytes = bufferSourceBytes(left);
|
|
1042
|
+
const rightBytes = bufferSourceBytes(right);
|
|
1043
|
+
if (leftBytes.byteLength !== rightBytes.byteLength)
|
|
1044
|
+
return false;
|
|
1045
|
+
for (let index = 0;index < leftBytes.byteLength; index += 1) {
|
|
1046
|
+
if (leftBytes[index] !== rightBytes[index])
|
|
1047
|
+
return false;
|
|
1048
|
+
}
|
|
1049
|
+
return true;
|
|
1050
|
+
}
|
|
1051
|
+
function bufferSourceBytes(value) {
|
|
1052
|
+
return ArrayBuffer.isView(value) ? new Uint8Array(value.buffer, value.byteOffset, value.byteLength) : new Uint8Array(value);
|
|
1053
|
+
}
|
|
1054
|
+
async function retireBrowserSubscription(config, subscription, runtime, unregisterCurrentServer = false) {
|
|
1055
|
+
const binding = readBrowserPushBinding(config, runtime);
|
|
1056
|
+
const canUnregisterCurrentServer = unregisterCurrentServer || !binding || binding.serverOrigin === config.serverOrigin;
|
|
1057
|
+
if (canUnregisterCurrentServer) {
|
|
1058
|
+
try {
|
|
1059
|
+
await unregisterNotificationPusher({
|
|
1060
|
+
product: config.product,
|
|
1061
|
+
...config.scope ? { scope: config.scope } : {},
|
|
1062
|
+
app_id: config.appId,
|
|
1063
|
+
pushkey: subscription.endpoint
|
|
1064
|
+
});
|
|
1065
|
+
} catch {}
|
|
1066
|
+
}
|
|
1067
|
+
try {
|
|
1068
|
+
await subscription.unsubscribe();
|
|
1069
|
+
} finally {
|
|
1070
|
+
clearBrowserPushBinding(config, runtime);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
|
|
1074
|
+
// src/lib/api/push-config.ts
|
|
1075
|
+
function createBrowserPushConfigResolver(options) {
|
|
1076
|
+
const { identity, resolveServerOrigin, buildTimeValues } = options;
|
|
1077
|
+
const build = (values) => {
|
|
1078
|
+
const gatewayUrl = values?.gatewayUrl?.trim();
|
|
1079
|
+
const vapidPublicKey = values?.vapidPublicKey?.trim();
|
|
1080
|
+
if (!gatewayUrl || !vapidPublicKey)
|
|
1081
|
+
return null;
|
|
1082
|
+
const serverOrigin = resolveServerOrigin();
|
|
1083
|
+
if (!serverOrigin)
|
|
1084
|
+
return null;
|
|
1085
|
+
return {
|
|
1086
|
+
product: identity.product,
|
|
1087
|
+
appId: identity.appId,
|
|
1088
|
+
appDisplayName: identity.appDisplayName,
|
|
1089
|
+
serverOrigin,
|
|
1090
|
+
gatewayUrl,
|
|
1091
|
+
vapidPublicKey,
|
|
1092
|
+
serviceWorkerPath: identity.serviceWorkerPath,
|
|
1093
|
+
...identity.scope ? { scope: identity.scope } : {},
|
|
1094
|
+
...identity.lang ? { lang: identity.lang } : {}
|
|
1095
|
+
};
|
|
1096
|
+
};
|
|
1097
|
+
const buildTimeConfig = () => build(buildTimeValues?.() ?? null);
|
|
1098
|
+
const resolveConfig = async () => {
|
|
1099
|
+
try {
|
|
1100
|
+
const runtime = await fetchNotificationPusherPublicConfig();
|
|
1101
|
+
if (!runtime.enabled || !runtime.gateway_url || !runtime.web_push_public_key) {
|
|
1102
|
+
return null;
|
|
1103
|
+
}
|
|
1104
|
+
return build({
|
|
1105
|
+
gatewayUrl: runtime.gateway_url,
|
|
1106
|
+
vapidPublicKey: runtime.web_push_public_key
|
|
1107
|
+
});
|
|
1108
|
+
} catch {
|
|
1109
|
+
return buildTimeConfig();
|
|
1110
|
+
}
|
|
1111
|
+
};
|
|
1112
|
+
const clearBeforeSignOut = async () => {
|
|
1113
|
+
const config = await resolveConfig().catch(() => null);
|
|
1114
|
+
if (config) {
|
|
1115
|
+
try {
|
|
1116
|
+
await disableBrowserNotificationPush(config);
|
|
1117
|
+
return;
|
|
1118
|
+
} catch {}
|
|
1119
|
+
}
|
|
1120
|
+
await clearBrowserNotificationPush(identity).catch(() => {
|
|
1121
|
+
return;
|
|
1122
|
+
});
|
|
1123
|
+
};
|
|
1124
|
+
return { buildTimeConfig, resolveConfig, clearBeforeSignOut };
|
|
1125
|
+
}
|
|
681
1126
|
|
|
682
1127
|
// src/lib/api/search.ts
|
|
683
1128
|
function pageParams(query, opts) {
|
|
@@ -932,6 +1377,7 @@ export {
|
|
|
932
1377
|
updateCommunitySettings,
|
|
933
1378
|
updateCommunityMemberRole,
|
|
934
1379
|
unrepostPost,
|
|
1380
|
+
unregisterNotificationPusher,
|
|
935
1381
|
unmuteUser,
|
|
936
1382
|
unlikeStory,
|
|
937
1383
|
unlikePost,
|
|
@@ -954,17 +1400,22 @@ export {
|
|
|
954
1400
|
searchPosts,
|
|
955
1401
|
searchHashtag,
|
|
956
1402
|
searchActors,
|
|
1403
|
+
safeNotificationPath,
|
|
957
1404
|
revokeCommunityInvite,
|
|
958
1405
|
resolveReport,
|
|
1406
|
+
resolveNotificationTarget,
|
|
959
1407
|
repostPost,
|
|
960
1408
|
reportContent,
|
|
961
1409
|
removeCommunityMember,
|
|
962
1410
|
rejectFollowRequest,
|
|
963
1411
|
rejectDMRequest,
|
|
964
1412
|
rejectCommunityJoinRequest,
|
|
1413
|
+
registerNotificationPusher,
|
|
1414
|
+
refreshBrowserNotificationPush,
|
|
965
1415
|
normalizeStory,
|
|
966
1416
|
normalizePost,
|
|
967
1417
|
normalizeNotification,
|
|
1418
|
+
normalizeBrowserPushGatewayUrl,
|
|
968
1419
|
normalizeActorStories,
|
|
969
1420
|
normalizeActorNote,
|
|
970
1421
|
normalizeActor,
|
|
@@ -984,6 +1435,7 @@ export {
|
|
|
984
1435
|
joinCommunity,
|
|
985
1436
|
getYurucommuApiTransport,
|
|
986
1437
|
getStoryViewers,
|
|
1438
|
+
getBrowserNotificationPushState,
|
|
987
1439
|
follow,
|
|
988
1440
|
fetchUserDMTyping,
|
|
989
1441
|
fetchUserDMMessages,
|
|
@@ -997,6 +1449,7 @@ export {
|
|
|
997
1449
|
fetchRecommendedUsers,
|
|
998
1450
|
fetchPost,
|
|
999
1451
|
fetchNotifications,
|
|
1452
|
+
fetchNotificationPusherPublicConfig,
|
|
1000
1453
|
fetchNotes,
|
|
1001
1454
|
fetchMutedUsers,
|
|
1002
1455
|
fetchFollowing,
|
|
@@ -1022,7 +1475,9 @@ export {
|
|
|
1022
1475
|
fetchActor,
|
|
1023
1476
|
fetchAccounts,
|
|
1024
1477
|
extractErrorMessage,
|
|
1478
|
+
enableBrowserNotificationPush,
|
|
1025
1479
|
editPost,
|
|
1480
|
+
disableBrowserNotificationPush,
|
|
1026
1481
|
deleteStory,
|
|
1027
1482
|
deletePost,
|
|
1028
1483
|
deleteMyNote,
|
|
@@ -1033,8 +1488,10 @@ export {
|
|
|
1033
1488
|
createNote,
|
|
1034
1489
|
createCommunityInvite,
|
|
1035
1490
|
createCommunity,
|
|
1491
|
+
createBrowserPushConfigResolver,
|
|
1036
1492
|
createAccount,
|
|
1037
1493
|
clearYurucommuApiTransport,
|
|
1494
|
+
clearBrowserNotificationPush,
|
|
1038
1495
|
bookmarkPost,
|
|
1039
1496
|
blockUser,
|
|
1040
1497
|
blockDomain,
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { NotificationPusherProduct, NotificationPusherRegistration } from "../../types/index.js";
|
|
2
|
+
export type BrowserNotificationPushState = "unsupported" | "unconfigured" | "denied" | "disabled" | "enabled";
|
|
3
|
+
export interface BrowserNotificationPushConfig {
|
|
4
|
+
readonly product: NotificationPusherProduct;
|
|
5
|
+
readonly appId: string;
|
|
6
|
+
readonly appDisplayName: string;
|
|
7
|
+
/** Origin of the yurucommu-compatible API that owns this registration. */
|
|
8
|
+
readonly serverOrigin: string;
|
|
9
|
+
/** Public stateless gateway notify endpoint. */
|
|
10
|
+
readonly gatewayUrl: string;
|
|
11
|
+
/** Public uncompressed P-256 VAPID key, base64url encoded. */
|
|
12
|
+
readonly vapidPublicKey: string;
|
|
13
|
+
readonly serviceWorkerPath: string;
|
|
14
|
+
readonly scope?: string;
|
|
15
|
+
readonly lang?: string;
|
|
16
|
+
}
|
|
17
|
+
interface BrowserPushSubscriptionLike {
|
|
18
|
+
readonly endpoint: string;
|
|
19
|
+
readonly options?: {
|
|
20
|
+
readonly applicationServerKey: ArrayBuffer | null;
|
|
21
|
+
};
|
|
22
|
+
unsubscribe(): Promise<boolean>;
|
|
23
|
+
}
|
|
24
|
+
interface BrowserPushManagerLike {
|
|
25
|
+
getSubscription(): Promise<BrowserPushSubscriptionLike | null>;
|
|
26
|
+
subscribe(options: {
|
|
27
|
+
readonly userVisibleOnly: true;
|
|
28
|
+
readonly applicationServerKey: BufferSource;
|
|
29
|
+
}): Promise<BrowserPushSubscriptionLike>;
|
|
30
|
+
}
|
|
31
|
+
interface BrowserServiceWorkerRegistrationLike {
|
|
32
|
+
readonly pushManager: BrowserPushManagerLike;
|
|
33
|
+
}
|
|
34
|
+
interface BrowserServiceWorkerContainerLike {
|
|
35
|
+
register(scriptURL: string, options?: RegistrationOptions): Promise<BrowserServiceWorkerRegistrationLike>;
|
|
36
|
+
getRegistration(clientURL?: string): Promise<BrowserServiceWorkerRegistrationLike | undefined>;
|
|
37
|
+
}
|
|
38
|
+
interface BrowserNotificationApiLike {
|
|
39
|
+
readonly permission: NotificationPermission;
|
|
40
|
+
requestPermission(): Promise<NotificationPermission>;
|
|
41
|
+
}
|
|
42
|
+
interface BrowserPushStorageLike {
|
|
43
|
+
getItem(key: string): string | null;
|
|
44
|
+
setItem(key: string, value: string): void;
|
|
45
|
+
removeItem(key: string): void;
|
|
46
|
+
}
|
|
47
|
+
export interface BrowserNotificationPushRuntime {
|
|
48
|
+
readonly serviceWorker?: BrowserServiceWorkerContainerLike;
|
|
49
|
+
readonly notification?: BrowserNotificationApiLike;
|
|
50
|
+
readonly storage?: BrowserPushStorageLike;
|
|
51
|
+
}
|
|
52
|
+
export declare function getBrowserNotificationPushState(config: BrowserNotificationPushConfig | null | undefined, runtime?: BrowserNotificationPushRuntime): Promise<BrowserNotificationPushState>;
|
|
53
|
+
export declare function enableBrowserNotificationPush(config: BrowserNotificationPushConfig, runtime?: BrowserNotificationPushRuntime): Promise<{
|
|
54
|
+
readonly state: BrowserNotificationPushState;
|
|
55
|
+
readonly registration?: NotificationPusherRegistration;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Rebind an existing browser subscription to the current signed-in actor.
|
|
59
|
+
* This never requests permission and never creates a new subscription.
|
|
60
|
+
*/
|
|
61
|
+
export declare function refreshBrowserNotificationPush(config: BrowserNotificationPushConfig | null | undefined, runtime?: BrowserNotificationPushRuntime): Promise<BrowserNotificationPushState>;
|
|
62
|
+
export declare function disableBrowserNotificationPush(config: BrowserNotificationPushConfig, runtime?: BrowserNotificationPushRuntime): Promise<BrowserNotificationPushState>;
|
|
63
|
+
/**
|
|
64
|
+
* Invalidate this product's browser endpoint without requiring runtime push
|
|
65
|
+
* configuration. Use this during logout/account teardown so a removed or
|
|
66
|
+
* temporarily unavailable server cannot keep waking a signed-out device.
|
|
67
|
+
*/
|
|
68
|
+
export declare function clearBrowserNotificationPush(identity: Pick<BrowserNotificationPushConfig, "product" | "appId" | "serviceWorkerPath">, runtime?: BrowserNotificationPushRuntime): Promise<BrowserNotificationPushState>;
|
|
69
|
+
/**
|
|
70
|
+
* Client-side gateway URL policy. MUST stay behaviorally equivalent to the
|
|
71
|
+
* server's `normalizeGatewayUrl` in the notification pusher contract — a
|
|
72
|
+
* client-accepted / server-rejected URL yields a confusing "registers but
|
|
73
|
+
* 400s" failure. The equivalence is pinned by a shared-fixture drift test.
|
|
74
|
+
* Exported for that test; app code calls the higher-level helpers above.
|
|
75
|
+
*/
|
|
76
|
+
export declare function normalizeBrowserPushGatewayUrl(value: string): string | null;
|
|
77
|
+
export {};
|
|
78
|
+
//# sourceMappingURL=browser-push.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-push.d.ts","sourceRoot":"","sources":["../../../src/lib/api/browser-push.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,sBAAsB,CAAC;AAM9B,MAAM,MAAM,4BAA4B,GACtC,aAAa,GAAG,cAAc,GAAG,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;AAErE,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,0EAA0E;IAC1E,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,gDAAgD;IAChD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,8DAA8D;IAC9D,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,UAAU,2BAA2B;I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BAA0B,CAAC;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,sBAAsB,CAAC;CAC3C;AAED,wBAAsB,+BAA+B,CACnD,MAAM,EAAE,6BAA6B,GAAG,IAAI,GAAG,SAAS,EACxD,OAAO,GAAE,8BAAqD,GAC7D,OAAO,CAAC,4BAA4B,CAAC,CAWvC;AAED,wBAAsB,6BAA6B,CACjD,MAAM,EAAE,6BAA6B,EACrC,OAAO,GAAE,8BAAqD,GAC7D,OAAO,CAAC;IACT,QAAQ,CAAC,KAAK,EAAE,4BAA4B,CAAC;IAC7C,QAAQ,CAAC,YAAY,CAAC,EAAE,8BAA8B,CAAC;CACxD,CAAC,CAkCD;AAED;;;GAGG;AACH,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,6BAA6B,GAAG,IAAI,GAAG,SAAS,EACxD,OAAO,GAAE,8BAAqD,GAC7D,OAAO,CAAC,4BAA4B,CAAC,CAoBvC;AAED,wBAAsB,8BAA8B,CAClD,MAAM,EAAE,6BAA6B,EACrC,OAAO,GAAE,8BAAqD,GAC7D,OAAO,CAAC,4BAA4B,CAAC,CAevC;AAED;;;;GAIG;AACH,wBAAsB,4BAA4B,CAChD,QAAQ,EAAE,IAAI,CACZ,6BAA6B,EAC7B,SAAS,GAAG,OAAO,GAAG,mBAAmB,CAC1C,EACD,OAAO,GAAE,8BAAqD,GAC7D,OAAO,CAAC,4BAA4B,CAAC,CAOvC;AAiGD;;;;;;GAMG;AACH,wBAAgB,8BAA8B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE3E"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MediaAttachment } from "../../types/index.js";
|
|
1
2
|
export interface CommunityDetail {
|
|
2
3
|
ap_id: string;
|
|
3
4
|
name: string;
|
|
@@ -35,8 +36,18 @@ export interface CommunityMessage {
|
|
|
35
36
|
icon_url: string | null;
|
|
36
37
|
};
|
|
37
38
|
content: string;
|
|
39
|
+
/** Media attachments (image/video), same shape as post attachments. */
|
|
40
|
+
attachments?: MediaAttachment[];
|
|
38
41
|
created_at: string;
|
|
39
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* A member's chat read position (LOCAL-ONLY read receipt). Only local members
|
|
45
|
+
* that opened the chat appear; remote members never report read state.
|
|
46
|
+
*/
|
|
47
|
+
export interface CommunityReadState {
|
|
48
|
+
actor_ap_id: string;
|
|
49
|
+
last_read_at: string;
|
|
50
|
+
}
|
|
40
51
|
export interface JoinCommunityResult {
|
|
41
52
|
status: "joined" | "pending" | "invite_required";
|
|
42
53
|
}
|
|
@@ -91,8 +102,10 @@ export declare function fetchCommunityMessages(identifier: string, options?: {
|
|
|
91
102
|
}): Promise<{
|
|
92
103
|
messages: CommunityMessage[];
|
|
93
104
|
hasMore: boolean;
|
|
105
|
+
/** Per-member read positions (local members only; see CommunityReadState). */
|
|
106
|
+
readStates: CommunityReadState[];
|
|
94
107
|
}>;
|
|
95
|
-
export declare function sendCommunityMessage(identifier: string, content: string): Promise<CommunityMessage>;
|
|
108
|
+
export declare function sendCommunityMessage(identifier: string, content: string, attachments?: MediaAttachment[]): Promise<CommunityMessage>;
|
|
96
109
|
export declare function fetchCommunityMembers(identifier: string): Promise<CommunityMember[]>;
|
|
97
110
|
export declare function fetchCommunityJoinRequests(identifier: string): Promise<CommunityJoinRequest[]>;
|
|
98
111
|
export declare function acceptCommunityJoinRequest(identifier: string, actorApId: string): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"communities.d.ts","sourceRoot":"","sources":["../../../src/lib/api/communities.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"communities.d.ts","sourceRoot":"","sources":["../../../src/lib/api/communities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAW5D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,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
|
|
|
1
|
-
import type { DMMessage } from "../../types/index.js";
|
|
1
|
+
import type { DMMessage, MediaAttachment } from "../../types/index.js";
|
|
2
2
|
export interface DMContact {
|
|
3
3
|
type: "user" | "community";
|
|
4
4
|
ap_id: string;
|
|
@@ -48,8 +48,14 @@ export declare function fetchUserDMMessages(userApId: string, options?: {
|
|
|
48
48
|
messages: DMMessage[];
|
|
49
49
|
conversation_id: string | null;
|
|
50
50
|
hasMore: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* The partner's last-read time (LOCAL-ONLY read receipt), or null when
|
|
53
|
+
* unknown — a remote partner never reports read state, so null must render
|
|
54
|
+
* as "no receipt", not "unread".
|
|
55
|
+
*/
|
|
56
|
+
partnerLastReadAt: string | null;
|
|
51
57
|
}>;
|
|
52
|
-
export declare function sendUserDMMessage(userApId: string, content: string): Promise<{
|
|
58
|
+
export declare function sendUserDMMessage(userApId: string, content: string, attachments?: MediaAttachment[]): Promise<{
|
|
53
59
|
message: DMMessage;
|
|
54
60
|
conversation_id: string;
|
|
55
61
|
}>;
|
package/dist/lib/api/dm.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dm.d.ts","sourceRoot":"","sources":["../../../src/lib/api/dm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"dm.d.ts","sourceRoot":"","sources":["../../../src/lib/api/dm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAKvE,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,QAAQ,EAAE,MAAM,GA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@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared gateway-URL acceptance table.
|
|
3
|
+
*
|
|
4
|
+
* Consumed by BOTH the browser-push validator (this package) and the server's
|
|
5
|
+
* notification pusher contract (backend), each in an equivalence test, so the
|
|
6
|
+
* two independent copies of the URL policy cannot silently diverge into a
|
|
7
|
+
* "client accepts / server rejects" mismatch.
|
|
8
|
+
*
|
|
9
|
+
* `valid` is whether the URL is an acceptable gateway. Bound-length-only cases
|
|
10
|
+
* are omitted because only the server enforces the 2048-char cap.
|
|
11
|
+
*/
|
|
12
|
+
export interface GatewayUrlCase {
|
|
13
|
+
readonly url: string;
|
|
14
|
+
readonly valid: boolean;
|
|
15
|
+
readonly note: string;
|
|
16
|
+
}
|
|
17
|
+
export declare const GATEWAY_URL_CASES: readonly GatewayUrlCase[];
|
|
18
|
+
//# sourceMappingURL=gateway-url-fixtures.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway-url-fixtures.d.ts","sourceRoot":"","sources":["../../../src/lib/api/gateway-url-fixtures.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,iBAAiB,EAAE,SAAS,cAAc,EAmDtD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/lib/api/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,KAAK,EACN,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/lib/api/normalize.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,KAAK,EACN,MAAM,sBAAsB,CAAC;AAG9B,KAAK,SAAS,GAAG;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAiBF,wBAAgB,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAkB/D;AAED,eAAO,MAAM,aAAa,GAAI,MAAM,IAAI,KAAG,IAGzC,CAAC;AAEH,eAAO,MAAM,cAAc,GAAI,OAAO,KAAK,KAAG,KAG5C,CAAC;AAEH,eAAO,MAAM,qBAAqB,GAAI,SAAS,YAAY,KAAG,YAI5D,CAAC;AAEH,eAAO,MAAM,kBAAkB,GAAI,MAAM,SAAS,KAAG,SAGnD,CAAC;AAEH,eAAO,MAAM,qBAAqB,GAChC,cAAc,YAAY,KACzB,YAaF,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Notification, NotificationTargetKind } from "../../types/index.js";
|
|
2
|
+
export interface NotificationTarget {
|
|
3
|
+
readonly target_kind: NotificationTargetKind;
|
|
4
|
+
readonly target_id: string | null;
|
|
5
|
+
/**
|
|
6
|
+
* Same-origin in-app path shaped for the yurucommu web client's routing.
|
|
7
|
+
* Other clients should prefer `target_kind` + `target_id` and build their own
|
|
8
|
+
* path. Never treat this as an external URL.
|
|
9
|
+
*/
|
|
10
|
+
readonly target_url: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Guard an in-app navigation path against open-redirect / protocol-relative /
|
|
14
|
+
* control-character abuse. Returns the value only if it is a plain same-origin
|
|
15
|
+
* absolute path (`/...`, not `//...`), else null. Promoted from the yurucommu
|
|
16
|
+
* and yurume web clients, which each carried an identical copy.
|
|
17
|
+
*/
|
|
18
|
+
export declare function safeNotificationPath(value: string | null | undefined): string | null;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the navigation target for a notification. Prefers the server-provided
|
|
21
|
+
* `target_*` fields (3.2.0+) after re-validating `target_url`; when a server
|
|
22
|
+
* older than 3.2.0 omitted them, synthesizes the same mapping the server uses
|
|
23
|
+
* from `type` + `object_ap_id`. Always returns a safe same-origin path.
|
|
24
|
+
*/
|
|
25
|
+
export declare function resolveNotificationTarget(notification: Notification): NotificationTarget;
|
|
26
|
+
//# sourceMappingURL=notification-target.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-target.d.ts","sourceRoot":"","sources":["../../../src/lib/api/notification-target.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,sBAAsB,EACvB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAC7C,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC7B;AAUD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAC/B,MAAM,GAAG,IAAI,CAWf;AASD;;;;;GAKG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,EAAE,YAAY,GACzB,kBAAkB,CA6CpB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Notification } from "../../types/index.js";
|
|
1
|
+
import type { Notification, NotificationPusherInput, NotificationPusherProduct, NotificationPusherRegistration } from "../../types/index.js";
|
|
2
2
|
export declare function fetchNotifications(options?: {
|
|
3
3
|
limit?: number;
|
|
4
4
|
type?: string;
|
|
@@ -14,4 +14,22 @@ export declare function markNotificationsRead(ids?: string[]): Promise<void>;
|
|
|
14
14
|
export declare function archiveNotifications(ids: string[]): Promise<void>;
|
|
15
15
|
export declare function unarchiveNotifications(ids: string[]): Promise<void>;
|
|
16
16
|
export declare function archiveAllNotifications(): Promise<number>;
|
|
17
|
+
export declare function registerNotificationPusher(input: {
|
|
18
|
+
product: NotificationPusherProduct;
|
|
19
|
+
scope?: string;
|
|
20
|
+
pusher: NotificationPusherInput;
|
|
21
|
+
}): Promise<NotificationPusherRegistration>;
|
|
22
|
+
export declare function unregisterNotificationPusher(input: {
|
|
23
|
+
product: NotificationPusherProduct;
|
|
24
|
+
scope?: string;
|
|
25
|
+
app_id: string;
|
|
26
|
+
pushkey: string;
|
|
27
|
+
}): Promise<void>;
|
|
28
|
+
export interface NotificationPusherPublicConfig {
|
|
29
|
+
readonly enabled: boolean;
|
|
30
|
+
readonly gateway_url: string | null;
|
|
31
|
+
readonly web_push_public_key: string | null;
|
|
32
|
+
}
|
|
33
|
+
/** Non-secret runtime configuration used by browser/PWA clients. */
|
|
34
|
+
export declare function fetchNotificationPusherPublicConfig(): Promise<NotificationPusherPublicConfig>;
|
|
17
35
|
//# sourceMappingURL=notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/lib/api/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"notifications.d.ts","sourceRoot":"","sources":["../../../src/lib/api/notifications.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,uBAAuB,EACvB,yBAAyB,EACzB,8BAA8B,EAC/B,MAAM,sBAAsB,CAAC;AAI9B,wBAAsB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,OAAO,CAAC;IACV,aAAa,EAAE,YAAY,EAAE,CAAC;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B,CAAC,CAmBD;AAED,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAIxD;AAED,wBAAsB,qBAAqB,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;AAED,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAGzE;AAED,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAK/D;AAED,wBAAsB,0BAA0B,CAAC,KAAK,EAAE;IACtD,OAAO,EAAE,yBAAyB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,uBAAuB,CAAC;CACjC,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAO1C;AAED,wBAAsB,4BAA4B,CAAC,KAAK,EAAE;IACxD,OAAO,EAAE,yBAAyB,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGhB;AAED,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7C;AAED,oEAAoE;AACpE,wBAAsB,mCAAmC,IAAI,OAAO,CAAC,8BAA8B,CAAC,CAenG"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { NotificationPusherProduct } from "../../types/index.js";
|
|
2
|
+
import { type BrowserNotificationPushConfig } from "./browser-push.js";
|
|
3
|
+
/**
|
|
4
|
+
* Stable identity of a browser/PWA push client. Everything here is a per-app
|
|
5
|
+
* constant; only the gateway URL, VAPID key, and server origin are resolved at
|
|
6
|
+
* runtime.
|
|
7
|
+
*/
|
|
8
|
+
export interface BrowserPushClientIdentity {
|
|
9
|
+
readonly product: NotificationPusherProduct;
|
|
10
|
+
readonly appId: string;
|
|
11
|
+
readonly appDisplayName: string;
|
|
12
|
+
/** Root-relative service worker script path (e.g. "/notification-push-sw.js"). */
|
|
13
|
+
readonly serviceWorkerPath: string;
|
|
14
|
+
readonly scope?: string;
|
|
15
|
+
readonly lang?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Non-secret runtime gateway values, from a fetch or build-time fallback. */
|
|
18
|
+
export interface BrowserPushRuntimeValues {
|
|
19
|
+
readonly gatewayUrl?: string | null;
|
|
20
|
+
readonly vapidPublicKey?: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface BrowserPushConfigResolverOptions {
|
|
23
|
+
readonly identity: BrowserPushClientIdentity;
|
|
24
|
+
/**
|
|
25
|
+
* Origin of the yurucommu-compatible API that owns the registration. Returns
|
|
26
|
+
* null when it cannot be determined (e.g. SSR, or an unconfigured shell), in
|
|
27
|
+
* which case config resolution yields null.
|
|
28
|
+
*/
|
|
29
|
+
readonly resolveServerOrigin: () => string | null;
|
|
30
|
+
/**
|
|
31
|
+
* Build-time fallback used only while a server rolls forward to 3.2.0; a
|
|
32
|
+
* responding runtime config always wins.
|
|
33
|
+
*/
|
|
34
|
+
readonly buildTimeValues?: () => BrowserPushRuntimeValues | null;
|
|
35
|
+
}
|
|
36
|
+
export interface BrowserPushConfigResolver {
|
|
37
|
+
/** Build config from build-time values only (no network). */
|
|
38
|
+
readonly buildTimeConfig: () => BrowserNotificationPushConfig | null;
|
|
39
|
+
/**
|
|
40
|
+
* Resolve config from the server's runtime pusher config, falling back to
|
|
41
|
+
* build-time values if the server is unreachable or has push disabled.
|
|
42
|
+
*/
|
|
43
|
+
readonly resolveConfig: () => Promise<BrowserNotificationPushConfig | null>;
|
|
44
|
+
/**
|
|
45
|
+
* Invalidate this device's endpoint before sign-out / account teardown,
|
|
46
|
+
* disabling via the resolved config when possible and always clearing the
|
|
47
|
+
* local subscription so a signed-out device is never woken.
|
|
48
|
+
*/
|
|
49
|
+
readonly clearBeforeSignOut: () => Promise<void>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Build a browser push config resolver for a single client identity. Promoted
|
|
53
|
+
* from the near-identical per-app resolvers in the yurucommu and yurume web
|
|
54
|
+
* clients so the fetch/fallback/clear flow lives in one place.
|
|
55
|
+
*/
|
|
56
|
+
export declare function createBrowserPushConfigResolver(options: BrowserPushConfigResolverOptions): BrowserPushConfigResolver;
|
|
57
|
+
//# sourceMappingURL=push-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-config.d.ts","sourceRoot":"","sources":["../../../src/lib/api/push-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAGL,KAAK,6BAA6B,EACnC,MAAM,mBAAmB,CAAC;AAG3B;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,OAAO,EAAE,yBAAyB,CAAC;IAC5C,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,kFAAkF;IAClF,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,8EAA8E;AAC9E,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAED,MAAM,WAAW,gCAAgC;IAC/C,QAAQ,CAAC,QAAQ,EAAE,yBAAyB,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,mBAAmB,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClD;;;OAGG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,wBAAwB,GAAG,IAAI,CAAC;CAClE;AAED,MAAM,WAAW,yBAAyB;IACxC,6DAA6D;IAC7D,QAAQ,CAAC,eAAe,EAAE,MAAM,6BAA6B,GAAG,IAAI,CAAC;IACrE;;;OAGG;IACH,QAAQ,CAAC,aAAa,EAAE,MAAM,OAAO,CAAC,6BAA6B,GAAG,IAAI,CAAC,CAAC;IAC5E;;;;OAIG;IACH,QAAQ,CAAC,kBAAkB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAClD;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,gCAAgC,GACxC,yBAAyB,CAgE3B"}
|
package/dist/lib/api.d.ts
CHANGED
|
@@ -7,6 +7,9 @@ export * from "./api/posts.js";
|
|
|
7
7
|
export * from "./api/communities.js";
|
|
8
8
|
export * from "./api/dm.js";
|
|
9
9
|
export * from "./api/notifications.js";
|
|
10
|
+
export * from "./api/notification-target.js";
|
|
11
|
+
export * from "./api/browser-push.js";
|
|
12
|
+
export * from "./api/push-config.js";
|
|
10
13
|
export * from "./api/search.js";
|
|
11
14
|
export * from "./api/media.js";
|
|
12
15
|
export * from "./api/stories.js";
|
package/dist/lib/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,uBAAuB,CAAC;AACtC,cAAc,sBAAsB,CAAC;AACrC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC"}
|
package/dist/social-server.d.ts
CHANGED
|
@@ -14,6 +14,11 @@ export interface SocialServerDiscovery {
|
|
|
14
14
|
readonly defaultEntry: "feed" | "messages";
|
|
15
15
|
}[];
|
|
16
16
|
readonly issuer: string;
|
|
17
|
+
readonly oidcClientId?: string;
|
|
18
|
+
readonly auth?: {
|
|
19
|
+
readonly oidc: boolean;
|
|
20
|
+
readonly password: boolean;
|
|
21
|
+
};
|
|
17
22
|
readonly apiBaseUrl: string;
|
|
18
23
|
readonly activitypubOrigin: string;
|
|
19
24
|
readonly mediaOrigin: string;
|
|
@@ -22,10 +27,14 @@ export interface SocialServerDiscovery {
|
|
|
22
27
|
readonly endpoints: {
|
|
23
28
|
readonly api: string;
|
|
24
29
|
readonly authProviders: string;
|
|
30
|
+
readonly mobilePasswordLogin: string;
|
|
31
|
+
readonly mobileOidcExchange: string;
|
|
25
32
|
readonly currentUser: string;
|
|
26
33
|
readonly timeline: string;
|
|
27
34
|
readonly conversations: string;
|
|
28
35
|
readonly notifications: string;
|
|
36
|
+
readonly notificationPushers: string;
|
|
37
|
+
/** @deprecated Use notificationPushers. */
|
|
29
38
|
readonly mobilePushRegistrations: string;
|
|
30
39
|
};
|
|
31
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-server.d.ts","sourceRoot":"","sources":["../src/social-server.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAE9C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,EAAE,EAAE,kBAAkB,CAAC;QAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;QACjC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;KACpC,CAAC;IACF,QAAQ,CAAC,OAAO,EAAE,SAAS;QACzB,QAAQ,CAAC,EAAE,EAAE,WAAW,GAAG,QAAQ,CAAC;QACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,UAAU,CAAC;KAC5C,EAAE,CAAC;IACJ,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,WAAW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interface DMMessage {
|
|
|
81
81
|
id: string;
|
|
82
82
|
sender: DMSender;
|
|
83
83
|
content: string;
|
|
84
|
+
/** Media attachments (image/video), same shape as post attachments. */
|
|
85
|
+
attachments?: MediaAttachment[];
|
|
84
86
|
created_at: string;
|
|
85
87
|
}
|
|
86
88
|
export interface NotificationActor {
|
|
@@ -95,9 +97,50 @@ export interface Notification {
|
|
|
95
97
|
type: "follow" | "follow_request" | "like" | "announce" | "reply" | "mention";
|
|
96
98
|
actor: NotificationActor;
|
|
97
99
|
object_ap_id: string | null;
|
|
100
|
+
/**
|
|
101
|
+
* Navigation target for the notification. OPTIONAL: a server older than
|
|
102
|
+
* 3.2.0 omits these fields, and `normalizeNotification` then synthesizes them
|
|
103
|
+
* from `object_ap_id`. Prefer `target_kind` + `target_id` and build your own
|
|
104
|
+
* in-app path; `target_url` is shaped for the yurucommu web client's routing
|
|
105
|
+
* and is same-origin only — never treat it as an external URL.
|
|
106
|
+
*/
|
|
107
|
+
target_kind?: NotificationTargetKind;
|
|
108
|
+
target_id?: string | null;
|
|
109
|
+
target_url?: string;
|
|
98
110
|
read: boolean;
|
|
99
111
|
created_at: string;
|
|
100
112
|
}
|
|
113
|
+
export type NotificationTargetKind = "post" | "story" | "profile" | "notifications";
|
|
114
|
+
export type NotificationPusherProduct = "yurucommu" | "yurume";
|
|
115
|
+
export interface NotificationPusherInput {
|
|
116
|
+
kind: "http";
|
|
117
|
+
app_id: string;
|
|
118
|
+
pushkey: string;
|
|
119
|
+
app_display_name?: string;
|
|
120
|
+
device_display_name?: string;
|
|
121
|
+
profile_tag?: string;
|
|
122
|
+
lang?: string;
|
|
123
|
+
data: {
|
|
124
|
+
url: string;
|
|
125
|
+
format?: "event_id_only" | "full";
|
|
126
|
+
[key: string]: unknown;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface NotificationPusherRegistration {
|
|
130
|
+
id: string;
|
|
131
|
+
kind: "http";
|
|
132
|
+
app_id: string;
|
|
133
|
+
app_display_name?: string;
|
|
134
|
+
device_display_name?: string;
|
|
135
|
+
profile_tag?: string;
|
|
136
|
+
lang?: string;
|
|
137
|
+
data: Record<string, unknown>;
|
|
138
|
+
gateway_url: string;
|
|
139
|
+
product: NotificationPusherProduct;
|
|
140
|
+
scope: string | null;
|
|
141
|
+
registered_at: string;
|
|
142
|
+
last_seen_at: string;
|
|
143
|
+
}
|
|
101
144
|
export interface StoryAttachment {
|
|
102
145
|
type: string;
|
|
103
146
|
mediaType: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,GAAG,QAAQ,CAAC;IACxC,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IAGzB,MAAM,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAI3C,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,aAAa,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAGD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM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