Skip to content

Create short links for battles #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SpectacularVernacular
Copy link

This proposed update creates short links and prints the short links. The $domainname needs to be declared on line 311 and the $customdir needs to be manually created (and optionally changed). This is for easier sharing of battles so the links do not seem quite as spammy.

Feel free to view the live example at https://prts.cr/calc/ . This example is planned to be removed after PR is accepted/rejected.

This update is intended to be used with a cronjob similar to 0 0 * * * find /public_html/calc/b -depth -type f -atime +10 -delete which will delete the redirect webpages (in the b directory) after they have not been accessed for 10 days, and will run on the first of the month. Keep in mind, everytime the redirect webpage is loaded, it will create a new shortlink, so expect quite a few redirects per actual battle.

I am seeing 780B per webpage which is nominal if they are deleted after 10 (or more days) but will possibly be burdensome if they are never deleted.

It is currently unknown why the bottom link has moved to the top.

This proposed update creates short links and prints the short links. The $domainname needs to be declared on line 311 and the $customdir needs to be manually created (and optionally changed).  This is for easier sharing of battles so the links do not seem quite as spammy.

Feel free to view the live example at https://prts.cr/calc/ .  This example is planned to be removed after PR is accepted/rejected.

This update is intended to be used with a cronjob similar to `0 0 * * * find /public_html/calc/b -depth -type f -atime +10 -delete` which will delete the redirect webpages (in the `b` directory) after they have not been accessed for 10 days, and will run on the first of the month. Keep in mind, everytime the redirect webpage is loaded, it will create a new shortlink, so expect quite a few redirects per actual battle. 

I am seeing 780B per webpage which is nominal if they are deleted after 10 (or more days) but will possibly be burdensome if they are never deleted.

It is currently unknown why the bottom link has moved to the top.
@djensen47
Copy link
Owner

In order to reduce the maintenance, I would prefer to use a service for the short links. Bitly is popular. Google, via Firebase, also has a good solution.

@djensen47
Copy link
Owner

It looks like bitly requires paid API access? I'm fairly certain the Firebase option is free. I'll look into it more.

@SpectacularVernacular do you want to look into this more?

@SpectacularVernacular
Copy link
Author

SpectacularVernacular commented Jun 23, 2020

Yes I certainly do! I'm unfamiliar with either option, I generally create my own short links for these types of projects. I'll start researching the Firebase option (looking at developers documents and attempting to implement it into the code at the aforementioned website).

I certainly understand the desire to keep maintenance to a minimum. At the same time, these short links require no maintenance other than a working cron-daemon on the server. Cron is a way to automate tasks at specific intervals or specific times. This means there is no need to manually "trim" battles in the case that there are tens of thousands of battle short-links saved. It will happen automatically if they have not been accessed for the specified time (10 days in the example above). The disk space is nominal relative to modern server disk sizes I see advertised on shared hosting and VPSs, etc. I reported 780B per battle. That was the high end of my tests. Most are around 600B per battle which is ~1,789,000 battles per Gb.

That being said, I do respect your judgement as the maintainer to avoid the self-hosted option, and will begin pursuing the Firebase research.

In the meantime, I am looking into another service that is free. It is known as Cuttly, and it has a much easy to read API documentation (It is much shorter and all on one page). If you don't think they meet your standards, I will of course drop that idea

@djensen47
Copy link
Owner

The nice thing about Google or Firebase is that the service should be around for years to come.

@djensen47
Copy link
Owner

Cron is a way to automate tasks at specific intervals or specific times.

Yup, am familiar. For s simple case like this a cron is fine but if I'm not monitoring this and something goes wrong ... it becomes a hassle. An external service eliminates the need for continuing devops.

@SpectacularVernacular
Copy link
Author

I've looked into Firebase's documentation now. It seems they are going to require me to set an NS type A record and running Google's code on my site. With Google's egregious privacy record (and other thing I dislike about google) that is not something I am willing to do at this time.

I completely understand if you want to use Firebase specifically, and I'll assist on the coding side where I can. If you're not set on using Firebase or Google's technologies, then we can look at other alternatives as well.

@djensen47
Copy link
Owner

I've looked into Firebase's documentation now. It seems they are going to require me to set an NS type A record and running Google's code on my site.

This is only the case if you want a custom domain. In fact for the development on this, everything should be configurable anyway. I'm not going to hardcode API keys in the source code nor the parameters that we pass into the api.

Here are the API docs: https://firebase.google.com/docs/dynamic-links/rest

Also, whatever your opinion may be about Google for consumers, know that Google is really good to their developer community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants