File tree Expand file tree Collapse file tree 4 files changed +30
-2
lines changed
Expand file tree Collapse file tree 4 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 66 const FRONTENDDIR = __DIR__ . "/frontend/";
77 const DBPATH = __DIR__ . "/db/solid.db";
88 const CLEANUP_FILE = __DIR__ . "/db/lastcleanup";
9+ const PODPRO_COMPATIBILITY = false;
910
1011 const MAILER = [
1112 "host" => "mailpit",
Original file line number Diff line number Diff line change @@ -204,6 +204,15 @@ public static function respondToToken() {
204204 );
205205 }
206206
207- Server::respond ($ response );
207+ // Hack for podpro
208+ if (PODPRO_COMPATIBILITY && strstr ($ clientId , "podpro.dev " )) {
209+ $ response ->getBody ()->rewind ();
210+ $ responseBody = $ response ->getBody ()->getContents ();
211+ $ body = json_decode ($ responseBody , true );
212+ $ body ['refresh_token ' ] = str_repeat ('a ' , 209 ); // Podpro doesn't like refresh tokens longer than 209 characters; Sad.
213+ Server::respondPodPro ($ response , $ body );
214+ } else {
215+ Server::respond ($ response );
216+ }
208217 }
209218 }
Original file line number Diff line number Diff line change @@ -163,4 +163,21 @@ public static function respond($response) {
163163 }
164164 echo json_encode ($ body , JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR );
165165 }
166+
167+ public static function respondPodPro ($ response , $ body ) {
168+ $ statusCode = $ response ->getStatusCode ();
169+ $ response ->getBody ()->rewind ();
170+ $ headers = $ response ->getHeaders ();
171+
172+ header ("HTTP/1.1 $ statusCode " );
173+ foreach ($ headers as $ header => $ values ) {
174+ foreach ($ values as $ value ) {
175+ if ($ header == "Location " ) {
176+ $ value = preg_replace ("|%26%2334%3B| " , "%22 " , $ value ); // odoo weird encoding
177+ }
178+ header ($ header . ": " . $ value );
179+ }
180+ }
181+ echo json_encode ($ body , JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR );
182+ }
166183 }
Original file line number Diff line number Diff line change 66 const FRONTENDDIR = __DIR__ . "/frontend/";
77 const DBPATH = __DIR__ . "/db/solid.db";
88 const CLEANUP_FILE = __DIR__ . "/db/lastcleanup";
9-
9+ const PODPRO_COMPATIBILITY = false;
10+
1011 const MAILER = [
1112 "host" => "mailpit",
1213 "port" => 1025,
You can’t perform that action at this time.
0 commit comments