leaguevine / leaguevine-ultistats

MIT License
18 stars 4 forks source link

Game tracking screen doesn't work in Safari #93

Closed mliu7 closed 12 years ago

mliu7 commented 12 years ago

I'm not sure this is actually an issue with leaguevine-ultistats. It might be an issue with leaguevine.

When I click "take stats" from ultistats from a safari browser, it either throws an error or redirects me back to the team list page. Again, I have no idea what part of the stack is causing this problem so let me know if I should close this issue and look into how things are being served on Leaguevine.

mliu7 commented 12 years ago

Hmm, it doesn't seem to work in ios either. It works great in Chrome for me still. I'll look into this.

cboulay commented 12 years ago

It is working for me now. I encountered a couple issues.

  1. There may have been a problem with the redirect in safari, though I don't think this was the cause of the problem.
  2. At least on playwithlv.com, dev@dev.com's app registration had vanished, and thus the client_id was no longer valid. Check localSettings.js on the deployed version to make sure the clientt_id is valid.
  3. There was a small bug with the login button on the settings tab... but this would not have caused the issue described.

I'm about to make a small commit for the login button and for localSettings using the new client_id, but please check the deployed version's client_id and, if that fixes it, close the issue.

mliu7 commented 12 years ago

Hmm, I'm still stumped. The client_id is still valid on the deployed version after inspecting localSettings.js and the client entries. I'm guessing if these were wrong then the app wouldn't work in chrome either.

Sorry about removing dev@dev.com's app registration. The playwithlv database is currently identical (off by one day) of the leaguevine database.

You might be onto something with the safari redirects. Currently, whenever leaguevine gets a request for a url without a hash, (i.e. ultistats.leaguevine.com/games/26582) it redirects to the hashed url (i.e. ultistats.leaguevine.com/#games/26582) so backbone can figure out how to handle it. This had been working fine until our re-deploy, but I'm wondering if this has something to do with the issue...

mliu7 commented 12 years ago

I saw you recently added localSettings via require and doing this broke the current way I had localSettings set up. Right now a user can just serve up localSettings.js from that location and it will work, but doing this via require doesn't necessarily work. I don't know anything about require but maybe it grabs the files via the filesystem rather than individual HTTP requests? Either way, I changed that import back after pulling your changes and the client ID is back to working for me in chrome, but still not safari.

cboulay commented 12 years ago

By removing localSettings from require it just means that it won't get built into the release, but that shouldn't matter as long as it's listed independently in ultistats.appcache (both release and server).

Depending on how your URL rewrites are handled, you shouldn't need a hashed URL. With my local .htaccess settings it isn't necessary because anything that isn't found is redirected to index.html.

I'm using Safari in Windows and I'm having no trouble tracking games on ultistats.leaguevine.com, ultistats.playwithlv.com, or ultistats.localhost . In fact, I don't even have to login on the deployed version which is a bit strange considering I reset Safari (clears all settings) before going to ultistats.leaguevine.com. And the logout bug still exists on those versions so I couldn't logout.

I'll try out Safari on OSX later at home. In the meantime, you can try debugging it. In Safari: Gear->Preferences->Advanced->Show Develop menu in menu bar. Then, navigate to: https://ultistats.leaguevine.com/games/26582 Then Menu (looks like a page)->Develop->Start Debugging Javascript

You'll notice this is mostly useless because require.js is only one super long line. But if you do this locally, and your local version is not using the release version, then you can select leaguevine.js and put a break point at line 133 and see what that line returns.

cboulay commented 12 years ago

window.location.href = this.base + "&client_id=" + this.client_id + "&redirect_uri=" + this.redirect_uri; Returns http://www.playwithlv.com/oauth2/authorize/?response_type=token&scope=universal&client_id=62d916480768b01cb98250effb12c0&redirect_uri=http://ultistats.localhost/

cboulay commented 12 years ago

I just tested in Safari OSX and the iPad simulator. Both worked fine with my local version and with http://ultistats.leaguevine.com , though, as above, ultistats.leaguevine.com did not require me to login. (My local version did).

mliu7 commented 12 years ago

Thanks for following up with this. I'll try a couple more things, but if I can't find the cause I may just host it from a different (non-heroku) server so I can serve files up with apache and use the .htaccess file that you supply with the repo.

I'm going to close out this issue because I think it has nothing to do with ultistats and everything to do with how I'm serving the app. I'll write an update when ultistats is back online on our live site and working for non-chrome browsers.

mliu7 commented 12 years ago

Just wanted to follow up on this. It's now working on both leaguevine and playwithlv. I re-deployed ultistats as a standalone app using an apache server rather than serving it up as a submodule on heroku. The people at Webfaction (the hosting service I'm using) still have to enable our security certificate so until then users will see a popup saying our certificate can't be trusted before entering the site. They should enable this in the next several hours.

Sorry ultistats was down for so long...