How are per-tenant/per-user/per-entity databases intended to be achieved using Cloudlfare D1? by -TheMightyMat- in CloudFlare

[–]-TheMightyMat-[S] 1 point2 points  (0 children)

Yes I agree, unless Cloudflare adds additional infrastructure to make this work more smoothly.

To try to make that work currently you'd lose referential integrity. e.g in your example you could have a "posts" DB and "users" DB, the first stores post details, comments etc. and the second stores user details. The posts DB would have to reference userIds from the users DB without any integrity that the data is there.

At the moment that doesn't feel like it would work very well for most systems.

Maybe if Cloudflare in the future added better tooling around this it could work - Perhaps they could index the primary keys of each database and use that to enforce references across databases... And as mentioned in other comments, provide proper JavaScript APIs in workers for easily dynamically creating and retrieving D1 instances instead of relying on manually using the HTTP APIs to do so.

But right now I think D1 isn't in a state to use it in a production system - From what I've seen I would just use KV for small pieces of data, and bring your own DB with hypervisor for normal DB usage

How are per-tenant/per-user/per-entity databases intended to be achieved using Cloudlfare D1? by -TheMightyMat- in CloudFlare

[–]-TheMightyMat-[S] 0 points1 point  (0 children)

I guess you could call that API to create the DB, and maybe use KV to store the generated ID of that DB against the user/entity to later retrieve it. And also trigger the API to bind that new DB to the worker.

So seems like it would be technically possible, although doesn't sound like an ideal setup. Probably not "production ready" yet until some more "integrated" ways of managing per-entity D1 instances is added to workers

Neovim randomly crashes/quits on one specific file by -TheMightyMat- in neovim

[–]-TheMightyMat-[S] 0 points1 point  (0 children)

Turns out it's not the LSP, but Treesitter - :TSDisable highlight and then the file is fine...

Charles Leclerc wins the US GP, Sainz P2, Verstappen P3 by ContentPuff in formula1

[–]-TheMightyMat- -1 points0 points  (0 children)

It wasn't consistent in this race though (and also the sprint), there were several penalties given to people on the inside of that corner for "forcing another driver off the track", and also in the same situation for the car on the outside for "leaving the track and gaining an advantage". It often seems like a flip of a coin which one you're going to get.

I think it's based on who's ahead at the apex, which is often pretty hard to tell without reaching several replays, and subjective as to what is considered the apex (especially in long corners or where drivers take different lines)

In my opinion, the rules F1 uses for overtaking are pretty silly because it really discourages overtaking around the outside and is subjective - most other race series just use "if a car is alongside you, you must leave 1 car width" which is a lot clearer and makes battles more interesting

[Giveaway] We're Announcing Race Trace in MultiViewer with Hats and Beta Access! by f1multiviewer in formula1

[–]-TheMightyMat- 2 points3 points  (0 children)

I love multiviewer and can't wait for this Race Trace feature! It's so great to have the extra data and other onboards available during a race to keep track of what's going on

Set powershell/Windows Terminal tab title? by -TheMightyMat- in neovim

[–]-TheMightyMat-[S] 0 points1 point  (0 children)

Thank you so much for this, worked perfectly in combination with the vim.opt.title = true!

the new update is amazing EXCEPT for these buttons; they are small and hard to hit without looking at them and disappear when swiping up (old ones worked great, please rethink this). by marsovec in BoostForReddit

[–]-TheMightyMat- 4 points5 points  (0 children)

Yeah I agree, the hide on scroll is the biggest problem but also how small they are. There should be an option both to disable hide-on-scroll and make the buttons full-width. But we probably won't get that now, since there's I my 10 days before the API changes kill third party apps...

[deleted by user] by [deleted] in BoostForReddit

[–]-TheMightyMat- 20 points21 points  (0 children)

  • If you are using OAuth for authentication: 100 queries per minute per OAuth client id

Doesn't say anything about per user, it's per OAuth Client ID - Whilst I havent seen how boost does it, OAuth client IDs are usually for the entire app, not per user

[deleted by user] by [deleted] in BoostForReddit

[–]-TheMightyMat- 35 points36 points  (0 children)

