working on showing single posts for users we dont know about
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
user_data_dir="${1:-./profile}"
|
user_data_dir="${1:-./profile}"
|
||||||
user_id="${2:-b38b623c-c3fa-4351-9cab-50233c99fa4e}"
|
user_id="${2:-b38b623c-c3fa-4351-9cab-50233c99fa4e}"
|
||||||
chromium-browser \
|
chromium \
|
||||||
--disable-setuid-sandbox \
|
--disable-setuid-sandbox \
|
||||||
--disable-infobars \
|
--disable-infobars \
|
||||||
--no-first-run \
|
--no-first-run \
|
||||||
|
|||||||
@@ -361,7 +361,8 @@ async function main() {
|
|||||||
messageDispatch.set('peer_message', peerMessageHandler);
|
messageDispatch.set('peer_message', peerMessageHandler);
|
||||||
|
|
||||||
Deno.serve({
|
Deno.serve({
|
||||||
port: 6789,
|
hostname: "[::]",
|
||||||
|
port: 443,
|
||||||
cert: Deno.readTextFileSync("/etc/letsencrypt/live/ddln.app/fullchain.pem"),
|
cert: Deno.readTextFileSync("/etc/letsencrypt/live/ddln.app/fullchain.pem"),
|
||||||
key: Deno.readTextFileSync("/etc/letsencrypt/live/ddln.app/privkey.pem"),
|
key: Deno.readTextFileSync("/etc/letsencrypt/live/ddln.app/privkey.pem"),
|
||||||
}, handler);
|
}, handler);
|
||||||
|
|||||||
26
package-lock.json
generated
26
package-lock.json
generated
@@ -1,26 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "dandelion",
|
|
||||||
"lockfileVersion": 3,
|
|
||||||
"requires": true,
|
|
||||||
"packages": {
|
|
||||||
"": {
|
|
||||||
"devDependencies": {
|
|
||||||
"typescript": "^5.5.4"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/typescript": {
|
|
||||||
"version": "5.8.3",
|
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz",
|
|
||||||
"integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==",
|
|
||||||
"dev": true,
|
|
||||||
"license": "Apache-2.0",
|
|
||||||
"bin": {
|
|
||||||
"tsc": "bin/tsc",
|
|
||||||
"tsserver": "bin/tsserver"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14.17"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"typescript": "^5.5.4"
|
"typescript": "5.8.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
45
src/App.ts
45
src/App.ts
@@ -1,7 +1,7 @@
|
|||||||
import { generateID } from "IDUtils";
|
import { generateID } from "IDUtils";
|
||||||
import { PeerManager, PeerEventTypes } from "PeerManager";
|
import { PeerManager, PeerEventTypes } from "PeerManager";
|
||||||
import { Sync } from "Sync";
|
import { Sync } from "Sync";
|
||||||
import { openDatabase, getData, addData, addDataArray, clearData, deleteData, mergeDataArray, getAllData, checkPostIds, getAllIds, getPostsByIds } from "db";
|
import { openDatabase, getData, addData, addDataArray, clearData, deleteData, mergeDataArray, getAllData, checkPostIds, getAllIds, getPostsByIds, getPostForUser } from "db";
|
||||||
import { arrayBufferToBase64, compressString } from "dataUtils";
|
import { arrayBufferToBase64, compressString } from "dataUtils";
|
||||||
import { log, logID, renderLog, setLogVisibility } from "log"
|
import { log, logID, renderLog, setLogVisibility } from "log"
|
||||||
|
|
||||||
@@ -189,7 +189,7 @@ export class App {
|
|||||||
let neededPostCount = neededPostIDs.length;
|
let neededPostCount = neededPostIDs.length;
|
||||||
this.statusBar.updatePeerStatus(peerID, `need(${logID(userID)} | ${neededPostCount})`, { havePostCount: 0, neededPostCount: neededPostCount });
|
this.statusBar.updatePeerStatus(peerID, `need(${logID(userID)} | ${neededPostCount})`, { havePostCount: 0, neededPostCount: neededPostCount });
|
||||||
|
|
||||||
let neededPosts = await this.peerManager?.rpc.getPostsForUser(peerID, this.peerID, userID, neededPostIDs);
|
await this.peerManager?.rpc.getPostsForUser(peerID, this.peerID, userID, neededPostIDs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log.apply(null, log(`[app] Don't need any posts for user ${logID(userID)} from peer ${logID(peerID)}`));
|
console.log.apply(null, log(`[app] Don't need any posts for user ${logID(userID)} from peer ${logID(peerID)}`));
|
||||||
@@ -236,7 +236,7 @@ export class App {
|
|||||||
for (let userID of userIDs) {
|
for (let userID of userIDs) {
|
||||||
// console.log.apply(null, log(`[app] announceUsers, got user:${userID} from peer ${sendingPeerID}`));
|
// console.log.apply(null, log(`[app] announceUsers, got user:${userID} from peer ${sendingPeerID}`));
|
||||||
this.sync.addUserPeer(userID, sendingPeerID);
|
this.sync.addUserPeer(userID, sendingPeerID);
|
||||||
if (!(this.sync.shouldSyncUserID(userID) || (this.router.route === App.Route.USER && userID === this.router.userID))) {
|
if (!(this.sync.shouldSyncUserID(userID) || (this.router.route & (App.Route.USER | App.Route.POST) && userID === this.router.userID))) {
|
||||||
console.log.apply(null, log(`[app] announceUser_rpc_response skipping user[${logID(userID)}] from[${logID(sendingPeerID)}]`));
|
console.log.apply(null, log(`[app] announceUser_rpc_response skipping user[${logID(userID)}] from[${logID(sendingPeerID)}]`));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,17 @@ export class App {
|
|||||||
console.log.apply(null, log(`[app] calling getPostIDsForUser for user [${logID(userID)}] on peer [${logID(sendingPeerID)}]`));
|
console.log.apply(null, log(`[app] calling getPostIDsForUser for user [${logID(userID)}] on peer [${logID(sendingPeerID)}]`));
|
||||||
this.statusBar.updatePeerStatus(sendingPeerID, `getPostIDs(${logID(userID)})⬆️`);
|
this.statusBar.updatePeerStatus(sendingPeerID, `getPostIDs(${logID(userID)})⬆️`);
|
||||||
|
|
||||||
let postIDs = await this.peerManager?.rpc.getPostIDsForUser(sendingPeerID, userID);
|
|
||||||
|
let postIDs = null;
|
||||||
|
if (this.router.route === App.Route.POST && this.router.userID == userID) {
|
||||||
|
postIDs = [this.router.postID];
|
||||||
|
} else {
|
||||||
|
postIDs = await this.peerManager?.rpc.getPostIDsForUser(sendingPeerID, userID);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!postIDs) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
this.statusBar.updatePeerStatus(sendingPeerID, `syncing(${logID(userID)} ${postIDs.length})`);
|
this.statusBar.updatePeerStatus(sendingPeerID, `syncing(${logID(userID)} ${postIDs.length})`);
|
||||||
|
|
||||||
@@ -306,6 +316,8 @@ export class App {
|
|||||||
if (postIDs) {
|
if (postIDs) {
|
||||||
return postIDs;
|
return postIDs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
});
|
});
|
||||||
|
|
||||||
this.peerManager.registerRPC('getPostsForUser', async (requestingPeerID: string, userID: string, postIDs: string[]) => {
|
this.peerManager.registerRPC('getPostsForUser', async (requestingPeerID: string, userID: string, postIDs: string[]) => {
|
||||||
@@ -1078,17 +1090,20 @@ export class App {
|
|||||||
this.timerStart();
|
this.timerStart();
|
||||||
let posts: StoragePost[] = [];
|
let posts: StoragePost[] = [];
|
||||||
|
|
||||||
// if (postID) {
|
if (postID) {
|
||||||
// posts = await gePostForUser(userID, postID);
|
posts = await getPostForUser(userID, postID);
|
||||||
// }
|
} else {
|
||||||
|
posts = await getData(userID, new Date(2022, 8), new Date());
|
||||||
|
}
|
||||||
|
|
||||||
posts = await getData(userID, new Date(2022, 8), new Date());
|
|
||||||
|
|
||||||
if (posts.length > 0) {
|
if (posts?.length) {
|
||||||
console.log.apply(null, log(`Loaded ${posts.length} posts in ${this.timerDelta().toFixed(2)}ms`));;
|
console.log.apply(null, log(`Loaded ${posts.length} posts in ${this.timerDelta().toFixed(2)}ms`));;
|
||||||
return posts;
|
return posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log.apply(null, log(`No posts found for userID:${userID}, postID:${postID}`));;
|
||||||
|
|
||||||
// posts = await createTestData2(userID);
|
// posts = await createTestData2(userID);
|
||||||
|
|
||||||
// log("Adding test data...");
|
// log("Adding test data...");
|
||||||
@@ -1602,11 +1617,11 @@ export class App {
|
|||||||
|
|
||||||
export namespace App {
|
export namespace App {
|
||||||
export enum Route {
|
export enum Route {
|
||||||
USER,
|
USER = 1,
|
||||||
POST,
|
POST = 2,
|
||||||
MEDIA,
|
MEDIA = 4,
|
||||||
GROUP,
|
GROUP = 8,
|
||||||
HOME,
|
HOME = 16,
|
||||||
CONNECT,
|
CONNECT = 32,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -538,7 +538,7 @@ class PeerConnection {
|
|||||||
private chunkSize = (16 * 1024) - 100;
|
private chunkSize = (16 * 1024) - 100;
|
||||||
messageSuperlog: boolean = false;
|
messageSuperlog: boolean = false;
|
||||||
sendQueueSuperLog: boolean = false;
|
sendQueueSuperLog: boolean = false;
|
||||||
rpcSuperlog: boolean = false;
|
rpcSuperlog: boolean = true;
|
||||||
pendingRPCs: Map<
|
pendingRPCs: Map<
|
||||||
string,
|
string,
|
||||||
{ resolve: Function; reject: Function; functionName: string }
|
{ resolve: Function; reject: Function; functionName: string }
|
||||||
@@ -556,9 +556,9 @@ class PeerConnection {
|
|||||||
// { urls: "turn:ddln.app", username: "a", credential: "b" },
|
// { urls: "turn:ddln.app", username: "a", credential: "b" },
|
||||||
{ urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6
|
{ urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6
|
||||||
{ urls: "stun:stun1.l.google.com" },
|
{ urls: "stun:stun1.l.google.com" },
|
||||||
{ urls: "stun:stun2.l.google.com" },
|
//{ urls: "stun:stun2.l.google.com" },
|
||||||
{ urls: "stun:stun3.l.google.com" },
|
//{ urls: "stun:stun3.l.google.com" },
|
||||||
{ urls: "stun:stun4.l.google.com" },
|
//{ urls: "stun:stun4.l.google.com" },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
// longMessageQueue: string[] = [];
|
// longMessageQueue: string[] = [];
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export async function compressString(input: string) {
|
|||||||
const compressedArray = await new Response(compressionStream.readable).arrayBuffer();
|
const compressedArray = await new Response(compressionStream.readable).arrayBuffer();
|
||||||
|
|
||||||
// Convert the compressed data to a Uint8Array
|
// Convert the compressed data to a Uint8Array
|
||||||
return new Uint8Array(compressedArray);
|
return compressedArray;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base58 character set
|
// Base58 character set
|
||||||
|
|||||||
14
src/db.ts
14
src/db.ts
@@ -342,7 +342,21 @@ export async function mergeDataArray(userID: string, array: any[]): Promise<void
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getPostForUser(userID: string, postID: string): Promise<any | undefined> {
|
export async function getPostForUser(userID: string, postID: string): Promise<any | undefined> {
|
||||||
|
const { store } = await getDBTransactionStore(userID);
|
||||||
|
const index = store.index("postIDIndex");
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const getPostRequest = index.get(postID);
|
||||||
|
|
||||||
|
getPostRequest.onsuccess = () => {
|
||||||
|
resolve(getPostRequest.result);
|
||||||
|
};
|
||||||
|
|
||||||
|
getPostRequest.onerror = () => {
|
||||||
|
console.error('Transaction failed:', getPostRequest.error?.message);
|
||||||
|
reject(getPostRequest.error);
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { generateID } from "IDUtils";
|
import { generateID } from "IDUtils";
|
||||||
import { PeerManager, PeerEventTypes } from "PeerManager";
|
import { PeerManager, PeerEventTypes } from "PeerManager";
|
||||||
import { Sync } from "Sync";
|
import { Sync } from "Sync";
|
||||||
import { openDatabase, getData, addData, deleteData, getAllData } from "db";
|
import { openDatabase, getData, addData, deleteData, getAllData, getPostForUser } from "db";
|
||||||
import { arrayBufferToBase64, compressString } from "dataUtils";
|
import { arrayBufferToBase64, compressString } from "dataUtils";
|
||||||
import { log, logID, renderLog, setLogVisibility } from "log";
|
import { log, logID, renderLog, setLogVisibility } from "log";
|
||||||
class Post {
|
class Post {
|
||||||
@@ -139,7 +139,7 @@ export class App {
|
|||||||
console.log.apply(null, log(`[app] Need (${neededPostIDs.length}) posts for user ${logID(userID)} from peer ${logID(peerID)}`));
|
console.log.apply(null, log(`[app] Need (${neededPostIDs.length}) posts for user ${logID(userID)} from peer ${logID(peerID)}`));
|
||||||
let neededPostCount = neededPostIDs.length;
|
let neededPostCount = neededPostIDs.length;
|
||||||
this.statusBar.updatePeerStatus(peerID, `need(${logID(userID)} | ${neededPostCount})`, { havePostCount: 0, neededPostCount: neededPostCount });
|
this.statusBar.updatePeerStatus(peerID, `need(${logID(userID)} | ${neededPostCount})`, { havePostCount: 0, neededPostCount: neededPostCount });
|
||||||
let neededPosts = await this.peerManager?.rpc.getPostsForUser(peerID, this.peerID, userID, neededPostIDs);
|
await this.peerManager?.rpc.getPostsForUser(peerID, this.peerID, userID, neededPostIDs);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log.apply(null, log(`[app] Don't need any posts for user ${logID(userID)} from peer ${logID(peerID)}`));
|
console.log.apply(null, log(`[app] Don't need any posts for user ${logID(userID)} from peer ${logID(peerID)}`));
|
||||||
@@ -172,13 +172,22 @@ export class App {
|
|||||||
for (let userID of userIDs) {
|
for (let userID of userIDs) {
|
||||||
// console.log.apply(null, log(`[app] announceUsers, got user:${userID} from peer ${sendingPeerID}`));
|
// console.log.apply(null, log(`[app] announceUsers, got user:${userID} from peer ${sendingPeerID}`));
|
||||||
this.sync.addUserPeer(userID, sendingPeerID);
|
this.sync.addUserPeer(userID, sendingPeerID);
|
||||||
if (!(this.sync.shouldSyncUserID(userID) || (this.router.route === App.Route.USER && userID === this.router.userID))) {
|
if (!(this.sync.shouldSyncUserID(userID) || (this.router.route & (App.Route.USER | App.Route.POST) && userID === this.router.userID))) {
|
||||||
console.log.apply(null, log(`[app] announceUser_rpc_response skipping user[${logID(userID)}] from[${logID(sendingPeerID)}]`));
|
console.log.apply(null, log(`[app] announceUser_rpc_response skipping user[${logID(userID)}] from[${logID(sendingPeerID)}]`));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
console.log.apply(null, log(`[app] calling getPostIDsForUser for user [${logID(userID)}] on peer [${logID(sendingPeerID)}]`));
|
console.log.apply(null, log(`[app] calling getPostIDsForUser for user [${logID(userID)}] on peer [${logID(sendingPeerID)}]`));
|
||||||
this.statusBar.updatePeerStatus(sendingPeerID, `getPostIDs(${logID(userID)})⬆️`);
|
this.statusBar.updatePeerStatus(sendingPeerID, `getPostIDs(${logID(userID)})⬆️`);
|
||||||
let postIDs = await this.peerManager?.rpc.getPostIDsForUser(sendingPeerID, userID);
|
let postIDs = null;
|
||||||
|
if (this.router.route === App.Route.POST && this.router.userID == userID) {
|
||||||
|
postIDs = [this.router.postID];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
postIDs = await this.peerManager?.rpc.getPostIDsForUser(sendingPeerID, userID);
|
||||||
|
}
|
||||||
|
if (!postIDs) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
this.statusBar.updatePeerStatus(sendingPeerID, `syncing(${logID(userID)} ${postIDs.length})`);
|
this.statusBar.updatePeerStatus(sendingPeerID, `syncing(${logID(userID)} ${postIDs.length})`);
|
||||||
console.log.apply(null, log(`[app] Got (${postIDs.length}) post IDs for user [${logID(userID)}] from peer [${logID(sendingPeerID)}]`));
|
console.log.apply(null, log(`[app] Got (${postIDs.length}) post IDs for user [${logID(userID)}] from peer [${logID(sendingPeerID)}]`));
|
||||||
this.addPostIDsToSyncQueue(userID, sendingPeerID, postIDs);
|
this.addPostIDsToSyncQueue(userID, sendingPeerID, postIDs);
|
||||||
@@ -223,6 +232,7 @@ export class App {
|
|||||||
if (postIDs) {
|
if (postIDs) {
|
||||||
return postIDs;
|
return postIDs;
|
||||||
}
|
}
|
||||||
|
return [];
|
||||||
});
|
});
|
||||||
this.peerManager.registerRPC('getPostsForUser', async (requestingPeerID, userID, postIDs) => {
|
this.peerManager.registerRPC('getPostsForUser', async (requestingPeerID, userID, postIDs) => {
|
||||||
let posts = await this.sync.getPostsForUser(userID, postIDs);
|
let posts = await this.sync.getPostsForUser(userID, postIDs);
|
||||||
@@ -798,15 +808,19 @@ export class App {
|
|||||||
async loadPostsFromStorage(userID, postID) {
|
async loadPostsFromStorage(userID, postID) {
|
||||||
this.timerStart();
|
this.timerStart();
|
||||||
let posts = [];
|
let posts = [];
|
||||||
// if (postID) {
|
if (postID) {
|
||||||
// posts = await gePostForUser(userID, postID);
|
posts = await getPostForUser(userID, postID);
|
||||||
// }
|
}
|
||||||
posts = await getData(userID, new Date(2022, 8), new Date());
|
else {
|
||||||
if (posts.length > 0) {
|
posts = await getData(userID, new Date(2022, 8), new Date());
|
||||||
|
}
|
||||||
|
if (posts?.length) {
|
||||||
console.log.apply(null, log(`Loaded ${posts.length} posts in ${this.timerDelta().toFixed(2)}ms`));
|
console.log.apply(null, log(`Loaded ${posts.length} posts in ${this.timerDelta().toFixed(2)}ms`));
|
||||||
;
|
;
|
||||||
return posts;
|
return posts;
|
||||||
}
|
}
|
||||||
|
console.log.apply(null, log(`No posts found for userID:${userID}, postID:${postID}`));
|
||||||
|
;
|
||||||
// posts = await createTestData2(userID);
|
// posts = await createTestData2(userID);
|
||||||
// log("Adding test data...");
|
// log("Adding test data...");
|
||||||
// addDataArray(userID, posts);
|
// addDataArray(userID, posts);
|
||||||
@@ -1174,12 +1188,12 @@ export class App {
|
|||||||
(function (App) {
|
(function (App) {
|
||||||
let Route;
|
let Route;
|
||||||
(function (Route) {
|
(function (Route) {
|
||||||
Route[Route["USER"] = 0] = "USER";
|
Route[Route["USER"] = 1] = "USER";
|
||||||
Route[Route["POST"] = 1] = "POST";
|
Route[Route["POST"] = 2] = "POST";
|
||||||
Route[Route["MEDIA"] = 2] = "MEDIA";
|
Route[Route["MEDIA"] = 4] = "MEDIA";
|
||||||
Route[Route["GROUP"] = 3] = "GROUP";
|
Route[Route["GROUP"] = 8] = "GROUP";
|
||||||
Route[Route["HOME"] = 4] = "HOME";
|
Route[Route["HOME"] = 16] = "HOME";
|
||||||
Route[Route["CONNECT"] = 5] = "CONNECT";
|
Route[Route["CONNECT"] = 32] = "CONNECT";
|
||||||
})(Route = App.Route || (App.Route = {}));
|
})(Route = App.Route || (App.Route = {}));
|
||||||
})(App || (App = {}));
|
})(App || (App = {}));
|
||||||
;
|
;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -399,7 +399,7 @@ class PeerConnection {
|
|||||||
this.chunkSize = (16 * 1024) - 100;
|
this.chunkSize = (16 * 1024) - 100;
|
||||||
this.messageSuperlog = false;
|
this.messageSuperlog = false;
|
||||||
this.sendQueueSuperLog = false;
|
this.sendQueueSuperLog = false;
|
||||||
this.rpcSuperlog = false;
|
this.rpcSuperlog = true;
|
||||||
this.pendingRPCs = new Map();
|
this.pendingRPCs = new Map();
|
||||||
this.connectionPromise = null;
|
this.connectionPromise = null;
|
||||||
// private makingOffer:boolean = false;
|
// private makingOffer:boolean = false;
|
||||||
@@ -730,9 +730,9 @@ PeerConnection.config = {
|
|||||||
// { urls: "turn:ddln.app", username: "a", credential: "b" },
|
// { urls: "turn:ddln.app", username: "a", credential: "b" },
|
||||||
{ urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6
|
{ urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6
|
||||||
{ urls: "stun:stun1.l.google.com" },
|
{ urls: "stun:stun1.l.google.com" },
|
||||||
{ urls: "stun:stun2.l.google.com" },
|
//{ urls: "stun:stun2.l.google.com" },
|
||||||
{ urls: "stun:stun3.l.google.com" },
|
//{ urls: "stun:stun3.l.google.com" },
|
||||||
{ urls: "stun:stun4.l.google.com" },
|
//{ urls: "stun:stun4.l.google.com" },
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
//# sourceMappingURL=PeerManager.js.map
|
//# sourceMappingURL=PeerManager.js.map
|
||||||
File diff suppressed because one or more lines are too long
@@ -34,5 +34,28 @@
|
|||||||
"protocol": "web+ddln",
|
"protocol": "web+ddln",
|
||||||
"url": "/%s"
|
"url": "/%s"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"share_target": {
|
||||||
|
"action": "/share-target",
|
||||||
|
"method": "POST",
|
||||||
|
"enctype": "multipart/form-data",
|
||||||
|
"params": {
|
||||||
|
"title": "name",
|
||||||
|
"text": "text",
|
||||||
|
"url": "link",
|
||||||
|
"files": [
|
||||||
|
{
|
||||||
|
"name": "photos",
|
||||||
|
"accept": [
|
||||||
|
"image/svg+xml",
|
||||||
|
".svg",
|
||||||
|
".jpg",
|
||||||
|
".jpeg",
|
||||||
|
".png",
|
||||||
|
".gif"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -29,7 +29,7 @@ export async function compressString(input) {
|
|||||||
// Read the compressed data from the stream
|
// Read the compressed data from the stream
|
||||||
const compressedArray = await new Response(compressionStream.readable).arrayBuffer();
|
const compressedArray = await new Response(compressionStream.readable).arrayBuffer();
|
||||||
// Convert the compressed data to a Uint8Array
|
// Convert the compressed data to a Uint8Array
|
||||||
return new Uint8Array(compressedArray);
|
return compressedArray;
|
||||||
}
|
}
|
||||||
// Base58 character set
|
// Base58 character set
|
||||||
// const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
// const BASE58_ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"version":3,"file":"dataUtils.js","sourceRoot":"","sources":["../src/dataUtils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAAiB,EAAE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AQ;AACR,MAAM;AAEN,qBAAqB;AACrB,4CAA4C;AAC5C,wCAAwC;AACxC,MAAM;AAEN,iCAAiC;AACjC,iCAAiC;AACjC,2BAA2B;AAC3B,8CAA8C;AAC9C,eAAe;AACf,eAAe;AACf,QAAQ;AACR,MAAM;AAEN,mBAAmB;AACnB,IAAI;AAEJ,4BAA4B;AAC5B,gDAAgD;AAChD,qCAAqC;AACrC,gCAAgC;AAChC,IAAI"}
|
||||||
12
static/db.js
12
static/db.js
@@ -260,6 +260,18 @@ export async function mergeDataArray(userID, array) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
export async function getPostForUser(userID, postID) {
|
export async function getPostForUser(userID, postID) {
|
||||||
|
const { store } = await getDBTransactionStore(userID);
|
||||||
|
const index = store.index("postIDIndex");
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const getPostRequest = index.get(postID);
|
||||||
|
getPostRequest.onsuccess = () => {
|
||||||
|
resolve(getPostRequest.result);
|
||||||
|
};
|
||||||
|
getPostRequest.onerror = () => {
|
||||||
|
console.error('Transaction failed:', getPostRequest.error?.message);
|
||||||
|
reject(getPostRequest.error);
|
||||||
|
};
|
||||||
|
});
|
||||||
}
|
}
|
||||||
export async function getData(userID, lowerID, upperID) {
|
export async function getData(userID, lowerID, upperID) {
|
||||||
const { store } = await getDBTransactionStore(userID);
|
const { store } = await getDBTransactionStore(userID);
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user