Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by flydev

  1. @Sara Which module was the culprit?
  2. // init.php $wire->addHook('/webhook', function ($event) { // http_response_code(403); // or header('HTTP/1.1 403 Forbidden', true, 403); // no exit, apply server logic $event->return = true; }); // ready.php $wire->addHook('/webhook', function ($event) { $this->log->save('webhook', $event->return); // exit(); }); C:\Users\flydev>curl -I -L --insecure https://xx-xx-xx-xx.ngrok.app/webhook HTTP/1.1 403 Forbidden Alt-Svc: h3=":443"; ma=2592000 Cache-Control: no-store, no-cache, must-revalidate Cache-Status: Souin; fwd=uri-miss; key=https-/webhook--; detail=UNCACHEABLE-STATUS-CODE Content-Length: 0 Content-Type: text/html; charset=utf-8 Date: Thu, 27 Apr 2023 14:59:36 GMT Expires: Thu, 19 Nov 1981 08:52:00 GMT Ngrok-Trace-Id: b2213e4460d4a73821ac2041f312d8d9 Pragma: no-cache Server: Caddy Set-Cookie: wires=s106arh77i4f9ot1jeh7bvged6; path=/; secure; HttpOnly; SameSite=Lax Status: 403 Forbidden X-Powered-By: ProcessWire CMS Reverse output: Connections ttl opn rt1 rt5 p50 p90 15 0 0.01 0.02 90.35 151.65 HTTP Requests ------------- HEAD /webhook 403 Forbidden GET /webhook 403 Forbidden Tracy dump: ProcessWire\HookEvent data: array 'object' => ProcessWire\ProcessPageView 'method' => 'pathHooks' 'arguments' => array 0 => '/webhook' 1 => true 'path' => '/webhook' 'return' => true <=== $event->return 'replace' => false 'options' => array 'id' => 'ProcessPageView:100.0:pathHooks' 'cancelHooks' => false 'when' => 'after'
  3. Steve, I just tested pusher webhook with a URL Hook, I can get the 403 error code, and the $event->return as true from a chained hook. The 403 code is thrown with header('HTTP/1.1 403 Forbidden', true, 403); I am forcing params as it could be interpreted differently on web-server basis. Tested on pw 3.0.199-dev.
  4. Hi, it seem to me that the issue is the strategy used to generate the static page, but I can be wrong, could you elaborate a bit more ? It is required to build the static page on the save page event, and by an user ? What about, for example, if in the backend you set a template which serve as a sort of configuration and when saving the page, a background process is throwed ? From which type of server the generation of static pages are done ?
  5. Just finished to watch it! Great job @bernhard πŸ‘πŸ‘πŸ‘πŸ‘
  6. HTMX is not listed because HTMX is a different tool and do not require ViteJS which is a build tool and development server that focuses on providing a fast development experience using features like native ES modules, hot module replacement, and optimized production builds, and if it was, you could say I am quite confused. But I can say they can be used together in certain scenarios and we could start another thread with constructives and interestings discussions, sharing each other experiences. It's really about how you use ProcessWire, and differents topics, like flexibility, complexity and requirements of what you need to build the final product. I really understand why a developer take the way of HTMX's for a simple and dynamic website or even web-app without the need for JavaScript frameworks, it's not new, we used ajax 20 years ago, it's funny. To give an example of why I am personally using a frameworks like Svelte, and ViteJS to build the thing, is that I need to consume JSON data and not HTML fragment to interact with other native apps. And in a complex scenario, the benefits of Svelte's component-based architecture, reactive programming model, and offline capabilities outweigh the simplicity offered by HTMX. Again, this is really a question of requirements more than anything else. Another little example, if was using HTMX in my pages written in Pascal, this will quickly turns into a huge mess. What I could add as a bonus for HTMX, it will level up the level of frontends devs on a team. All that said, HTMX is out of topic here πŸ™‚ πŸ™‚
  7. Just adding that if you use a fallback operator in your selectors like `~|=` the last three tests in your code should get a result.
  8. It seem the field doesn't take care of that by default, but you can display the same fields/format by selectionning `Custom format` on the `Label fields` setting and applying the `Custom page label format` value. A hook is certainly possible and would be more versatile, it depend on how your are using the field ref.
  9. @Ivan Gretsky do you mean to have vite / tailwindcss working on dev setup and generate your tailwindcss theme files to be used on prod ? If yes, that's not a problem and I can make you an example. If not, please explain what you mean by "have vite as a standalone executable" , I don't get it πŸ™‚ ps: The setup shown on the initial post use TailwindCSS.
  10. Ignoring it. Optionally reporting it on github issue. It's just a deprecation warning, not an error.
  11. There are some vote on this, please say more, which one ? πŸ˜‚
  12. A bit late to the party. It happened to me years ago and I can remember it was an issue with DNS. You don't give lot of details, but you can try the following: adding your hostname in the hosts system file Open a terminal, and: get your hostname > type `hostname` and take a note of the result add it to your hosts file > type `sudo nano /etc/hosts` and add the following localhost YourHostname.local ::1 localhost YourHostname.local 3. Clear the DNS cache > type `sudo killall -HUP mDNSResponder;say DNS cache flushed` Now, test your backend.
  13. Short answer as I'm slumped on the couch. It seem you already read the structure documentation page and got the idea. About explaining the concept to the client, just use a real analogy. For example, think of a website as a book. In a book, you have chapters, sections, and pages. Similarly, a website is organized into sections, and each section contains individual pages that hold different pieces of content. In ProcessWire, a "page" is a container that holds all the data and content for a specific part of your website. It's not limited to what you see on the front-end as a traditional webpage. Instead, a page in ProcessWire can represent various types of content or data, such as blog posts, products, images, or contact forms. Once that said, and once you got the Β« Wow this is flexible! Β» then you can go further and say that using this tool (some of us call it a framework more than a simple CMS) allow you to build other types of applications than a website. I mean no frontend, no colors, no (web)Pages. You can find somes use case threads arround the forum. Ask for more. Just adding that once your clients become familiar with the page-based concept and the benefits of it, they will find it easier to manage their website content. Enjoy πŸ‘Œ
  14. Hi, I had integrated ViteJS a year ago or a bit more, it could be used to build for example a dashboard, or even a website, but the main issue I faced was to make Server Side Rendering working with all the setup to be able to get better SEO/ranking. That's said, SSR code was done this morning πŸŽ‰πŸŽ‰ The test below was made on a non optimized Caddy setup on Windows with sad php-fpm. I built a javascript package which will be published on NPM to give you a smooth experience to integrate Vite into ProcessWire. I have to build a ProcessWire module to make thing even easier instead of putting some file in our template dir, that will be made asap as it doesn't require lot of work. It's also shipped with InertiaJS which I find no point of not using it, but could be used without it. Everything can work with Svelte Framework (I am a big fan of it, I feel like coding web on the 2k years), React work also, and Vue should work without hassle as any other frameworks/libraries. Just saying, but his one I think will not be much of interest for you, I also built a solution which replace Electron for building desktop application based on native code (Pascal) and JavaScript bindings, where ProcessWire is used as headless cms (I think I had already spoke about it in some threads), it could be used as is without the need to put your hand in native code. I'm curious to hear what others in the ProcessWire community think about using ViteJS for your development. Have you tried it before? What has your experience been like? Please share your thoughts and feedback in the comments, and feel free to vote in the poll below to let me know if you're interested in more tutorials and resources on this topic, like profiles, themes. And pheww, I am quite happy! πŸ₯·
  15. In any case, it has not stopped since 2020, it is rather worse. Time to put a captcha thing maybe.
  16. Another option could be copy/paste the core ProcessModule inside site/module (it could be patched on ProcessWire version upgrade, if needed, automatically). Maybe @Robin S will have a clearer idea.
  17. Make sure: in myTemplate settings>URLs you Allow URL Segments then // decomposed example $title = $input->urlSegment1; // single $ref = $pages->get("template=myTemplate, title=$title"); // get retrieve a single result $pageList = $pages->find("template=myTemplate, prfield=$ref"); // or if many is needed $refs = $pages->find("template=myTemplate, title=$title|Foo|Bar"); // find retrieve a page array $pageList = $pages->find("template=myTemplate, prfield=$refs");
  18. Give a read to this Ryan 2012 answer. Then, a good habit in pw, is to just read his clear and concise comments on the source code, easy as .. Do not hesitate to ask for help if needed. Documentation: https://processwire.com/api/ref/wire-database-p-d-o/
  19. A friend of mine has changed his job, he owns a video game room, he now "develops" websites, I could see a result, and the tools used, I prefer to keep quiet here (it's in the title). I have to interfere in his conversion process before it's too late: Have the right habits, keep in mind that the goal is to help the client to improve the conversion of his business through his website, and thus to make more money rather than losing it. Otherwise, what's the point, an instagram or facebook page would have been enough. So I wanted to make a synthesis of the arguments to make him take into account, I also saw an old forum thread that came up recently, so I wanted to ask a neutral "person" (person.. lol) what she think. I have the impression that the arguments are those already exposed in the answers given to these threads. In short, a good synthesis, I think, and non-biased, I hope. As always, the same question, "How to convince my client to use Processwire instead Wordpress?" Yours sincerely, GPT πŸ€–
  20. PHP as there is no HTML file to lookup anymore, use ncm2 and php-actor plugins. But, as a small advice (I am a nano guy, you know it, real programmers use nano lol), do yourself a second favor, try VSCode, optionally install the VIM theme πŸ˜‚
  21. Welcome, I see you already got gud answers, and I like to put as always what made me understand ProcessWire on first start. https://youtube.com/watch?v=IHqnLQy9R1A There is one or two more vid to see. Then there on the forum is a lot of good threads. I am on mobile so I give you the oldest but still βœ… to follow, quite a gold post for beginners : https://processwire.com/talk/topic/4173-grouped-forum-posts-links-articles-tutorials-code-snippets/ Forgot to add something you should also consider giving a look - page-grid - https://weekly.pw/issue/454/ Enjoy πŸ™‚
  22. @SebastianP if you really need the module, you can try to check xhr (I can't confirm the behavior..): if (!$this->config->ajax) { // add this if(in_array('View', $this->hiddenTabs)) { $event->return .= ' <script> $(document).ready(function() { $("#_ProcessPageEditViewDropdown").remove(); }); </script>'; } } // <-- add this https://github.com/adrianbj/RestrictTabView/blob/88bbee5a1fbf9a52e16df8573c0a243ee9feca97/RestrictTabView.module.php#L72-L79
  23. Hi, we need more details. Modules, Version, logs, etc. Essentially this sort of issue arise when html markup is returned before the JSON result expected, then the xhr fail. My bet is that you have a hook somewhere, do you have something related in ready.php or _init.php or admin.php ?
  24. Hello, A simple way, by code, could be to redirect the user if the page is hidden. In the page's settings set the status `hidden` and then in the template(s) you can do: <?php namespace ProcessWire; // Template file for pages using the β€œbasic-page” template // the code below is an example of how to check if a page is hidden or unpublished // and redirect to the homepage if it's the case. // (/? hint > the check use a bitwise OR operator) if ($page->is(Page::statusHidden | Page::statusUnpublished)) { $session->redirect($pages->get('/')->url); // redirect the user } ?> <div id="content"> Contact or Company page </div> Another simple way, using template's settings, is to remove the view access of the guest role, see :
  • Create New...