diff --git a/snowpack.config.js b/snowpack.config.js index 763374a3..68f33242 100644 --- a/snowpack.config.js +++ b/snowpack.config.js @@ -5,7 +5,8 @@ module.exports = { mount: { // More specific paths before less specific paths (if they overlap) - "src": "/", + "src/platform/web/docroot": "/", + "src": "/src", "lib": {url: "/lib", static: true }, "assets": "/assets", /* ... */ diff --git a/src/matrix/SessionContainer.js b/src/matrix/SessionContainer.js index d8977dde..fd523ac7 100644 --- a/src/matrix/SessionContainer.js +++ b/src/matrix/SessionContainer.js @@ -24,7 +24,8 @@ import {Reconnector, ConnectionStatus} from "./net/Reconnector.js"; import {ExponentialRetryDelay} from "./net/ExponentialRetryDelay.js"; import {MediaRepository} from "./net/MediaRepository.js"; import {RequestScheduler} from "./net/RequestScheduler.js"; -import {Sync, SyncStatus} from "./Sync.js"; +// import {Sync, SyncStatus} from "./Sync.js"; +import {Sync3, SyncStatus} from "./Sync3"; import {Session} from "./Session.js"; import {PasswordLoginMethod} from "./login/PasswordLoginMethod.js"; import {TokenLoginMethod} from "./login/TokenLoginMethod.js"; @@ -254,7 +255,12 @@ export class SessionContainer { await log.wrap("createIdentity", log => this._session.createIdentity(log)); } - this._sync = new Sync({hsApi: this._requestScheduler.hsApi, storage: this._storage, session: this._session, logger: this._platform.logger}); + this._sync = new Sync3( + this._requestScheduler.hsApi, + this._session, + this._storage, + this._platform.logger, + ); // notify sync and session when back online this._reconnectSubscription = this._reconnector.connectionStatus.subscribe(state => { if (state === ConnectionStatus.Online) { diff --git a/src/matrix/Sync3.ts b/src/matrix/Sync3.ts index 49863db7..4ebea551 100644 --- a/src/matrix/Sync3.ts +++ b/src/matrix/Sync3.ts @@ -236,7 +236,7 @@ export class Sync3 { backoffCounter = 5; } const secs = Math.pow(2, backoffCounter); - console.log(`v3 /sync failed, backing off for ${secs}s`) + console.log(`v3 /sync failed, backing off for ${secs}s, err=`, err); await sleep(secs * 1000); } } diff --git a/src/matrix/net/HomeServerApi.js b/src/matrix/net/HomeServerApi.js index 91ffc97c..a6d2aa14 100644 --- a/src/matrix/net/HomeServerApi.js +++ b/src/matrix/net/HomeServerApi.js @@ -111,7 +111,9 @@ export class HomeServerApi { } sync3(body, pos, timeout, options = null) { - return this._authedRequest("POST", this._url("/sync", "/_matrix/client/v3"), {timeout, pos}, body, options); + // FIXME TODO + const syncURL = "http://localhost:8008/_matrix/client/v3/sync"; + return this._authedRequest("POST", syncURL, {timeout, pos}, body, options); } // params is from, dir and optionally to, limit, filter.