From 5de24f23a3cba96990b312a5e6564c40d619976d Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 12 Apr 2017 21:30:09 +0000
Subject: [PATCH] Ignore hashchange event on self-inflicted modifications

---
 proxy.php |   22 ++++++++++++++++++----
 1 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/proxy.php b/proxy.php
index ff9eb34..dad3670 100644
--- a/proxy.php
+++ b/proxy.php
@@ -1,20 +1,34 @@
 <?php
-$base_proxy = 'http://www.ttss.krakow.pl/internetservice/services';
+$base_proxy = 'http://www.ttss.krakow.pl/internetservice';
 $method = [
-	'/lookup/autocomplete/json' => [
+	'/services/lookup/autocomplete/json' => [
 		'query' => function() { return TRUE; },
 	],
-	'/passageInfo/stopPassages/stop' => [
+	'/services/passageInfo/stopPassages/stop' => [
 		'stop' => 'ctype_alnum',
 		'mode' => function($mode) { return in_array($mode, ['arrival', 'departure']); },
 	],
-	'/routeInfo/routeStops' => [
+	'/services/tripInfo/tripPassages' => [
+		'tripId' => 'ctype_digit',
+		'mode' => function($mode) { return in_array($mode, ['arrival', 'departure']); },
+		#'vehicleId' => 'ctype_digit',
+	],
+	'/services/routeInfo/routeStops' => [
 		'routeId' => 'ctype_alnum'
 	],
 ];
+$rewrite = [
+	'/lookup/autocomplete/json' => '/services/lookup/autocomplete/json',
+	'/passageInfo/stopPassages/stop' => '/services/passageInfo/stopPassages/stop',
+	'/routeInfo/routeStops' => '/services/routeInfo/routeStops',
+];
 
 $path = $_SERVER['PATH_INFO'];
 
+if(isset($rewrite[$path])) {
+	$path = $rewrite[$path];
+}
+
 if(!isset($method[$path])) {
 	header('HTTP/1.1 403 Forbidden');
 	die('Forbidden');

--
Gitblit v1.9.1