mirror of
https://github.com/enso-org/enso.git
synced 2024-12-26 16:42:29 +03:00
5995a00958
part of #7954 # Important Notes The workflow is: - `$ npm install` -- just in case - `$ npm --workspace=enso-gui2 run build-ydoc-server-polyglot` -- build the `ydocServer.js` bundle - `$ sbt ydoc-server/assembly` -- build the ydoc server jar - `env POLYGLOT_YDOC_SERVER=true npm --workspace=enso-gui2 run dev` -- run the dev server with the polyglot ydoc server. Providing `POLYGLOT_YDOC_SERVER_DEBUG=true` env variable enables the chrome debugger
23 lines
449 B
TypeScript
23 lines
449 B
TypeScript
/**
|
|
* @file Utility methods for ydoc server authentication.
|
|
*/
|
|
|
|
export type ConnectionData = {
|
|
lsUrl: string
|
|
doc: string
|
|
user: string
|
|
}
|
|
|
|
const docNameRegex = /^[a-z0-9/-]+$/i
|
|
|
|
export function docName(pathname: string) {
|
|
const prefix = '/project/'
|
|
if (pathname != null && pathname.startsWith(prefix)) {
|
|
const docName = pathname.slice(prefix.length)
|
|
if (docNameRegex.test(docName)) {
|
|
return docName
|
|
}
|
|
}
|
|
return null
|
|
}
|