Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit c77f2ad

Browse files
committed
Make dburl work consistently with /_static for db files
1 parent 1a74e4b commit c77f2ad

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

runestone/activecode/js/activecode_sql.js

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ export default class SQLActiveCode extends ActiveCode {
77
constructor(opts) {
88
super(opts);
99
// fnprefix sets the path to load the sql-wasm.wasm file
10+
var bookprefix;
1011
var fnprefix;
1112
if (eBookConfig.useRunestoneServices) {
12-
fnprefix =
13-
"/runestone/books/published/" +
14-
eBookConfig.basecourse +
15-
"/_static";
13+
bookprefix = `${eBookConfig.app}/books/published/${eBookConfig.basecourse}`;
14+
fnprefix = bookprefix + "/_static";
1615
} else {
16+
bookprefix = "";
1717
fnprefix = "/_static";
1818
}
1919
this.config = {
@@ -23,12 +23,8 @@ export default class SQLActiveCode extends ActiveCode {
2323
initSqlJs(this.config).then(function (SQL) {
2424
// set up call to load database asynchronously if given
2525
if (self.dburl) {
26-
if (!self.dburl.startsWith("http")) {
27-
self.dburl =
28-
window.location.protocol +
29-
"//" +
30-
window.location.host +
31-
self.dburl;
26+
if (self.dburl.startsWith("/_static")) {
27+
self.dburl = `${bookprefix}${self.dburl}`;
3228
}
3329
$(self.runButton).attr("disabled", "disabled");
3430
let buttonText = $(self.runButton).text();

0 commit comments

Comments
 (0)