Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save technovangelist/1792713 to your computer and use it in GitHub Desktop.
Save technovangelist/1792713 to your computer and use it in GitHub Desktop.
Get Secret Info From SquareSpace and Store in Adobe Air Local Store
#b64_sha1 library used in this code is Base64 encode / decode from http://www.webtoolkit.info/
localStoreset= (objectName, newobject) ->
bytes=new air.ByteArray()
bytes.writeUTFBytes(newobject)
air.EncryptedLocalStore.setItem(objectName, bytes)
getSecretInfoFromSS = (user,pass)->
datatext = "encryptedPassword=#{encodeURIComponent(b64_sha1(pass))}&loginStyle=regular&SS_CHAIN_TO_ACTION=http%3A%2F%2WebpageToRedirectToWithSecrets%2Frelogin=true&username=#{user}"
$.ajax
type:"POST"
url:"http://SquareSpaceSiteWhereInfoSits/process/Login"
data: datatext
success: (data) ->
encRawJSON=$(data).find(DivTagSurroundingYourSecret).text()
if encRawJSON isnt ""
rawJSON = Base64.decode(encRawJSON)
JSONObject=$.parseJSON(rawJSON)
localStoreSet("username",user)
localStoreSet("passhash",b64_sha1(pass))
localStoreSet("secretuser",JSONObject.secret1)
localStoreSet("secretpassword",JSONObject.secret2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment