I just wrote an app for Chrome extensions and received a request to make it cross-StackExchange compatible. If there's eventually going to be more sites than just the few listed and I don't really know what they'll be called other than by checking here every so often to see what is supported, how do I future-proof my app to work with every SE site? Or am I doomed to hardcode everything?

I wrote a Chrome extension myself (details here) that works against all of the Stack sites, and an approach that I found pretty useful was to maintain a simple javascript object that stores anything about the sites that I may need to access. Here's the snippet I'm currently using:

Extending this to include future StackExchange sites or even user submitted sites would be pretty trivial with a helper method.

I'm personally choosing which API I'm using by investigating the URL of the page the user is visiting, but if the user is selecting which sites to use or activate, including a simple boolean flag with the site structure would suffice.

yeah i saw your extension just a few seconds ago :) also, i had this idea (or something similar) on my bike ride to work this morning. it sucks we have to do something like this, but i feel like this may be the best solution right now
–
JasonJun 3 '10 at 17:08

Right now I'm working on encapsulating all that functionality into a centralized JS script, with the hopes that if / when a discovery API is implemented, I can change everything in one place and it will be implemented across my extension. Once that happens, I'll be sure to remember you and drop you a comment.
–
Ryan BrunnerJun 3 '10 at 17:33

I think it varies by application, and I'm not sure how you'd want to do it for yours, but for many it'd probably be sufficient to allow the user to add a site in the "stackoverflow.com" format, from which you can derive the API URL.

i was looking for a way to maybe centrally detect support? maybe a call to the main stackoverflow stats method gives you a list of all the supported sites? i think that would be kind of cool.
–
JasonJun 3 '10 at 16:48

1

Could you maybe try hitting the API URL of the site the user is trying to add, and if you get an error or an unexpected response, you can assume that the site either isn't a StackExchange site or the API hasn't been activated on it yet.
–
Ryan BrunnerJun 3 '10 at 16:49