Jump to content

thomasaull

Members
  • Content Count

    63
  • Joined

  • Last visited

  • Days Won

    2

thomasaull last won the day on September 19 2018

thomasaull had the most liked content!

Community Reputation

99 Excellent

About thomasaull

  • Rank
    Full Member

Contact Methods

  • Website URL
    www.thomasaull.de

Profile Information

  • Location
    Würzburg, Germany

Recent Profile Visitors

1,425 profile views
  1. @thibaultvdb I need to check this, since I think (when I remember it properly) I put this option in specifically for this use-case. If you want to fiddle around try making it work or you know/want to figure out how ProcessWire does this automatically feel free Otherwise I can't really make any promise when I'm going to be able to look into this
  2. @thibaultvdb In the module settings there is an input for "API Endpoint" — can you try to change the value there to "localhost/api" and report back if this works for you?
  3. @thibaultvdb If what @flydev says is the case and you're trying to access your website inside a subdirectory you could also try to adjust the path for the api in the module settings. Maybe it'll work
  4. @thibaultvdb It's a bit difficult to help from here. One thing you could try is to go through the code in Router.php and return or exit early to find out until where the code runs. The main functions are "go()" and "handle()". Another idea is to compare php settings between your hosted and local environment with "phpinfo()". If you can isolate the issue it's much easier to help.
  5. @pmichaelis I'm gonna ask anyway: Why? Seems like a weird server config, but I could add this to the variables the module checks by default.
  6. @pmichaelis If the error is thrown in line 131 it's likeley there is an error with the JWT Authorization. Maybe the Token you're submitting is not valid, maybe something else. Hard to tell with the little information you provided. Oh, just noticed you already mentioned the JWT Auth… Probably the error is produced in those 4 lines: $secret = wire('modules')->RestApi->jwtSecret; $token = str_replace('Bearer', '', $authHeader); $token = trim($token); $decoded = JWT::decode($token, wire('modules')->RestApi->jwtSecret, array('HS256')); if the secret is in your config and you didn't change it, I'd check if the token gets transmitted properly with the request.
  7. @siilak I think all you need to do is to add your route in Routes.php: $routes = [ ['PUT', 'user', User::class, 'addUser'], ]; And have some functionality for adding your data in your 'addUser' Function. Let me know, if it works!
  8. @Sebi@pmichaelis Think I'm going to include @pmichaelis since it does not required additional configuration (actually before I used the RestApi Module with NGINX it was using apache_request_headers anyway)
  9. @flydev Thanks for your PR. I'm going to investigate (feel free to remind me, if you don't hear back)! One concern though, do you think it's a good practice to send the password on every request? In this case you'd have to store the password somewhere in your frontend, which I think is security bad practise. Maybe other people do have an opinion about that?
  10. @pmichaelis Is vagrant using an apache or nginx server? Can you check where the authorization header is contained in your case (apache_request_headers or $_SERVER)? And what version of php are you using?
  11. @dragan Yes, it basically only sends a POST Request to a webhook url without any further information. So your assumption is correct In my case the CI Pipeline does a static build of the website and deploys it on the server. What happens in your build pipeline is totally up to you though. You could also do a request from your pipeline to your API to gather further information if needed. The trigger does not become active for system templates and pages which are not public, this is the related code: // do nothing for system pages: if ($page->template->flags === Template::flagSystem) return; // do nothing if page is not public if (!$page->isPublic) return;
  12. @flydev I adjusted the Regex Pattern for the endpoint url to allow numbers too: https://github.com/thomasaull/RestApi/commit/f2e851faf4b89449bca496d6bea20ee85dc0f6ee Please update the module to 0.0.6 for this to become active
  13. It might be a good idea to make this configurable, so the user can choose between a webhook or select a page to act as the api endpoint. You wanna provide a PR @eelkenet? I'm a bit short of time currently.
  14. I created a little helper module to trigger a CI pipeline when your website has been changed. It's quite simple and works like this: As soon as you save a page the module sets a Boolean via a pages save after hook. Once a day via LazyCron the module checks if the Boolean is set and sends a POST Request to a configurable Webhook URL. Some ideas to extend this: make request type configurable (GET, POST) make the module trigger at a specified time (probably only possible with a server cronjob) trigger manually Anything else? If there's interest, I might put in some more functionality. Let me know what you're interested in. Until then, maybe it is useful for a couple of people Github Repo: https://github.com/thomasaull/CiTrigger
  15. @gottberg @flydev I created a small helper class for dealing with responsive images: <?php namespace ProcessWire; class Image { public static function get ($image, $widths = [400, 800, 1200]) { $response = new \StdClass(); $response->focus = ["x" => $image->focus['left'], "y" => $image->focus['top']]; $response->urls = []; $response->description = $image->description; $response->name = $image->basename; $response->width = $image->width; $response->height = $image->height; foreach ($widths as $width) { $croppedImage = $image->width($width); $url = new \StdClass(); $url->url = $croppedImage->httpUrl; $url->width = $croppedImage->width; $url->height = $croppedImage->height; $url->ratio = $croppedImage->height / $croppedImage->width; array_push($response->urls, $url); } return $response; } } Usage: // $image is your ProcessWire PageImage return Image::get($image, [400, 800, 1200, 2000, 2500]);
×
×
  • Create New...