mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
0c5f7cf0a7
Summary: * Adds a `SELF_HYPERLINK()` python function, with optional keyword arguments to set a label, the page, and link parameters. * Adds a `UUID()` python function, since using python's uuid.uuidv4 hits a problem accessing /dev/urandom in the sandbox. UUID makes no particular quality claims since it doesn't use an audited implementation. A difficult to guess code is convenient for some use cases that `SELF_HYPERLINK()` enables. The canonical URL for a document is mutable, but older versions generally forward. So for implementation simplicity the document url is passed it on sandbox creation and remains fixed throughout the lifetime of the sandbox. This could and should be improved in future. The URL is passed into the sandbox as a `DOC_URL` environment variable. The code for creating the URL is factored out of `Notifier.ts`. Since the url is a function of the organization as well as the document, some rejiggering is needed to make that information available to DocManager. On document imports, the new document is registered in the database slightly earlier now, in order to keep the procedure for constructing the URL in different starting conditions more homogeneous. Test Plan: updated test Reviewers: dsagal Reviewed By: dsagal Differential Revision: https://phab.getgrist.com/D2759
49 lines
1.6 KiB
TypeScript
49 lines
1.6 KiB
TypeScript
import { HomeDBManager } from 'app/gen-server/lib/HomeDBManager';
|
|
import { ActiveDoc } from 'app/server/lib/ActiveDoc';
|
|
import { DocManager } from 'app/server/lib/DocManager';
|
|
import { ICreate } from 'app/server/lib/ICreate';
|
|
import { LoginSession } from 'app/server/lib/LoginSession';
|
|
import { NSandboxCreator } from 'app/server/lib/NSandbox';
|
|
|
|
// Use raw python - update when pynbox or other solution is set up for core.
|
|
const sandboxCreator = new NSandboxCreator('unsandboxed');
|
|
|
|
export const create: ICreate = {
|
|
LoginSession() {
|
|
return new LoginSession();
|
|
},
|
|
Billing(dbManager: HomeDBManager) {
|
|
return {
|
|
addEndpoints(app: any) { /* do nothing */ },
|
|
addEventHandlers() { /* do nothing */ },
|
|
addWebhooks(app: any) { /* do nothing */ }
|
|
};
|
|
},
|
|
Notifier() {
|
|
return {
|
|
get testPending() { return false; }
|
|
};
|
|
},
|
|
Shell() {
|
|
return {
|
|
moveItemToTrash() { throw new Error('moveToTrash unavailable'); },
|
|
showItemInFolder() { throw new Error('showItemInFolder unavailable'); }
|
|
};
|
|
},
|
|
ExternalStorage() { return undefined; },
|
|
ActiveDoc(docManager, docName, options) { return new ActiveDoc(docManager, docName, options); },
|
|
DocManager(storageManager, pluginManager, homeDBManager, gristServer) {
|
|
return new DocManager(storageManager, pluginManager, homeDBManager, gristServer);
|
|
},
|
|
NSandbox(options) {
|
|
return sandboxCreator.create(options);
|
|
},
|
|
sessionSecret() {
|
|
return process.env.GRIST_SESSION_SECRET ||
|
|
'Phoo2ag1jaiz6Moo2Iese2xoaphahbai3oNg7diemohlah0ohtae9iengafieS2Hae7quungoCi9iaPh';
|
|
},
|
|
configurationOptions() {
|
|
return {};
|
|
}
|
|
};
|