forked from Itiviti/git-react-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.js
More file actions
24 lines (22 loc) · 677 Bytes
/
settings.js
File metadata and controls
24 lines (22 loc) · 677 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
let settings = {
gitRestApi: () => 'http://git-viewer:1337',
gitViewer: () => new GitwebViewer('http://git-viewer/gitweb')
}
export default settings;
class GitwebViewer {
constructor(baseUrl) {
this.baseUrl = baseUrl;
}
viewerForRepo({repo}) {
return `${this.baseUrl}/?p=${repo}`;
}
viewerForBranch({repo, branch}) {
return `${this.baseUrl}/?p=${repo};a=shortlog;h=${branch};js=1`;
}
viewerForPath({repo, branch, file}) {
return `${this.baseUrl}/?p=${repo};a=blob;f=${file};hb=${branch};js=1`;
}
viewerForLine({repo, branch, file, line_no}) {
return `${this.baseUrl}/?p=${repo};a=blob;f=${file};hb=${branch};js=1#l${line_no}`;
}
}