urania-dev / snapp

Yet Another Url Shortner. A simple excercise to learn Svelte.
https://snapp.li
MIT License
173 stars 9 forks source link

[Feature Request] Improvement of existing features and some new stuff #13

Closed Hutch79 closed 7 months ago

Hutch79 commented 8 months ago

Whitelist options for short URL domains and mail-domains

Currently, there is a black list option Domain, Usernames and Emails. The Email section also provides a way to blacklist a whole mail domain, e.g. @gmail.com.
My suggestion would be to add the possibility of a whitelist item.

This could be useful for organizations with their own mail domain to allow their employees to sign up by them self with their work email. Others couldn't sign up, because their email domain is not whitelisted.


Short URL ~ removal

Currently, if you generate a short URL and want to use it, there's always the ~ symbol in the URL.
While copy pasting this is no problem, but if you remembered it, it's kinda annoying always remembering and typing this.

Therefore, I would suggest the addition of short URL's without that symbol. This way, links from an older version would still be compatible with newer versions.


Limit max amount of short URLs per user

The possibility to limit the amount of short URL's a user can create.


Deactivation of URLs

A way to deactivate the URL instead of deleting it. A possible use case is listed below.


Short URL Access Limit

Option to set a Limited amount of accesses. Example: The Limit is set to 10, so it can be accessed 10 times. After that limit, the URL gets deactivated


Snapp Version visible in Admin Settings

Mainly useful for debugging



Since the last update (0.6 & 0.6.1) Snapp just got so much better, and it already was great before! Btw. I was stunned to see how fast the 0.6 update got released! I don't know if you noticed it, but you even got an article on Noted.lol.

I previously used another Shortener which also worked, but Snapp just feels Snappier (badum zzzzz). It's fast, beautiful, feature rich and easy to set up and use. Thank you for the great work!

urania-dev commented 8 months ago

Thank you very much, i'll look into it and reply appropriately per points in the next few days :)

Meanwhile, yeah I noticed a couple of guides and how-to's on Snapp, I want to update readme and homepage with a featured list next version, i already have a 0.6.2 ready, that includes exports in csv for own and others links, i'll enrich the version with this edits, if i can, and with that we can think of a roadmap to version 1 i suppose.

This project is born as a simple selfhostable project, so i don't want to increase the complexity too much in order to be able to maintain it on my own as a side project.

That said, all requests seems acceptable. so i'll keep you posted!

Hutch79 commented 8 months ago

One Addition:

i18n translatable

The sooner, the easier it is ^^' I would be happy to help translate Snapp to German.

urania-dev commented 8 months ago

Here we go:

Whitelist options for short URL domains and mail-domains

Currently, there is a black list option Domain, Usernames and Emails. The Email section also provides a way to blacklist a whole mail domain, e.g. @gmail.com. My suggestion would be to add the possibility of a whitelist item. This could be useful for organizations with their own mail domain to allow their employees to sign up by them self with their work email. Others couldn't sign up, because their email domain is not whitelisted.

Can do, i should be able to add a regex rule just like @@ to ban, change the name from blacklist to generic list and add options to ban with @@ and whitelist with anoter symbol. would hazard a +@@ and -@@ but start to seem hyerogliphic and not UX, let me think about it.

i also think there is room for improvements as the script as it is worry me about a couple of things, so maybe a little rework of the ban list is due.

Short URL ~ removal

Currently, if you generate a short URL and want to use it, there's always the ~ symbol in the URL. While copy pasting this is no problem, but if you remembered it, it's kinda annoying always remembering and typing this Therefore, I would suggest the addition of short URL's without that symbol. This way, links from an older version would still be compatible with newer versions.

This should be easily retroactive as the urls are saved as only the shortcode, the tilde in embedded in svelte page (link tag has href="/~/[short_code]" structure, so it is easy going. i'll just need to keep /~ route for legacy, and instantiate a new endpoint. would still use a prefix in order to disambiguate from internal routes /dashboard and co. SvelteKit route should be able to recognize the difference itself, but i prefere to not present the opportunity for something to just break without a reason :)

this way both the urls will be working /~/some-shortcode /{prefix}/some-shortcode

any suggestion? /s/ as in snapp? /r as in redirect? /_ underscore?

Theoretically speaking, that would be also possible by checking the subdomain, example go.snapp.li/shortcode but it would increase complexity in setup, traefik / dns, dockers and stuff. not so sure anymore about it (thou i like the idea behind). I would prefere to keep it simple, so anybody can access it avoiding too much difficulty.

Limit max amount of short URLs per user

The possibility to limit the amount of short URL's a user can create.

on a user basis? (like a subscription tier?) or for all the users alltogether?

Deactivation of URLs

A way to deactivate the URL instead of deleting it. A possible use case is listed below.

banishing will do exactly this, but with blacklisted status, at the moment. i think can set a checkbox in edit post from admin and user pov to just disable it.

Short URL Access Limit

Option to set a Limited amount of accesses. Example: The Limit is set to 10, so it can be accessed 10 times. After that limit, the URL gets deactivated

as above, can set a limit on url basis, that should be a problem

Snapp Version visible in Admin Settings

Mainly useful for debugging

Since the last update (0.6 & 0.6.1) Snapp just got so much better, and it already was great before! Btw. I was stunned to see how fast the 0.6 update got released! I don't know if you noticed it, but you even got an article on Noted.lol.

yea i thought about that the moment i downloaded it for private instance from dockerhub, i would like a version on FE too to understand what i'm doing.

i18n translatable

The sooner, the easier it is ^^' I would be happy to help translate Snapp to German.

To be fair, another project i'm trying to build from zero has a i18n setup that i grasped from the web which i find myself comfortable with. it kind of reminds me the times from wordpress' _('string','key') but with svelte flavour on it. It would require some time but it shouldn't be a problem.

I previously used another Shortener which also worked, but Snapp just feels Snappier (badum zzzzz). It's fast, beautiful, feature rich and easy to set up and use. Thank you for the great work!

Really thank you :)

I always wondered how there are so many tutorials about to-do's app and shortener but actually so few good choices in selfhosting šŸ¤£

a little note.

there are some edits that could actually be deemed major changes for the database, 0.6.1 already has csv export (i previously wrote 0.6.2 but the csv were already available). in case of major breaking of the database, or reworks here and there that would require a redo of the db, it should be theoretically be possible to export the urls already (and for example leave snapp alltogether) but also just export them and then reimport them in the new version. this way i could actually be more considerate about the migration (without involving cli, sql migration from docker launch and stuff like that). i think this could be the best way, but as always, i'm mostly here to learn, so i'm open to suggestions

minor consideration about tabler.

it works, and for what i needed to test it, it works. I just don't know if keeping it, or redo the entire project with a more dedicated ui / ux. this could be a next step after the implementation of this features. (as mainly all of this is backend operations, those i can migrate with ease) (edit, also this could help me fix that annoying issue of copy-link not working for some users)

Hutch79 commented 8 months ago

Whitelist options for short URL domains and mail-domains

Can do, i should be able to add a regex rule just like @@ to ban, change the name from blacklist to generic list and add options to ban with @@ and whitelist with anoter symbol. would hazard a +@@ and -@@ but start to seem hyerogliphic and not UX, let me think about it.

To be honest, till now I thought the double @ was a typo, and it only needs one @.... ^^' Maybe there is a way to rethink/redesigne this, e.g. a popup to add an element where you can click checkboxes or use a dropdown.


Short URL ~ removal

i'll just need to keep /~ route for legacy, and instantiate a new endpoint.

šŸ‘

would still use a prefix in order to disambiguate from internal routes /dashboard and co. SvelteKit route should be able to recognize the difference itself, but i prefere to not present the opportunity for something to just break without a reason :)

I get the "better save than sorry" approach, but it adds a level of unease when typing a shorted url. My suggestion would be to move all the admin and user sites to e.g. /dashboard/xyz and block any short URL of using dashboard as shortcode.

Theoretically speaking, that would be also possible by checking the subdomain, example go.snapp.li/shortcode

Interesting idea, but if implemented, I would use the root domain for short URLs and the subdomain for management ^^ But I agree with you, it's a new level of complexity which would benefit a minority of users. The /dashboard/xyz would be my preferred solution.


Limit max amount of short URLs per user

on a user basis? (like a subscription tier?) or for all the users alltogether?

Yeah, on a per-user basis. I don't want to sell access or anything, but if I give access to my instance, I'd like to control how many links they can create. Although I must admit, it is a feature which is nice to have and in no way a must-have! Probably just me wanting control ^^'


Deactivation of URLs

banishing will do exactly this, but with blacklisted status, at the moment. i think can set a checkbox in edit post from admin and user pov to just disable it.

Maybe a toggle in the Actions dropdown? And if disabled, you could strike through the shortcode and make it Italic?

I think the blacklist is no real alternative for a disable because if multiple users have a shortcode to the same domain or even the exact same page, it would disable all of them.


Short URL Access Limit

as above, can set a limit on url basis, that should be a problem

Should or Shouldn't? ^^


Snapp Version visible in Admin Settings

yea i thought about that the moment i downloaded it for private instance from dockerhub, i would like a version on FE too to understand what i'm doing.

What's FE?


i18n

It would require some time but it shouldn't be a problem

No hurry!


I always wondered how there are so many tutorials about to-do's app and shortener but actually so few good choices in selfhosting šŸ¤£

Tell me about it... I'm still in search of a good note-taking tool... I currently use Trilium which is nearly what I want, only thing missing is multi-user... Another app (Bookstack) would be nearly perfect as well, but it has no infinite nesting and the editor isn't as handy as Trilium ^^'


there are some edits that could actually be deemed major changes for the database, 0.6.1 already has csv export (i previously wrote 0.6.2 but the csv were already available). in case of major breaking of the database, or reworks here and there that would require a redo of the db, it should be theoretically be possible to export the urls already (and for example leave snapp alltogether) but also just export them and then reimport them in the new version. this way i could actually be more considerate about the migration (without involving cli, sql migration from docker launch and stuff like that). i think this could be the best way, but as always, i'm mostly here to learn, so i'm open to suggestions

I'm currently doing an Apprenticeship as a Software developer, and we're using a NuGet package (C#) which takes care of migrations. There's probably a project capable of doing this in Svelte or TS as well. Honestly, idk what kind of backend you're using, I only know C# as backend ^^'


minor consideration about tabler.

it works, and for what i needed to test it, it works. I just don't know if keeping it, or redo the entire project with a more dedicated ui / ux. this could be a next step after the implementation of this features. (as mainly all of this is backend operations, those i can migrate with ease) (edit, also this could help me fix that annoying issue of copy-link not working for some users)

You've already got an API, at least partial. It would be an effort to completely separate the front and backend and only communicate with the API, but it would drastically decrease the work for future UI reworks. Also, it would provide a way of using an independent UI if somebody wants to developed one. The main things missing in the API which I noticed on the spot would be the complete User management (e.g. registration, password resets) and retrieving statistics.


I feel tempted in looking at Svelte, but I first need to manage my Angular skills before I can look at something new... I'm still a beginner in web dev ^^ I'm learning a lot in just writing with you about Snap. You have thoughts and ideas I would never have imagined ^^

urania-dev commented 8 months ago

To be honest, till now I thought the double @ was a typo,

šŸ˜† me and my useless abstractions

My suggestion would be to move all the admin and user sites to e.g. /dashboard/xyz and block any short URL of using dashboard as shortcode.

this is actually a good idea. let's do this

But I agree with you, it's a new level of complexity which would benefit a minority of users. The /dashboard/xyz would be my preferred solution.

same as before :)

Limit max amount of short URLs per user

on a user basis? (like a subscription tier?) or for all the users alltogether? Yeah, on a per-user basis. I don't want to sell access or anything, but if I give access to my instance, I'd like to control how many links they can create. Although I must admit, it is a feature which is nice to have and in no way a must-have! Probably just me wanting control ^^'

No problem, even if you want to sell them is your right, i'm redestributing this as a "do what you want" basis, for what the MIT licences of what's integrated (tabler, maxmind, and stuff) allows. Let's don't forget about me if you get rich with this šŸ˜†

Deactivation of URLs

banishing will do exactly this, but with blacklisted status, at the moment. i think can set a checkbox in edit post from admin and user pov to just disable it. Maybe a toggle in the Actions dropdown? And if disabled, you could strike through the shortcode and make it Italic?

I think the "Disabled" Status could be enough, i'll maybe create a page like the 404 for the "disabled" or "expired" status

I think the blacklist is no real alternative for a disable because if multiple users have a shortcode to the same domain or even the exact same page, it would disable all of them.

no no of course, i was just saying that the only way to do this as per now, is via blacklist but as you say is not a solution

Short URL Access Limit

as above, can set a limit on url basis, that should be a problem

