Skip to content

Commit 21ff3a2

Browse files
committed
Fixes link building issues, closes #9
1 parent cab0e68 commit 21ff3a2

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

assets/js/dashboard.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,25 @@ let vm = new Vue({
8686
return this.buildRecipeRepoUrl(recipe) + '/' + version
8787
},
8888
buildRecipeRepoUrl (recipe) {
89-
return recipe.repo.url + '/tree/master/' + recipe.officialPackageName
89+
let repoUrl, pattern, gitServerHostName
90+
91+
repoUrl = recipe.repo.url.replace('.git', '')
92+
93+
pattern = /^git\@[a-z.]*\:/
94+
if (pattern.test(repoUrl)) {
95+
gitServerHostName = pattern.exec(repoUrl)[0].replace('git@', '').replace(':', '')
96+
repoUrl.replace(pattern, 'https://' + gitServerHostName + '/')
97+
}
98+
99+
pattern = /^https?\:\/\/[a-z.]*/
100+
gitServerHostName = pattern.exec(repoUrl)[0].replace(/https?\:\/\//, '')
101+
102+
switch (gitServerHostName) {
103+
case 'bitbucket.org':
104+
return repoUrl + '/src/master/' + recipe.officialPackageName
105+
default:
106+
return repoUrl + '/tree/master/' + recipe.officialPackageName
107+
}
90108
},
91109
showSearch () {
92110
this.enableFilter = true;

public/build/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"build/dashboard.css": "/build/dashboard.css",
3-
"build/dashboard.js": "/build/dashboard.js"
2+
"build/dashboard.css": "/build/dashboard.b1963f9d56ce5d23c3b365942619a02a.css",
3+
"build/dashboard.js": "/build/dashboard.37bb0847d2441133ec9d.js"
44
}

0 commit comments

Comments
 (0)