From 153e874beff035ca089fe99494d7e9ebfdf9b1ac Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Mon, 27 Aug 2007 00:57:47 +0000 Subject: [PATCH] Patch from Stephane Moreau to make apache rewrites easier --- CREDITS | 5 ++++- admin-root/config.js | 14 +++++++------- admin-root/playlist.js | 10 +++++----- admin-root/smart.js | 8 ++++---- src/configfile.c | 2 +- 5 files changed, 21 insertions(+), 18 deletions(-) diff --git a/CREDITS b/CREDITS index e13034c4..10a6de7e 100644 --- a/CREDITS +++ b/CREDITS @@ -146,6 +146,9 @@ Gareth Potter Anton Johansson * Swedish Translations -Iam Burrell +Ian Burrell * configure patches to put plugins in libdir * RH/Centos/Fedora specfiles + +Stephane Moreau + * admin page updates to make apache rewrites easier diff --git a/admin-root/config.js b/admin-root/config.js index 1e65a527..4b13fae6 100644 --- a/admin-root/config.js +++ b/admin-root/config.js @@ -139,7 +139,7 @@ var ConfigInitialValues = { var Config ={ configPath: '', init: function () { - new Ajax.Request('/config.xml',{method: 'get',onComplete: Config.storeConfigLayout}); + new Ajax.Request('config.xml',{method: 'get',onComplete: Config.storeConfigLayout}); }, storeConfigLayout: function (request) { // Need to store this until showConfig is run @@ -153,12 +153,12 @@ var Config ={ ConfigInitialValues.setValue(item.id,item.default_value || ''); } }); - new Ajax.Request('/xml-rpc?method=stats',{method: 'get',onComplete: Config.updateStatus}); + new Ajax.Request('xml-rpc?method=stats',{method: 'get',onComplete: Config.updateStatus}); }, updateStatus: function (request) { Config.configPath = Element.textContent(request.responseXML.getElementsByTagName('config_path')[0]); Config.isWritable = Element.textContent(request.responseXML.getElementsByTagName('writable_config')[0]) == '1'; - new Ajax.Request('/xml-rpc?method=config',{method: 'get',onComplete: Config.showConfig}); + new Ajax.Request('xml-rpc?method=config',{method: 'get',onComplete: Config.showConfig}); }, showConfig: function (request) { ConfigInitialValues.parseXML(request.responseXML); @@ -530,7 +530,7 @@ function saveForm() { return; } if (postVars.length > 0 ) { - new Ajax.Request('/xml-rpc?method=updateconfig', + new Ajax.Request('xml-rpc?method=updateconfig', {method: 'post', parameters: postVars.join('&'), onComplete: saved}); @@ -545,10 +545,10 @@ function saveForm() { getArr.push('key='+encodeURIComponent(a[1])); getArr.push('value='+encodeURIComponent(value)); getArr.push('verify_only=1'); - getString = '/xml-rpc?method=setconfig&' + getArr.join('&'); + getString = 'xml-rpc?method=setconfig&' + getArr.join('&'); } else { - getString = '/xml-rpc?method=updateconfig&' + Form.Element.serialize(id); + getString = 'xml-rpc?method=updateconfig&' + Form.Element.serialize(id); } var output = id + '=' + value; new Ajax.Request(getString, @@ -608,4 +608,4 @@ var i=0; }); return; -} \ No newline at end of file +} diff --git a/admin-root/playlist.js b/admin-root/playlist.js index 7001d07c..b924f21c 100644 --- a/admin-root/playlist.js +++ b/admin-root/playlist.js @@ -131,7 +131,7 @@ CustomDropzone.prototype = (new Rico.Dropzone()).extend( { }, _insert: function(songids) { - var url = '/databases/1/containers/' + this.htmlElement.value + "/items/add?output=xml&dmap.itemid=" + songids; + var url = 'databases/1/containers/' + this.htmlElement.value + "/items/add?output=xml&dmap.itemid=" + songids; new Ajax.Request(url ,{method: 'get',onComplete:this.responseAdd}); }, @@ -160,7 +160,7 @@ function initPlaylist() { Ajax.Responders.register({ onCreate: Spinner.incRequestCount, onComplete: Spinner.decRequestCount}); - new Ajax.Request('/databases/1/containers?output=xml',{method: 'get',onComplete:rsSource}); + new Ajax.Request('databases/1/containers?output=xml',{method: 'get',onComplete:rsSource}); Query.send('genres'); Event.observe('search','keypress',EventHandler.searchKeyPress); Event.observe('source','change',EventHandler.sourceChange); @@ -222,7 +222,7 @@ var Source = { }); }, addPlaylist: function () { - var url = '/databases/1/containers/add?output=xml'; + var url = 'databases/1/containers/add?output=xml'; var name= 'untitled playlist'; if (this._playlistExists(name)) { var i=1; @@ -242,7 +242,7 @@ var Source = { }, removePlaylist: function () { if (window.confirm('Really delete playlist?')) { - var url = '/databases/1/containers/del?output=xml'; + var url = 'databases/1/containers/del?output=xml'; url += '&dmap.itemid=' + $('source').value; new Ajax.Request(url ,{method: 'get',onComplete:this.response}); var option = this._getOptionElement($('source').value); @@ -251,7 +251,7 @@ var Source = { }, savePlaylistName: function () { input = $('edit_playlist_name'); - var url = '/databases/1/containers/edit?output=xml'; + var url = 'databases/1/containers/edit?output=xml'; url += '&dmap.itemid=' + Source.playlistId; url += '&dmap.itemname=' + encodeURIComponent(input.value); new Ajax.Request(url ,{method: 'get',onComplete:this.response}); diff --git a/admin-root/smart.js b/admin-root/smart.js index a8357e23..64adb874 100644 --- a/admin-root/smart.js +++ b/admin-root/smart.js @@ -87,10 +87,10 @@ function pl_update() { if(id == '0') { /* new playlist... post it! */ - var url = '/databases/1/containers/add?output=xml&org.mt-daapd.playlist-type=1&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; + var url = 'databases/1/containers/add?output=xml&org.mt-daapd.playlist-type=1&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; result = pl_exec(url,false); } else { - var url='/databases/1/containers/edit?output=xml&dmap.itemid=' + id + '&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; + var url='databases/1/containers/edit?output=xml&dmap.itemid=' + id + '&dmap.itemname=' + name + '&org.mt-daapd.smart-playlist-spec=' + spec; result = pl_exec(url,false); } @@ -121,7 +121,7 @@ function pl_new() { function pl_delete(pl_id) { if(confirm('Are you sure you want to delete playlist "' + playlist_info[pl_id]['name'] + '"?')) { - result=pl_exec("/databases/1/containers/del?output=xml&dmap.itemid=" + pl_id,false); + result=pl_exec("databases/1/containers/del?output=xml&dmap.itemid=" + pl_id,false); init(); } } @@ -237,7 +237,7 @@ function pl_state_change() { } function init() { - pl_exec("/databases/1/containers?output=xml&meta=dmap.itemid,dmap.itemname,org.mt-daapd.playlist-type,org.mt-daapd.smart-playlist-spec",true); + pl_exec("databases/1/containers?output=xml&meta=dmap.itemid,dmap.itemname,org.mt-daapd.playlist-type,org.mt-daapd.smart-playlist-spec",true); } function pl_exec(url, async) { diff --git a/src/configfile.c b/src/configfile.c index ddf26639..336b338f 100644 --- a/src/configfile.c +++ b/src/configfile.c @@ -466,7 +466,7 @@ void config_handler(WS_CONNINFO *pwsc) { /* this is quite broken, but will work */ os_stat(resolved_path,&sb); if(S_ISDIR(sb.st_mode)) { - ws_addresponseheader(pwsc,"Location","/index.html"); + ws_addresponseheader(pwsc,"Location","index.html"); ws_returnerror(pwsc,302,"Moved"); config_set_status(pwsc,0,NULL); ws_should_close(pwsc,1);