SHOULD NOT. sorry my bad.

Snapp Version visible in Admin Settings

yea i thought about that the moment i downloaded it for private instance from dockerhub, i would like a version on FE too to understand what i'm doing. What's FE?

FrontEnd, the actual interface the final user / admin will use

Tell me about it... I'm still in search of a good note-taking tool... I currently use Trilium which is nearly what I want, only thing missing is multi-user... Another app (Bookstack) would be nearly perfect as well, but it has no infinite nesting and the editor isn't as handy as Trilium ^^'

Let's finish this first, then we'll see šŸ¤”

I'm currently doing an Apprenticeship as a Software developer, and we're using a NuGet package (C#) which takes care of migrations. There's probably a project capable of doing this in Svelte or TS as well. Honestly, idk what kind of backend you're using, I only know C# as backend ^^'

yeah that's the point, i'm using none. The app is built on sveltekit, it allows control on ssr (node server.) I leveraged that on a embedded db.sqlite which in the end allows CRUD on a DB inacessible if not via local file (docker mount of a static sqlite file)

every function i need i have to map it via prisma or npm packages. Now it uses panda and prisma to retrieve rows from db and convert them on CSV

minor consideration about tabler. You've already got an API, at least partial. It would be an effort to completely separate the front and backend and only communicate with the API, but it would drastically decrease the work for future UI reworks. Also, it would provide a way of using an independent UI if somebody wants to developed one. The main things missing in the API which I noticed on the spot would be the complete User management (e.g. registration, password resets) and retrieving statistics.

Again this is my point, if i get the api first approach, maybe even decoupling from sveltekit i could theoretically do all the stuff you said. But it will require more understanding of the setup (or at least different images for different results. api / ui / aio api+ui

Allowing to create a UI, complete access via API, and so on are actually tempting....

I feel tempted in looking at Svelte, but I first need to manage my Angular skills before I can look at something new... I'm still a beginner in web dev ^^ I'm learning a lot in just writing with you about Snap. You have thoughts and ideas I would never have imagined ^^

I can't suggest anything else. I was a php / wordrpess / jquery dev. When people started using react i always found difficult to reimagine all my previous abstraction via virtual dom and all the reacts hooks and stuff. while sveltekit is just javascript.

Then after months and years on trying to liking react svelte appear out of nowere and i was flabbergasthed on how it reconcile with all my previous developing pattern, even if had to readjust to the particular framework, even if svelte doesn't requires that much to learn and understand. but maybe that just me, i don't know.

If you know a little of html and js, i suggest https://learn.svelte.dev

amazing tutorial / course / example of what sveltekit is capable of.

Hutch79 commented 8 months ago

No problem, even if you want to sell them is your right, i'm redestributing this as a "do what you want" basis, for what the MIT licences of what's integrated (tabler, maxmind, and stuff) allows. Let's don't forget about me if you get rich with this šŸ˜†

I'm more of a GPLv3 guy, but for some projects MIT makes more sense. Even I can't deny that ^^ I think in the future, I'll use MIT as well.


yeah that's the point, i'm using none. The app is built on sveltekit, it allows control on ssr (node server.) I leveraged that on a embedded db.sqlite which in the end allows CRUD on a DB inacessible if not via local file (docker mount of a static sqlite file) every function i need i have to map it via prisma or npm packages. Now it uses panda and prisma to retrieve rows from db and convert them on CSV

Quick Phind search reveled that TypeORM is an alternative to the Entity Framework (the Database management thingy I mentioned). Maybe it's worth a look. https://typeorm.io/


I can't suggest anything else. I was a php / wordrpess / jquery dev. When people started using react i always found difficult to reimagine all my previous abstraction via virtual dom and all the reacts hooks and stuff. while sveltekit is just javascript. Then after months and years on trying to liking react svelte appear out of nowere and i was flabbergasthed on how it reconcile with all my previous developing pattern, even if had to readjust to the particular framework, even if svelte doesn't requires that much to learn and understand. but maybe that just me, i don't know.

I'll first need to master Angular more or less, but a quick look at https://learn.svelte.dev won't hurt ^^

I also looked at react, but I prefer the clean structure of Angular. It clearly separates CSS/SCSS, JS/TS and HTML which I really like. Also, I like the separation into individual standalone components, which they introduced not too long ago.

But I still need to learn a lot. We're using Material design for company internal stuff, and it's kinda hard for me to get my head around styling and the components ^^' Sadly, we have a standard UI design which doesn't provide much room for changes because every application should look the same, which makes sense from a user perspective.

urania-dev commented 8 months ago

To be honest MIT was already Tabler license, i think, and it was the main target of this project when it started, try it because I was involved with it at work. Hence the reason i now want to change it, it is really a good framework, but personally i don't like the actual ui of it. Since i'm starting to grow affectionate to the project and the project is starting to evolve a little towards a version 1 i think I want to customize it more close to my taste. (nothing really differente, just the management of styles and stuff, i want to try skeleton ui and some integration from bootstrap + tabler are clunky, like toasts and tooltips)

allow me to specify what i mean related to the API and ORMs, i already use an ORM framework, Prisma in my case, but my problem is that i still need to map everything to allow that, and i'm thinking about changing database alltogether to something that has not a prisma adapter but it's own ORM client, like supabase or redis. I would prefere redis as it has a really nice one docker solution to expose the service and a dashboard that already would enhance admin experience related to the db, allowing the admin to manage migrations and stuff on its own. Supabase would allow even more, but it's known for it's complexity in selfhosting, and as i said i would like to offer this product to the majority of people easily and for free.

So maybe it would be a little breaking change, without direct retrocompatibility, hence the possibility to exports csv with 0.6.1 that would allow users and admins to recover old version urls (at this point it doesn't exports internal metrics) and insert them in redis.

I am also thinking of a road-to-v.1 script to include on the startup that automates exports of a linked db.sqlite, basically automatize the process of recovering stuff from sqlite and insert it in redis automatically.

Hutch79 commented 8 months ago

I'm not sure about Redis, but i also never really worked a lot with databases. Isn't Redis an In Memory DB? So, how would you store data? I know that other projects often work with a PostgreSQL or MySQL DB to store data. Never seen a Redis DB to actually store persistent data.

Never worked with Supabase, heard of it a couple of times tough. From a 100-Second video, it sounds really interesting, but isn't it a bit overkill for a Home lab? It would need a nearly automatic setup in my oppinion for Snapp to still be easily installable. Maybe a compose file with all configs.

urania-dev commented 8 months ago

I'm not sure about Redis, but i also never really worked a lot with databases. Isn't Redis an In Memory DB? So, how would you store data? I know that other projects often work with a PostgreSQL or MySQL DB to store data. Never seen a Redis DB to actually store persistent data.

Never worked with Supabase, heard of it a couple of times tough. From a 100-Second video, it sounds really interesting, but isn't it a bit overkill for a Home lab? It would need a nearly automatic setup in my oppinion for Snapp to still be easily installable. Maybe a compose file with all configs.

Redis can also be used as a main db and with persistance. My idea is based on this and the fact that it has built in TTL. :)

There shouldnt be disadvantages to use it in a small project like this.

It has two way that can be mixed, one that dumps the db every x second, and one that writes all command sequentially.

It also have a simple compose i can put beside node app :)

Supabase is really annoying and very huge to be set up for a small project like this. But it is fun :)

urania-dev commented 8 months ago

for full disclosure, i'm a fireship fan, and it's been two years that i'm thinking about this Watch the video

urania-dev commented 8 months ago

So Just to keep you posted. I think i Will transform this in a discussion as soon as i have the time to do it.

Im trying out redis and redis om, with authjs to authenticate user on the platform. Persistance works, and the db can be put launched easily with docker compose redis-stack. It comes with redisinsight to manage or check db :)

After finally understand how and setting it up i would say it merge smoothly in Dev process, but i want to be cautious.

The stack is all stuff not exactly production ready, but to be fair neither was half the technology i used before, and the other half i managed myself to revert it to a less stable version of itself.

But to quote one of my favorite meme

5c100bb13301d8a75abdcbdd440969bb.png

That said. Ui-wise skeleton ui + tailwind will take the place of tabler.

Also thinking decoupling api and webapp to comunicate but being treated different, with API having its own bearer token or api key generated from backend to reduce authentication process less complex.

That way i'll maybe end up duplicating unnecessarily parts of the processes but it should allows me an easier control on the whole

I'll be back soon with updates šŸ‘

urania-dev commented 7 months ago

posted some screen of the rebuild work-in-progress in discussion :)

urania-dev commented 7 months ago

0.7.test is live :)