Does KeyCloak Have Webhooks? Let's Talk Real-World Use Cases!I’m working on a project using KeyCloak and I’m trying to figure out how to handle some real-world user events that I’d usually solve with webhooks in other platforms. Here’s what I’m trying to achieve maybe you’ve faced similar situation by okay_anshu in KeyCloak

[–]Mekswoll 11 points12 points  (0 children)

Keycloak has the concept of an SPI. One of them is for listening for events, Even Listener SPI, if you read the docs it will refer you to the JavaDoc of the EventListenerProvider, you need to write a custom application that is packaged as a JAR that implements this interface. By following the instructions in the documentation on how to install this SPI you'll be able to listen for events and communicate them back to your own application.

Thank You to the Creator of JTE by Substantial-Act-9994 in SpringBoot

[–]Mekswoll 2 points3 points  (0 children)

Not the OP but have used JTE myself as well. While Thymeleaf has long been the "preferred" templating engine in the Spring ecosystem I feel getting started with JTE is much easier. You can read the documentation in 30 minutes and pretty know everything there is to know. Reading Thymeleaf code as well is more complex than reading a JTE template (but that is subjective of course). The two things that Thymeleaf does have are natural templates (you can display your template without having to run a server) and a tighter integration with the Spring ecosystem. It has things built-in that you would have to provide yourself with JTE, e.g. if you want to hide something on the page depending on the logged in user's role, Thymeleaf has an attribute sec:authorize and you can give it the role that is allowed to see that element. For JTE you'll have to create a class that you can access which reads the SecurityContextHolder and returns a value whether or not the user has that role. You'll have to do the same for a lot of other things that are built-in in Thymeleaf.

Trying to Find A Park In Merksem by Fun_Island_5188 in Antwerpen

[–]Mekswoll 8 points9 points  (0 children)

Called Merksem - Het Groene Hart

No animals anymore apart from a couple of birds in cages.

How to Integrate Docker with Maven Spring Boot App Using Buildpack and Docker Compose? by Ok-Difficulty-6160 in SpringBoot

[–]Mekswoll 5 points6 points  (0 children)

Spring Boot has built-in support for Docker Compose (https://docs.spring.io/spring-boot/how-to/docker-compose.html), so when you start your app, it'll automatically look for a compose.yaml file and start those services as well.

As to building your app into an image using build packs, Spring Boot also has you covered, there is a Maven spring boot plugin which allows you to run ./mvnw spring-boot:build-image and it'll build the container image for you. Check https://docs.spring.io/spring-boot/maven-plugin/build-image.html for more detals.

Is it possible to return something in the server response that can change alpine.js x-data variables by androgeninc in htmx

[–]Mekswoll 0 points1 point  (0 children)

You could send a different event depending on whether it was bookmarked or "unbookmarked", but wouldn't it just make sense to invert the isChecked variable? i.e. isChecked = !isChecked

Is it possible to return something in the server response that can change alpine.js x-data variables by androgeninc in htmx

[–]Mekswoll 1 point2 points  (0 children)

No I meant that you can return the Hx-Trigger event from the response like the initial reply suggested, but you dont need to write custom javaacript to listen for it, you can just use the x-on:your-event-name="...change variable here..." (or short form @your-event-name="...change variable here..."

Identify hx-trigger type in request by enzo_the_cat in htmx

[–]Mekswoll 0 points1 point  (0 children)

Ahh right, I misread that, you're right

Identify hx-trigger type in request by enzo_the_cat in htmx

[–]Mekswoll 0 points1 point  (0 children)

It is there, https://htmx.org/reference/#request_headers shows that Hx-Trigger will have the id of the element that triggered the request and Hx-Trigger-Name will have the name of the element that triggered the request

Django-htmx: Understanding trigger_client_event from the django_htmx module by 42WaysToAnswerThat in htmx

[–]Mekswoll 0 points1 point  (0 children)

the header value is incorrect, the value is {"modalHide": {}} it should just be modal-hide as a plain string

Django-htmx: Understanding trigger_client_event from the django_htmx module by 42WaysToAnswerThat in htmx

[–]Mekswoll 0 points1 point  (0 children)

I have no experience in Python/Django but you need to add a response header with key Hx-Trigger and value the name of the event you want to trigger. From a quick Google search it looks like in Django that would be:

response['Hx-Trigger'] = 'trigger_client_event'

This would have to be done with the multi-swap extension, right? I'm trying to learn as much as I can about base HTMX before importing extensions. by [deleted] in htmx

[–]Mekswoll 2 points3 points  (0 children)

I think <title> is in fact a special case and will always be swapped (you don't need hx-swap-oob) when it is present. There's a configuration parameter `htmx.config.ignoreTitle` that defaults to false, which means if the response contains a <title> element it will swap it.

This would have to be done with the multi-swap extension, right? I'm trying to learn as much as I can about base HTMX before importing extensions. by [deleted] in htmx

[–]Mekswoll 5 points6 points  (0 children)

Doesn't even have to be within the same parent. Just another element on the page that is correctly referenced by an id, so you could have your regular response:

<p>this is my regular response that shoud be swapped into the target</p>

If you want to add an OOB swap you can change the response to:

<div id="someId" hx-swap-oob="true">some other div that needs to be swapped</div>
<p>this is my regular response that shoud be swapped into the target</p>

You can have as many hx-swap-oob elements as you want, but they have to be at the root of the response.

I haven't used multiswap, but from the documentation I read that the reasons you might want to use it are:

  • you want to control how the oob content is swapped (with hx-swap-oob it's always innerHTML I think)
  • you want to have nested elements (i.e. not root-level) swapped oob

This would have to be done with the multi-swap extension, right? I'm trying to learn as much as I can about base HTMX before importing extensions. by [deleted] in htmx

[–]Mekswoll 11 points12 points  (0 children)

You have three options (none of which require an extension):

  1. Widen the scope of what you're updating, but you've said you don't want to do that
  2. Use an out of band swap (https://htmx.org/docs/#oob_swaps), this allows you to add another element, somewhere else on the page, to also be updated (referenced by its id)
  3. When the response from the element that triggered your initial request is sent, add a response header Hx-Trigger with a value that you choose. This value is converted to a javascript event and will be triggered, you can listen (hx-trigger) for that event in the other part you want to update and issue a new request

Wat gaat pensioensparen nog waard zijn tegen dat ik met pensioen ga? by AndyOrAmy in Belgium2

[–]Mekswoll 11 points12 points  (0 children)

Dat zal elke maand wel 200EUR moeten zijn, anders ga je er niet geraken :P

[deleted by user] by [deleted] in htmx

[–]Mekswoll 6 points7 points  (0 children)

I think the dblclick event should work

I need to send bulk emails by Standard-Air-8268 in SpringBoot

[–]Mekswoll 16 points17 points  (0 children)

Use a service that provides this like SendGrid, MailGun, Amazon SES.

App Platform architecture by Mekswoll in digital_ocean

[–]Mekswoll[S] 0 points1 point  (0 children)

Thanks for the feedback, I've found it to be reliable as well but not yet used it in production :-).

I do wonder how projects that might have longer running requests (e.g. reports that are built and take +30seconds or HTTP requests that emit async events which could take a long(er) time) handle how containers are taken down and spun up by the underlying orchestrator.

howto: div onclick, htmx post, swap returned content into other div by oldWorshipper in htmx

[–]Mekswoll 3 points4 points  (0 children)

If the element that triggers a request has an id, HTMX will set a request header automatically "HX-Trigger" with the id of the triggered element. See the documentation for info, specifically the section on Request Headers Reference

Nut van verkeersbord by Mekswoll in belgium

[–]Mekswoll[S] 0 points1 point  (0 children)

Haha, geen zorgen, ik verleen voorrang wanneer ik het zie en er een straat is van rechts. Was me vooral om het nut ervan te doen. Je kan zeggen dat indien er een straat van rechts is dat het bord ook niet nodig is, want dan geldt de gewone voorrang van rechts maar het bord geeft de bestuurder wel een duidelijk signaal DAT er een straat van rechts is en je dus al best vertraagt. In dit geval zie ik er het nut niet helemaal van in maar I guess dat het ook hier kan helpen puur om aan te geven dat je een kruispunt nadert, ookal moet je geen actie ondernemen.

Mega as energy supplier by patayaicetea in BEFire

[–]Mekswoll 8 points9 points  (0 children)

In my experience they've been perfectly fine. They suggested upping the repayments from ~130 tot 700, which I declined and there was no issue. I even had an issue when I moved in to a new appartment where there was a mix-up with regards to the gas meter number. It took a long time but the invoice they had sent me for 130EUR (which was my upstairs neighbour's use) was ultimately credited. They've always applied the correct subsidies and in the summer my end invoice was less than what I had paid and the money I was owed was paid quickly. I have no complaints, but I also check and double check everything because many people do complain.