General Forum Upgrades

Laz

Developer
Known Issues
1. Partial card-names no longer work. I'll see if I can fix this, but if it's a lot of complication I'd rather just stop supporting this. It does break older posts though.
I was going to send you a pull request, but it seems overkill now...

Swapping exact card names to fuzzy searching in line 32 of CardService gets you a long way...

I suppose I could still proceed with the other approach I was going to take, which was using the autocomplete service when not matched (would need to think about caching approaches for the API calls though).
 

James Stevenson

Steamflogger Boss
Staff member
I was going to send you a pull request, but it seems overkill now...

Swapping exact card names to fuzzy searching in line 32 of CardService gets you a long way...

I suppose I could still proceed with the other approach I was going to take, which was using the autocomplete service when not matched (would need to think about caching approaches for the API calls though).
To be honest, I have never worked on any open source projects, and the prospect of my first pull request is exciting! This is the kind of thing I couldn't learn about in my job, and I'm keen to now. You are welcome to contribute!

Regarding fuzzy searching: Actually I'm really at a loss at how to construct any queries other than exact. I don't see anything helpful in the docs (https://scryfall.com/docs/api). What am I missing? I'm keen to do bulk queries when I get to ci-tags as well, but I don't see anything about that.
 

Laz

Developer
To be honest, I have never worked on any open source projects, and the prospect of my first pull request is exciting! This is the kind of thing I couldn't learn about in my job, and I'm keen to now. You are welcome to contribute!
Sent you a pull request 2 days ago. Since you haven't made any commits since then, reviewing and accepting the changes if they make sense should be really easy.
 

James Stevenson

Steamflogger Boss
Staff member
Sent you a pull request 2 days ago. Since you haven't made any commits since then, reviewing and accepting the changes if they make sense should be really easy.
I did see it! I haven't worked in a few days, but I looked over the proposed changes this morning. I'm going to merge them, and then I think make 2 commits of tweaks: 1. Style changes; and 2. Change the naming of the cached "fuzzy pointer" to something more explicit. Perhaps `fuzzyPointer--${cardName}`.
In your opinion, is it rude to accept a pull request and then make these sort of tweaks? Should I reject with comments instead?
 

Laz

Developer
I did see it! I haven't worked in a few days, but I looked over the proposed changes this morning. I'm going to merge them, and then I think make 2 commits of tweaks: 1. Style changes; and 2. Change the naming of the cached "fuzzy pointer" to something more explicit. Perhaps `fuzzyPointer--${cardName}`.
In your opinion, is it rude to accept a pull request and then make these sort of tweaks? Should I reject with comments instead?
No issue at all - those are all stylistic and without a style or contributor guide I can't know any differently - I tried to mimic the style that was in place, but I tend to slip back to my own preferred style sometimes. You can pull into a local branch, then make your changes and merge the branch (you also can just commit directly to my branch thanks to the Pull Request), or just add your comments to the request, then I will update the code tomorrow in line with that and add a new commit to that request. Normally you would do the latter - I tried to catch you on Discord to discuss, but we are on opposite sides of the world...
 

James Stevenson

Steamflogger Boss
Staff member
No issue at all - those are all stylistic and without a style or contributor guide I can't know any differently - I tried to mimic the style that was in place, but I tend to slip back to my own preferred style sometimes. You can pull into a local branch, then make your changes and merge the branch (you also can just commit directly to my branch thanks to the Pull Request), or just add your comments to the request, then I will update the code tomorrow in line with that and add a new commit to that request. Normally you would do the latter - I tried to catch you on Discord to discuss, but we are on opposite sides of the world...
Cool, that's all as I figured. I'll get you on discord! I don't use it much, but I think that is the best place for this kind of thing.
 

James Stevenson

Steamflogger Boss
Staff member
Thanks to @Laz's help, we're now using Scryfall's fuzzy search. It still doesn't behave the same as Deckbox, but this is as far as I'll bother to go. I don't think it will affect many posts.
With Deckbox you could just write the start of a card-name, to the bear minimum that was different from any other card. The example I found was: Trostani,, which now needs to be Trostani, Se before it works.
 

James Stevenson

Steamflogger Boss
Staff member
I made some tweaks. I fixed an issue where if you were trying to scroll on a touchscreen, but you tapped down on a card, it wouldn't scroll. Also there were some bizarre tooltip sizing problems. Things seem better now, though not quite perfect. Let me know if you notice anything weird!
 

James Stevenson

Steamflogger Boss
Staff member
RiptideLab Thing 1.1
Embedded card images are live!


Rate Limiting
The only interesting thing about this upgrade is rate limiting. Scryfall asks that users of their API keep requests to 10 per second. You'll notice as you load a page full of card-images, they'll load in a nice, rhythmic fashion. This is the rate limiting in action. However, once they're loaded, the results are cached in your browser. The next time you load that page, all the images should just appear immediately.

Known Issues
The "More details" button has disappeared from tooltips on mobile.

Unknown Issues
If the rate limiting doesn't pass mustard, Scryfall may cancel some requests with a "Too many requests" error. I'm not sure what will happen in this case. Nothing serious, I think.

Next up
Deck and cubedeck tags! Should be straight forward.

Let me know if anything works.
 
Last edited:
RiptideLab Thing 1.1
Embedded card images are live!


Rate Limiting
The only interesting thing about this upgrade is rate limiting. Scryfall asks that users of their API keep requests to 10 per second. You'll notice as you load a page full of card-images, they'll load in a nice, rhythmic fashion. This is the rate limiting in action. However, once they're loaded, the results are cached in your browser. The next time you load that page, all the images should just appear immediately.

Known Issues
The "More details" button has disappeared from tooltips on mobile.

Unknown Issues
If the rate limiting doesn't pass mustard, Scryfall may cancel some requests with a "Too many requests" error. I'm not sure what will happen in this case. Nothing serious, I think.

Next up
Deck and cubedeck tags! Should be straight forward.

Let me know if anything works.
Note that the rate limiting is going to cause some serious issues when loading a page with a bunch of cubedeck tags, as frequently happens in the Cube Blogs section. A typical cube deck has over 20 unique cards, so a single blog post with the four winning decklists from last night's draft will already take over a minute to load.
 

James Stevenson

Steamflogger Boss
Staff member
Note that the rate limiting is going to cause some serious issues when loading a page with a bunch of cubedeck tags, as frequently happens in the Cube Blogs section. A typical cube deck has over 20 unique cards, so a single blog post with the four winning decklists from last night's draft will already take over a minute to load.
Your math is off - 20 cards will take about 2 seconds to resolve, so 4 decks should take about 10 seconds. And this is only the first time you load the thread.

We'll see how it goes. The ultimate solution is for me to build something server-side to store Scryfall results. Browsers would send requests to my server, which can get cards from a database, and connect to Scryfall to fill in anything missing or outdated.
The upside is, I could tweak rate-limiting however I like, and I could implement bulk requests (which Scryfall does not support).
The downside is, it's a lot more complication that I'll need to maintain, and a lot more work for my server to do. This is especially true if I try to build global rate limiting into my server's requests to Scryfall. It's a lot more moving parts, and I think it would end up being much harder to keep running.
 
Your math is off - 20 cards will take about 2 seconds to resolve, so 4 decks should take about 10 seconds. And this is only the first time you load the thread.

We'll see how it goes. The ultimate solution is for me to build something server-side to store Scryfall results. Browsers would send requests to my server, which can get cards from a database, and connect to Scryfall to fill in anything missing or outdated.
The upside is, I could tweak rate-limiting however I like, and I could implement bulk requests (which Scryfall does not support).
The downside is, it's a lot more complication that I'll need to maintain, and a lot more work for my server to do. This is especially true if I try to build global rate limiting into my server's requests to Scryfall. It's a lot more moving parts, and I think it would end up being much harder to keep running.
Oh, ha! I somehow read that as 10 per 10 seconds :oops: Never mind, nothing to see here!

Sweet plans for the ultimate solution though, but yeah, that's going to be tough. Also requires quite a bit of storage, potentially.
 
I am not sure if it is just me but I cannot get into ‘General Discussions’ because an ad is covering the bolded thread title.

I have tried different things but I cannot remove it. (I can’t upload a picture to show because “The uploaded file is too large.”)
 
I am not sure if it is just me but I cannot get into ‘General Discussions’ because an ad is covering the bolded thread title.

I have tried different things but I cannot remove it. (I can’t upload a picture to show because “The uploaded file is too large.”)
No, it‘s not only you. I got the same problem.
 

Jason Waddell

Administrator
Staff member
It's a problem James is already aware of. The ad placement is a bit off on mobile, and will get fixed the next time he has time for development.
 

James Stevenson

Steamflogger Boss
Staff member
RiptideLab Thing 1.2
Decks work! That goes for both [deck] and [cubedeck] tags. In fact, they also worked before, but now they work and get card images from scryfall.

I haven't currently got the creativity to come up with any clever examples, so here's the decks from the how-to thread:

My Very First Jund Deck

Creatures (16)
Putrid Leech #LSV says don't play any, but...?
Sprouting Thrinax
Bloodbraid Elf #skill, amirite
Siege-Gang Commander
Broodmate Dragon

Planeswalkers (2)
Garruk Wildspeaker

Spells (15)
Bituminous Blast
Blightning
Lightning Bolt
Maelstrom Pulse
Terminate

Lands (27)
Forest #who needs dual lands
Mountain
Swamp

Sideboard (15)
Bituminous Blast
Deathmark
Duress
Goblin Ruinblaster
Great Sable Stag
Liliana Vess
Malakir Bloodwitch
Master of the Wild Hunt
Mind Rot
Terminate

(0)

Simic Hexproof (kinda)










These weren't too difficult to do. It took over a week partly because I went out to visit my grandma for a few days, but mostly because I have a severe addiction to Breath of the Wild. There's just so much armour to upgrade...

What's next?
Actually probably not much. I've really wanted to get it to this point, and then use it as a self-learning tool. I want to write a test suite for it, then convert the whole thing to typescript. After all that, I have a much bigger, non-magic project to get started on.
But please post requests if you have any!

Edit:
Known issues
Adventures don't work. I'll fix it tomorrow, I can see the problem.
 
Last edited:
Top