summaryrefslogtreecommitdiffstats
path: root/public/ng/js
diff options
context:
space:
mode:
authorMartin van Beurden <chadoe@gmail.com>2014-09-14 19:35:22 +0200
committerMartin van Beurden <chadoe@gmail.com>2014-09-18 20:50:48 +0200
commit0055cbd3651ebde0f8b6cc70c9c44de56dc38830 (patch)
tree64a9ea617ba1f704139881c3960fa2425dad9018 /public/ng/js
parent4f74b4e6578be4251af65cd08daa37c884e431a0 (diff)
downloadgitea-0055cbd3651ebde0f8b6cc70c9c44de56dc38830.tar.gz
gitea-0055cbd3651ebde0f8b6cc70c9c44de56dc38830.zip
Allow Gogs to run from a suburl behind a reverse proxy. e.g. http://mydomain.com/gogs/
Conflicts: modules/setting/setting.go Conflicts: templates/repo/release/list.tmpl templates/user/dashboard/dashboard.tmpl Conflicts: routers/repo/setting.go
Diffstat (limited to 'public/ng/js')
-rw-r--r--public/ng/js/gogs.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/public/ng/js/gogs.js b/public/ng/js/gogs.js
index 74bb6cc222..fcc470e9ad 100644
--- a/public/ng/js/gogs.js
+++ b/public/ng/js/gogs.js
@@ -202,7 +202,7 @@ var Gogs = {};
// Search users by keyword.
Gogs.searchUsers = function (val, $target) {
$.ajax({
- url: '/api/v1/users/search?q=' + val,
+ url: Gogs.AppRootSubUrl + '/api/v1/users/search?q=' + val,
dataType: "json",
success: function (json) {
if (json.ok && json.data.length) {
@@ -222,7 +222,7 @@ var Gogs = {};
// Search repositories by keyword.
Gogs.searchRepos = function (val, $target, $param) {
$.ajax({
- url: '/api/v1/repos/search?q=' + val + '&' + $param,
+ url: Gogs.AppRootSubUrl + '/api/v1/repos/search?q=' + val + '&' + $param,
dataType: "json",
success: function (json) {
if (json.ok && json.data.length) {
@@ -245,7 +245,7 @@ var Gogs = {};
return;
}
$(selector).zclip({
- path: "/js/ZeroClipboard.swf",
+ path: Gogs.AppRootSubUrl + "/js/ZeroClipboard.swf",
copy: function () {
var t = $(this).data("copy-val");
var to = $($(this).data("copy-from"));
@@ -592,6 +592,7 @@ function initInstall() {
}
$(document).ready(function () {
+ Gogs.AppRootSubUrl = $('head').data('suburl');
initCore();
if ($('#user-profile-setting').length) {
initUserSetting();
@@ -644,7 +645,7 @@ function homepage() {
$('#promo-form').submit(function (e) {
if ($('#username').val() === "") {
e.preventDefault();
- window.location.href = '/user/login';
+ window.location.href = Gogs.AppRootSubUrl + '/user/login';
return true
}
});
@@ -652,9 +653,9 @@ function homepage() {
$('#register-button').click(function (e) {
if ($('#username').val() === "") {
e.preventDefault();
- window.location.href = '/user/sign_up';
+ window.location.href = Gogs.AppRootSubUrl + '/user/sign_up';
return true
}
- $('#promo-form').attr('action', '/user/sign_up');
+ $('#promo-form').attr('action', Gogs.AppRootSubUrl + '/user/sign_up');
});
}