+13
-6
src/knot-client.js
+13
-6
src/knot-client.js
···
9
}
10
11
async getBlob(filename) {
12
-
const url = `https://${this.domain}/${this.ownerDid}/${
13
-
this.repoName
14
-
}/blob/${this.branch}/${trimLeadingSlash(filename)}`;
15
console.log(`[KNOT CLIENT]: GET ${url}`);
16
const res = await fetch(url);
17
return await res.json();
18
}
19
20
async getRaw(filename) {
21
-
const url = `https://${this.domain}/${this.ownerDid}/${this.repoName}/raw/${
22
-
this.branch
23
-
}/${trimLeadingSlash(filename)}`;
24
console.log(`[KNOT CLIENT]: GET ${url}`);
25
const res = await fetch(url, {
26
responseType: "arraybuffer",
···
9
}
10
11
async getBlob(filename) {
12
+
const params = new URLSearchParams({
13
+
repo: `${this.ownerDid}/${this.repoName}`,
14
+
path: trimLeadingSlash(filename),
15
+
ref: this.branch,
16
+
});
17
+
const url = `https://${this.domain}/xrpc/sh.tangled.repo.blob?${params}`;
18
console.log(`[KNOT CLIENT]: GET ${url}`);
19
const res = await fetch(url);
20
return await res.json();
21
}
22
23
async getRaw(filename) {
24
+
const params = new URLSearchParams({
25
+
repo: `${this.ownerDid}/${this.repoName}`,
26
+
path: trimLeadingSlash(filename),
27
+
ref: this.branch,
28
+
raw: "true",
29
+
});
30
+
const url = `https://${this.domain}/xrpc/sh.tangled.repo.blob?${params}`;
31
console.log(`[KNOT CLIENT]: GET ${url}`);
32
const res = await fetch(url, {
33
responseType: "arraybuffer",
+2
-2
src/pages-service.js
+2
-2
src/pages-service.js