1. Remember to check the Simple Questions/Simple Answers , Suggestions , Bug Reports and Technical Support threads before posting. If you have something that warrants extended discussion then post a thread, but when in doubt, please use an already existing thread
  2. New to the forums? Check out our Mentorship Program!
    Our mentors will answer your questions and help you become a part of the community!
  3. Welcome to Smogon Forums! Please take a minute to read the rules.

Backing Up Teams/Settings via LocalStorage (Temp fixes Mac App DNS error)

Discussion in 'Pokémon Showdown!' started by Elegy of Mot, Apr 3, 2013.

  1. Elegy of Mot

    Elegy of Mot

    Joined:
    Oct 10, 2012
    Messages:
    2
    This guide is going to attempt to outline how to get the downloaded client working, and then explain how to move your app's Local Storage file into a web browser's Local Storage file (will be using Google Chrome) so that you can access all of your teams on the web version, export/back-up them, and import them onto the new app client. If you're having problems with the DNS 'httpd_bad_conf' error, follow Zarel's and my instructions in the following posts.

    Prerequisites:
    Google Chrome (This is the browser I did it for, I'm certain it'll work for several other browsers)
    Administrator privileges on your local computer
    SQLite Database Browser 2.0 b1 download here

    Other stuff that won't hurt to have
    XCode with command line tools
    MacPorts
    ^Not sure if these actually affected anything during this process, but I have 'em on my machine.

    *This is specifically on OS X Mountain Lion 10.8.2, I assume it works on other versions, but I can't guarantee that.*

    ===========================================

    Step 1: Open up terminal, which should be at ~/Applications/Utilities/Terminal.app

    Step 2: Find the terminal executable file for your Pokemon Showdown! app. It'll be wherever you have the app saved, but I have mine in my apps folder for demonstration purposes. When you find it, right click, and hit "Show Package Contents"
    [​IMG]

    From here, go through Contents -> MacOS and you should see a Unix Executable file named Pokemon Showdown

    Step 3: Back up your current Application's Local Storage file by replacing your Browser's Local Storage file with its contents. This portion will require SQLite Database Browser 2.0 b1.

    Step 3a: Locate your Pokemon Showdown app's LocalStorage file. You can do this by typing
    Code:
    sudo open ~/Library/Application\ Support/Pokemon\ Showdown/LocalStorage/
    Since this uses 'sudo' you'll need local admin capabilities. You'll see a series of files, the first one should look like this:
    [​IMG]

    Go ahead and open this file with SQlite, go to Browse Data, then look for the row labeled 'showdown_teams' like so:
    [​IMG]

    Double click the cell under the 'value' column that corresponds to 'showdown_teams' and go ahead and highlight everything in there (CMD+A) and copy it (CMD+C). You may want to open up TextEdit in the mean while to paste that data into for holding if you need to copy/paste future commands from here. This will look like so:
    [​IMG]

    You're going to be putting this data into your browser's version of your 'LocalStorage' file so that you can use the browser version to export/back up your team lists onto the new medium for running the app client, so hold onto this info for a bit.

    Step 3b: Plug that data into your browser's folder! Go ahead and open your browser's Local Storage folder with this command
    Code:
    sudo open ~/Library/Application\ Support/Google/Chrome/Default/Local\ Storage/
    NOTE: OBVIOUSLY, THIS WILL BE DIFFERENT IF YOU'RE USING A BROWSER OTHER THAN GOOGLE CHROME. FOR OTHER BROWSERS, YOU'RE GOING TO HAVE TO FIGURE OUT HOW TO ACCESS THE LOCAL STORAGE FILES ON YOUR OWN, BUT I IMAGINE IT'S SIMILAR.
    Anyway, the file you're looking for will have the exact same prefix format as the one we're pulling the info from, that's your key to finding the right one because there will be a lot. At this point, if you haven't already, go ahead and visit the actual browser client and log in, so that you will have a Local Storage file to actually open; otherwise, you'll be looking around for a file that hasn't been created yet. When you find it, it should look something like this:
    [​IMG]
    Now my file size is a bit bigger than one without any teams on it, but for demonstration purposes I've blanked the teams and am going to reload them.

    Step 3c: Got that data from the application's localstorage file ready to go? If so, go ahead and open up the file up there ^^ to edit your browser's localstorage file. Mosey on over to the 'Browse Data' tab again and you should see something that looks like this:
    [​IMG]

    Now that [] is an empty array where your team data would be, if there were any. Double click it to open and hit the 'Clear' button to erase the cell completely. (You'll know you did it right if the cell is empty afterwards) like so:
    [​IMG]

    Now, go ahead and click in the cell and paste (CMD + V) all the data you copied from the application's localstorage file. BE SURE TO ACTUALLY HIT 'APPLY CHANGES' WHEN FINISHED. When done your browser's localstorage file cell should look like this:
    [​IMG]

    You may want to double check to make sure everything's in order, and, again, make sure to hit 'Apply Changes'.

    Step 3d: This one's easy, just make sure to properly save over the localstorage data. Click the big ol' floppy disc icon to save. Probably go ahead and save it twice, for good measure, like so:
    [​IMG]

    Step 4: Most of the hard work is done now. Go ahead and head to play.pokemonshowdown.com and log in. Your teams should be visible under the team builder tab now, like so:
    [​IMG]

    Go ahead and click on 'Back Up/Restore' at the bottom of the team list, copy the data and paste it into TextEdit for safekeeping until we're ready to import on the new app client medium. I'm going to assume you know how to do this part, so no pic.

    Step 5: Okay, remember that whole Step 2 thing? We're going to be opening that using terminal. Again you're going to need to have admin privileges on your local machine. You can just type 'sudo ' and then drag the executable into terminal or you can punch in this:
    Code:
    sudo /Applications/Pokemon\ Showdown.app/Contents/MacOS/Pokemon\ Showdown
    You should see what appears to be the Mac client for Showdown! opening up, and then terminal will spit a couple lines of javascript console errors telling you the websocket is closed, which I'm guessing might be the cause of this mess? Dunno, not far along into comp sci yet with engineering. Anyway, it should look like this:
    [​IMG]

    Anyway, everything going well (by the way if you typed 'sudo open' instead of just 'sudo' you just opened the file regularly, so you should just close the presumably bugged window and retry that bit without the 'open') you'll now have an application window of Pokemon Showdown open!

    Step 6: OH NO, WHERE ARE MY TEAMS, WHAT HAVE YOU DONE? Calm down, you should have all of your teams copied into TextEdit or still sitting on your computer's clipboard. Take deep breaths, nothing is gone. Now, simply go to team builder like before, paste in the text you copied from the Back Up/Restore field from the browser into the Back Up/Restore field for the application window, and be on your way. Again, I'm assuming you can do that bit on your own, so no pics. If you want to run the app client, you're going to need to do that CODE]sudo /Applications/Pokemon\ Showdown.app/Contents/MacOS/Pokemon\ Showdown[/CODE] bit every single time, so I guess that portion comes down to sheer preference since all your teams should now be on the browser version, too. I still do the app thing, I have a lot of tabs open and no room for a Showdown! tab, so I use the app.

    ==============================================
    Anyway, I hoped at least some part of this helped with something. If you want to baleet this or throw things at me for messing up some part of the walkthrough, I'll probably be checking in every once in a while here. Questions and comments are welcome, too, I guess. Take care, Mac folk.
    -Mot Elegy
  2. Zarel

    Zarel Not a Yuyuko fan
    is a member of the Site Staffis a Battle Server Administratoris a Programmeris a Pokemon Researcheris an Administrator
    Creator of PS

    Joined:
    Aug 16, 2011
    Messages:
    1,775
  3. Elegy of Mot

    Elegy of Mot

    Joined:
    Oct 10, 2012
    Messages:
    2
    Also I pass dreamhost's ip check local vs. server registered from here but the test fails with completely different ip's with 2 sets of different ip's on the play.pokemonshowdown.com domain at one of its localstorage values for browser checking.

    [​IMG]

    EDIT:
    Closing all internet connected programs with Task Manager (CMD + ALT + ESC), Renewing DHCP (System Preferences -> Network -> Advanced -> DHCP -> Renew DHCP), Disabling WiFi (System Preferences -> Network -> Turn Wireless Connection Off (different from turning off airport), then finally flushing your DHL will get it working ~2 hours after you flush DHL. Thread's still useful for backing up App Client teams, I suppose, since you can't just access them as files (like .tp PO uses) and vice versa, if you want to back up browser to App before clearing cookies and don't trust clipboard or TextEdit alone (I have something like 80 teams, myself). Nice not to have to use terminal to start up the app anymore. Thanks much, Zarel.

Users Viewing Thread (Users: 0, Guests: 0)