|
201 | 201 | Events.bind(); |
202 | 202 | }; |
203 | 203 | if (!Docbase.versions) { |
204 | | - $.get(Docbase.options.map.path + '/' + Docbase.options.map.file) |
205 | | - .success(prepareMapFile) |
206 | | - .error(function(error) { |
207 | | - // no map available for labels |
208 | | - jWindow.trigger('mapped'); |
209 | | - Events.bind(); |
210 | | - }); |
| 204 | + jWindow.trigger('mapped'); |
| 205 | + |
| 206 | + // $.get(Docbase.options.map.path + '/' + Docbase.options.map.file) |
| 207 | + // .success(prepareMapFile) |
| 208 | + // .error(function(error) { |
| 209 | + // // no map available for labels |
| 210 | + // jWindow.trigger('mapped'); |
| 211 | + // Events.bind(); |
| 212 | + // }); |
211 | 213 | } else { |
212 | 214 | prepareMapFile(Docbase.options.versions); |
213 | 215 | } |
|
685 | 687 |
|
686 | 688 | var baseurl = 'https://api.github.com/repos/' + options.user + '/' + options.repo + '/'; |
687 | 689 |
|
688 | | - var url = baseurl + 'contents/' + path; |
| 690 | + var url = baseurl + 'contents?ref=' + options.branch + path; |
| 691 | + if (options.client_id && options.client_secret) { |
| 692 | + url += '&client_id=' + options.client_id + '&client_secret=' + options.client_secret; |
| 693 | + } |
689 | 694 |
|
690 | 695 | $.get(url, { |
691 | 696 | ref: options.branch |
|
697 | 702 | }); |
698 | 703 | if (commitData[0]) { |
699 | 704 | var sha = commitData[0].sha; |
700 | | - $.get(baseurl + 'git/trees/' + sha + '?recursive=1') |
| 705 | + var treeUrl = baseurl + 'git/trees/' + sha + '?recursive=1'; |
| 706 | + if (options.client_id && options.client_secret) { |
| 707 | + treeUrl += '&client_id=' + options.client_id + '&client_secret=' + options.client_secret; |
| 708 | + } |
| 709 | + |
| 710 | + $.get(treeUrl) |
701 | 711 | .success(function(tree) { |
702 | 712 | tree = tree.tree.filter(function(each) { |
703 | 713 | return endsWith(each.path, '.md'); |
|
743 | 753 | } |
744 | 754 | }); |
745 | 755 |
|
| 756 | + map = Docbase._index(map); |
746 | 757 | callback(null, map); |
747 | | - |
748 | 758 | }) |
749 | 759 | .error(function(error) { |
750 | 760 | callback(error); |
|
0 commit comments