From 68aeb4a997a99ac7dde426ad7a3c87205b4f89d2 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 12 Apr 2017 21:00:38 +0000
Subject: [PATCH] Replace "Lines" table with tram schedule function

---
 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