Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
coopwire-hypothesis
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
孙灵跃 Leon Sun
coopwire-hypothesis
Commits
81469b9f
Commit
81469b9f
authored
Apr 18, 2023
by
Alejandro Celaya
Committed by
Alejandro Celaya
Apr 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check browser extension config only for host frames
parent
fa8f884b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
index.js
src/boot/index.js
+10
-11
No files found.
src/boot/index.js
View file @
81469b9f
...
@@ -22,19 +22,9 @@ if (isBrowserSupported()) {
...
@@ -22,19 +22,9 @@ if (isBrowserSupported()) {
const
config
=
/** @type {AnnotatorConfig|SidebarAppConfig} */
(
const
config
=
/** @type {AnnotatorConfig|SidebarAppConfig} */
(
parseJsonConfig
(
document
)
parseJsonConfig
(
document
)
);
);
// When the boot script is executed from the browser extension, a config
// generated by that specific extension is required
const
extensionId
=
getExtensionId
();
if
(
extensionId
&&
!
hasExtensionConfig
(
extensionId
))
{
throw
new
Error
(
'Could not start Hypothesis extension as configuration is missing'
);
}
const
assetRoot
=
processUrlTemplate
(
config
.
assetRoot
||
'__ASSET_ROOT__'
);
const
assetRoot
=
processUrlTemplate
(
config
.
assetRoot
||
'__ASSET_ROOT__'
);
// Check whether this is
the sidebar
app (indicated by the presence of a
// Check whether this is
a mini-
app (indicated by the presence of a
// `<hypothesis-app>` element) and load the appropriate part of the client.
// `<hypothesis-app>` element) and load the appropriate part of the client.
if
(
document
.
querySelector
(
'hypothesis-app'
))
{
if
(
document
.
querySelector
(
'hypothesis-app'
))
{
const
sidebarConfig
=
/** @type {SidebarAppConfig} */
(
config
);
const
sidebarConfig
=
/** @type {SidebarAppConfig} */
(
config
);
...
@@ -44,6 +34,15 @@ if (isBrowserSupported()) {
...
@@ -44,6 +34,15 @@ if (isBrowserSupported()) {
apiUrl
:
sidebarConfig
.
apiUrl
,
apiUrl
:
sidebarConfig
.
apiUrl
,
});
});
}
else
{
}
else
{
// When the boot script is executed from the browser extension on a host
// frame, a config generated by that specific extension is required
const
extensionId
=
getExtensionId
();
if
(
extensionId
&&
!
hasExtensionConfig
(
extensionId
))
{
throw
new
Error
(
'Could not start Hypothesis extension as configuration is missing'
);
}
// nb. If new asset URLs are added here, the browser extension and
// nb. If new asset URLs are added here, the browser extension and
// `hypothesis-injector.ts` need to be updated.
// `hypothesis-injector.ts` need to be updated.
const
annotatorConfig
=
/** @type {AnnotatorConfig} */
(
config
);
const
annotatorConfig
=
/** @type {AnnotatorConfig} */
(
config
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment