MCPcopy Index your code
hub / github.com/ether/etherpad / getReadOnlyId

Function getReadOnlyId

src/node/db/ReadOnlyManager.ts:39–53  ·  view source on GitHub ↗
(padId:string)

Source from the content-addressed store, hash-verified

37 * @return {String} the read only id
38 */
39const getReadOnlyId = async (padId:string) => {
40 // check if there is a pad2readonly entry
41 let readOnlyId = await db.get(`pad2readonly:${padId}`);
42
43 // there is no readOnly Entry in the database, let's create one
44 if (readOnlyId == null) {
45 readOnlyId = `r.${randomString(16)}`;
46 await Promise.all([
47 db.set(`pad2readonly:${padId}`, readOnlyId),
48 db.set(`readonly2pad:${readOnlyId}`, padId),
49 ]);
50 }
51
52 return readOnlyId;
53};
54
55/**
56 * returns the padId for a read only id

Callers 1

getIdsFunction · 0.85

Calls 3

getMethod · 0.80
setMethod · 0.80
randomStringFunction · 0.50

Tested by

no test coverage detected