Discord Integration: Shorter Links or Bot-based Embeds [enhancement]
Opened this issue · 1 comments
Problems:
- Discord users put their high character count xenpaper links right in chat, hogging a lot of screen real estate.
- But also, they are limited in character length. Attaching a text file is not doable but not convenient.
Solution ideas:
-
Shorten links with services like TinyURL. Limitation: they only allow 600 links per month via their API with the free package.
-
Discord bot to post the Embedded link. (Users can't post embedded links, but bots can, and thereby shorten the post length and allow xenpaper scripts longer than a user's post length limit)
-
Small DB caching the recently copied links; reformat the copied links to use a shortened URL. Limit stored links per IP so that one person can't mash the copy button 10,000 times and hog the entire cache. Probably the easiest approach...
...while this is a low-impact enhancement right now, it could be nice longer term if xenpaper gains more functionality and more popularity.
I think you might be overthinking the URL shortening abuse prevention mechanic.
The main concern with your suggested url-shortening approach is that it requires server-side code to exist. Right now, xenpaper is client-side application.
Regardless, here's what I thought of:
Here is a xenpaper url I shared recently: https://xenpaper.com/#%23_12EDO-17EDO_RETUNING_MAP%0A%23_C_%3A_0__%3D_0____(%2B0)%0A%23_C%23%3A_2__%3D_141__(%2B41)%0A%23_D_%3A_3__%3D_212__(%2B12)%0A%23_D%23%3A_5__%3D_353__(%2B53)%0A%23_E_%3A_6__%3D_424__(%2B24)%0A%23_F_%3A_7__%3D_494__(-6)%0A%23_G_%3A_9__%3D_635__(%2B35)%0A%23_G%23%3A_10_%3D_706__(%2B6)%0A%23_A_%3A_12_%3D_847__(%2B47)%0A%23_A%23%3A_13_%3D_918__(%2B18)%0A%23_B_%3A_15_%3D_1059_(%2B59)%0A%0A%7B17edo%7D_%23_12EDO_mapped._%0A%23_I_wanted_to_keep_a_12EDO-chromatic_feel_%0A%23_while_preserving_the_17edo_scale.%0A0_2_3_5_6_7_9_10_12_13_15_17_%23_chromatic_map%0A0_3_6_7_9_12_15_17___________%23_natural_scale_(white_keys)%0A
You're right - it's too long - but what about other ways to prevent this?
Well, my first thought was doing ASCII compresison.
Compression via http://codelobe.com/tools/ascii-compress, the output looks like this:
https://xenpaper.com/#%23_12EDO-17EDO_RETUNING_MAP%0A%23_C_%3A_0__%3D_0____(%2B0)`E;!%23%3A_2`C=!141`C=!41`E>!D`B]!3`C<!212`C<!12`F<!`D^!5`C>!353`C>!53`E>!E`B^!6`C<!424`C<!24`E<!F`B<!7`D<!94__(-6`E9!G`B9!9`C9!635`CY!35`F<!`D="10`B>!706`C>!`F]!A`B]!12`B;!847`D@#7`F<!`E]!3`B>!918`DB#8`E>!B`C^!5`C$$059`C@#9`B<!0A%7B17edo%7D_`F5%_mapped._`D`!I_wanted_to_keep_a`D]%chromatic_feel`EK!while_preserving_the_`B$"_scale.%0A0_2_3_5_6_7_9_10_12_13_15_17`BG"`Gw!map`BM!3`EI!2`DC!____`B!!`BM!natural`C!"_(white_keys)%0A
About 20% shorter. Not much better, but prevents a need to also turn xenpaper into a url shortener.