Commit 8513fb6d authored by Randall Leeds's avatar Randall Leeds

Support relative URLs from document info plugins

PDF usages might want to specify relative URLs to get around proxy
restrictions with a custom viewer. Even link tags support relative
URLs for rel=canonical though it's probably a bad idea as a publisher.
In any case, we should clearly just do this.
parent 7a9ddd5c
baseURI = require('base-url')()
raf = require('raf') raf = require('raf')
Annotator = require('annotator') Annotator = require('annotator')
$ = Annotator.$ $ = Annotator.$
...@@ -105,7 +106,7 @@ module.exports = class Guest extends Annotator ...@@ -105,7 +106,7 @@ module.exports = class Guest extends Annotator
return metadataPromise.then (metadata) => return metadataPromise.then (metadata) =>
return uriPromise.then (href) => return uriPromise.then (href) =>
uri = new URL(href) uri = new URL(href, baseURI)
uri.hash = '' uri.hash = ''
uri = uri.toString() uri = uri.toString()
return {uri, metadata} return {uri, metadata}
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"version": "0.0.0", "version": "0.0.0",
"description": "The Internet, peer reviewed.", "description": "The Internet, peer reviewed.",
"dependencies": { "dependencies": {
"base-url": "^1.0.0",
"browserify": "^9.0.3", "browserify": "^9.0.3",
"browserify-shim": "^3.8.3", "browserify-shim": "^3.8.3",
"clean-css": "2.2.2", "clean-css": "2.2.2",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment