Jump to content

Orkun

Members
  • Content Count

    260
  • Joined

  • Last visited

Community Reputation

81 Excellent

About Orkun

  • Rank
    Sr. Member
  • Birthday 10/10/1996

Profile Information

  • Gender
    Male
  • Location
    Switzerland

Recent Profile Visitors

4,383 profile views
  1. Hi @kongondo Thanks for your input. I have now adjusted the post_max_size to 1G and the memory_limit to 2G since according to the php docs memory_limit needs also to be bigger than post_max_size. Will see if this helps. It is very strange that this SQL Error appears, I mean I have the following setting in MM for duplicate Media (see screenshot). Normally It should just replace the existing media if there is a duplicate. Could perhaps my change (that I had done a long time ago) for setting the page title for all languages be a problem? (line 1558) ------------------------------------------------------------------------------------------------------- You are right, that a upgrade to version 3 (PW) and to the newest MM Version would be a good idea. But the problem is, that the system is a very big and complex (Multi-Lang, Multi-Site: approximately 15-20+ Websites, A lot of modules etc...) Processwire Installation. And also there are a lot of users/editors that are editing daily. Because of this the upgrade isn't easily feasible. I had already started on a dev environment to upgrade to Version 3 and to trackdown all the problems that could appear and document them... Are there any points I need to watch on when upgrading the Media Manager? What problems could occur when upgrading (like for example media getting deleted or something?) KR Orkun
  2. Hi @kongondo This Problem still happens regularly. It is always the "Empty File Upload Result" Error. In the Processwire Logs it is a SQL Duplicate Entry Error (See Screenshot).The only way to make this work again temporarly was to delete the contents of /site/assets/MediaManager/jqfu/.files_no_show/ Processwire Version: 2.7.3 Dev PHP Version: 7.0.33-0ubuntu0.16.04.15 Media Manager Version: Media Manager (Process) v0.0.9 β post_max_size: Local Value(512M), Master Value(8M) memory_limit: Local Value(512M), Master Value(128M) file_uploads: On upload_max_filesize: Local Value(512M), Master Value(2M) It is also not a Windows Machine. That's what the customer had said to me today. Can you help me on this one? KR Orkun
  3. Ok this works for me now: require_once wire('config')->paths->RestApi . "Router.php"; $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { $url = wire('sanitizer')->url(wire('input')->url); // support / in endpoint url: $endpoint = str_replace("/", "\/", wire('modules')->RestApi->endpoint); $regex = '/^\/'.$endpoint.'\/?.*/m'; preg_match($regex, $url, $matches); $hasAccess = array( '178.192.77.1' ); if($matches) { if(!in_array($_SERVER['REMOTE_ADDR'], $hasAccess)){ wire('log')->save("sso-debug", "Access denied for ".$_SERVER['REMOTE_ADDR']); http_response_code(403); exit; } $event->replace = true; } }, [ 'priority' => 99 ]); I have added the priority option and set it to 99 so that it gets executed before your hook in RestApi Module. KR Orkun
  4. I tried this by creating a init.php file insdie /site/ with this content in it, but the go method of the router class from your RestApi.module is still executed. <?php require_once wire('config')->paths->RestApi . "/Router.php"; $this->addHookBefore('ProcessPageView::execute', function(HookEvent $event) { $url = wire('sanitizer')->url(wire('input')->url); // support / in endpoint url: $endpoint = str_replace("/", "\/", wire('modules')->RestApi->endpoint); $regex = '/^\/'.$endpoint.'\/?.*/m'; preg_match($regex, $url, $matches); $hasAccess = array( '178.192.77.1' ); if($matches) { $event->replace = true; if(in_array($_SERVER['REMOTE_ADDR'], $hasAccess)){ wire('log')->save("sso-debug", "Access granted for ".$_SERVER['REMOTE_ADDR']); Router::go(); } else { wire('log')->save("sso-debug", "Access denied for ".$_SERVER['REMOTE_ADDR']); throw new \Exception("Access denied!", 400); } } }); What can I do? KR Orkun
  5. Looks like this happens only when the ckeditor field is in inline mode. In regular mode the images added at the position where my cursor is. Is this a expected behavior or a bug? KR Orkun
  6. Hi Guys When I try to add an Image inside the CKEditor Field, that Image always gets added to the TOP instead there where the cursor was. Do you know why this problem happens? KR Orkun
  7. Hi @thomasaull Do you know what the best way is to restrict the API Requests for specific IP Adresses? KR Orkun
  8. Hi @kongondo Is it normal that the folder in /site/assets/MediaManager/jqfu/.files_no_show/ is full of files/duplicate files? We can't upload any files anymore, because we are getting the error of duplicate media page (empty file upload result). It looks like he tries to create a page from a file from the .files_no_show folder but that page with the name already exists. Isn't the /site/assets/MediaManager/jqfu/.files_no_show/ just a temporary folder? Shouldn't be the file deleted after the media page was created? KR Orkun
  9. Hi all I found a tool which "fixed" the mp3 file so that I could upload it again in media manager. I used the tool https://www.deepniner.net/mp3trimmer/, but it also works with the https://audiotrimmer.com/ online tool. I think it removes all non-audio data from the mp3 file. KR Orkun
  10. @kongondo Any news on this? What I could do is, is to add the "application/octet-stream" mimetype for mp3 extensions. I could do this inside the method "mimeTypes" of the File "MediaManagerUtilities.php" but don't know if this is a good Idea. KR Orkun
  11. Hi @kongondo We have a problem with uploading some mp3 files. We can't upload a specific .mp3 file in the media manager because on the server it returns application/octet-stream as mime-type instead of audio/mpeg. But when I check with finfo or mime_content_type on a localhost it returns audio/mpeg mimetype. Even when I check the mime-type on the mac osx terminal (file --mime-type -b filename) it returns audio/mpeg. What should I do? I also can't find an online tool where the customer could repair the mp3 file or something. I downloaded the file from the dropbox account/link of the customer. The funny thing is, when i convert that mp3 file to wav it can be uploaded. KR Orkun
  12. Hi @Craig A Rodway Ok thank you very much! I have made now a function called ssoLogin() and place the hook inside /site/ready.php: function ssoLogin() { if(!wire('user')->isLoggedin()) { $token = wire('input')->get('token'); // If not token, show error? try { $decoded = JWT::decode($token, wire('modules')->RestApi->jwtSecret, array('HS256')); } catch (\Exception $e) { // Error parsing/decoding token - do not accept. Show error/redirect. } // print_r($decoded); // Find user based on supplied email. // Use other PW user fields or properties from JWT as necessary. $u = wire('users')->get('email=' . wire('sanitizer')->selectorValue($decoded->claims->email)); if ( ! $u->id) { // Could not find user - don't exist. // Could create them at this point, if you have enough detail in the JWT to do so. } // Force user login return wire('session')->forceLogin($u); } return false; } // Inside /site/ready.php $this->addHookAfter('PageRender::renderPage', function(HookEvent $event) { if (strpos($_SERVER['REQUEST_URI'], $this->wire('config')->urls->admin) === 0 || $this->wire('page')->template->name == 'admin') return; ssoLogin(); }); KR Orkun
  13. Hi @Craig A Rodway Thank you very much! I tested it and it works great. One question though, where would you place the code above? I placed it for the moment inside the _init.php because it is prepend for every template. KR Orkun
  14. Hi Guys We are trying to build a Login Mask (with Node.js) which should act as a single sign on for two websites. The first website is a angular project on firebase the other one is processwire. We are trying to achieve the project with JWTs (Json Web Tokens). My Question is how can I make a user be loggedin in processwire with a JWT? Has someone experiences with this?
  15. Hi @thomasaull As you can see in the second & third screenshot above, I am already setting it in Postman. But perhaps I could try it with a js file localy. Another question. How would you save the JWT Token after you have get it from the /api/auth endpoint? Cookie? Local Storage? DB? I mean after I got the JWT Token i need to set it for every other API Request inside the Header and for that I need to somehow save it somewhere, am I right? KR Orkun
×
×
  • Create New...