Fix integration upload issues

This commit is contained in:
yflory 2025-05-21 15:55:15 +02:00
parent de46da0e7a
commit 8bf37704d5
3 changed files with 15 additions and 2 deletions

View File

@ -487,7 +487,7 @@ const factory = (Sortify, UserObject, ProxyManager,
var initTempRpc = (clientId, cb) => {
if (store.rpc) { return void cb(store.rpc); }
var kp = Crypto.Nacl.sign.keyPair();
var keys = {
var keys = store.tempKeys = {
edPublic: Util.encodeBase64(kp.publicKey),
edPrivate: Util.encodeBase64(kp.secretKey)
};
@ -3228,6 +3228,10 @@ const factory = (Sortify, UserObject, ProxyManager,
if (obj?.error) {
Feedback.send("NO_DRIVE_ERROR", true);
}
if (!!data.neverDrive) {
// Send temp RPC keys to the browser to allow upload
obj.tempKeys = store?.tempKeys;
}
cb(obj);
}, !!data.neverDrive);
}

View File

@ -48,6 +48,8 @@ define([
}
};
const Env = {};
// Upgrade and donate URLs duplicated in pages.js
var origin = encodeURIComponent(window.location.hostname);
var common = window.Cryptpad = {
@ -79,6 +81,12 @@ define([
common.getAccessKeys = function (cb) {
var keys = [];
nThen(function (waitFor) {
// Not logged in? check for temp RPC keys
if (!LocalStore.isLoggedIn() && Env?.returned?.tempKeys) {
keys.push(Env.returned.tempKeys);
return;
}
// Push account keys
postMessage("GET", {
key: ['edPrivate'],
@ -2736,6 +2744,7 @@ define([
console.log('Posting CONNECT');
postMessage('CONNECT', cfg, function (data) {
Env.returned = data;
// FIXME data should always exist
// this indicates a false condition in sharedWorker
// got here via a reference error:

File diff suppressed because one or more lines are too long