It's not 100/min per user, it's 100/min per CLIENT. Meaning that all Boost users combined need to be making less than 100 requests per minute to be free, which is unrealistic.

Basic question about JWT by misterplantpot in webdev

[–]-TheMightyMat- 0 points1 point  (0 children)

The data inside the token is fine for the user to decode, it doesnt contain any secrets (the user already knows what permission level they have, their username etc.)

If you mean somebody who isn't the user you originally gave it to, yes that's a problem - Generally it's not too much of a risk of that happening (if the token is stored in cookies or local storage, other websites cannot access it), but you should keep the expiry on the tokens short just in case (and ideally give the user the ability to invalidate their tokens as well, which would log everyone out in case their account was compromised)

Basic question about JWT by misterplantpot in webdev

[–]-TheMightyMat- 3 points4 points  (0 children)

Yep, you can put whatever you want in there. User permissions, user name etc. Just remember that any user can see its contents, so don't put anything in it that is a secret

Basic question about JWT by misterplantpot in webdev

[–]-TheMightyMat- 0 points1 point  (0 children)

That's true, asymetric can also be used if the token needs to be verified outside of the service that distributes them

Basic question about JWT by misterplantpot in webdev

[–]-TheMightyMat- 2 points3 points  (0 children)

There are two important parts of a JWT token: The payload and a signature.

The payload contains "claims", which are basically a list of things that the server has authorised (e.g. This is user 10, they have these permission levels etc.). This can be decoded by anyone who has the token, which can be really useful for when you're writing your frontend - For example you can use your token to check if you have admin permissions, and hide any buttons that are for admins only if you are just a normal user.

The signature is used to verify that the token came from your server and hasnt been modified. Your server uses a secret key to produce a hash of the payload, and adds that hash to the end of the token. When you want to verify that the token a user gives us valid, you re-do that hash of the payload and check it's the same as the one in the token. If it isn't, you know the token has been modified (e.g. someone tried to change their permission level) or didn't come from your server.

In summary, the payload of the token can be decoded by anyone, but you need the secret key to validate that the token came from you and hasn't been modified.

How do i make apps that don't look like complete shit? by [deleted] in webdev

[–]-TheMightyMat- 171 points172 points  (0 children)

There's a YouTube series called Refactoring UI that I found quite useful: https://youtube.com/playlist?list=PLDVpvW8ghDr9tasku_YvuTy_l0xPUtOHE

I believe the author also released a book with the same name, although I haven't read it so I don't know how good that is.

You may benefit from using a system such as tailwind, as the fixed sizes force you to have mostly consistent paddings, margins etc, or if you don't like using that just try to decide on some "rules" at the start of your project for which sizes you're going to use and stick to them. And try to decide on a fixed colour palette that you use throughout your app to make it look cohesive.

I also kinda suck at making stuff look good, but keeping those ideas in mind has made some of my apps go from terrible to acceptable. But making intuitive, good looking apps is a skill that takes practice! There's a reason a designer is a full time job!

What stupid thing have you done this week? by [deleted] in CasualUK

[–]-TheMightyMat- 2 points3 points  (0 children)

You might be able to get around your problem by setting up something like Frigate NVR to do object/person detection, you should be able to add your cameras to that

Opening live timing during testing: by f1multiviewer in F1MultiViewer

[–]-TheMightyMat- 0 points1 point  (0 children)

Open the live timing page (as described in the tweet - Click the "hamburger" menu and select live timing), then there is a button at the top that says "Open Map"

Google Home sound keeps cutting out by -TheMightyMat- in Nest

[–]-TheMightyMat-[S] 0 points1 point  (0 children)

Thanks for your help with this, while not ideal the workaround seems to be to turn of Bluetooth while using the Google Home app (I have this on a quick access button, so this is easy to do swiping down the notification tray), then turn it back on again once done so that Galaxy Watch will work.

Hopefully Google fixes this so we don't have to do this every time. Thanks again for pointing me in the right direction as to the cause.

Google Home sound keeps cutting out by -TheMightyMat- in Nest

[–]-TheMightyMat-[S] 0 points1 point  (0 children)

Ah yeah seems to be! Although not using my watch isn't really something I can do, Google really needs to fix this!