We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c417ab1 commit f424b15Copy full SHA for f424b15
src/utils/parser/Gist.js
@@ -1,13 +1,25 @@
1
import Base from './FileParser.js';
2
3
export default class Gist extends Base {
4
+ #filename;
5
+
6
constructor(updateUrl, downloadUrl) {
7
const url = new URL(updateUrl);
8
if (url.hostname === 'gist.github.com') {
- url.hostname = 'gistcdn.githack.com';
9
+ const parts = url.pathname.split('/');
10
+ super(
11
+ `https://api.github.com/gists/${parts[2]}`,
12
+ downloadUrl,
13
+ );
14
15
+ this.#filename = parts.pop();
16
} else {
17
throw new Error('This parser is for github gists only');
18
}
- super(`${url}`, downloadUrl);
19
+ }
20
21
+ parseData({ files = {} } = {}) {
22
+ const file = files[this.#filename];
23
+ return super.parseData(file?.content);
24
25
0 commit comments