Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Be consistent with how isInfixOf is used |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/issue1 | trunk | master |
Files: | files | file ages | folders |
SHA3-256: |
bec4f0a542ae966de3c9815a109910b3 |
User & Date: | base@atomicules.co.uk 2016-12-04 15:43:56 |
Context
2016-12-04
| ||
15:49 | Clean up and correct comments check-in: 97901a5951 user: base@atomicules.co.uk tags: master, origin/issue1, trunk | |
15:43 | Be consistent with how isInfixOf is used check-in: bec4f0a542 user: base@atomicules.co.uk tags: master, origin/issue1, trunk | |
15:09 |
hlint changes
- Duplication between curldelete and curlput still exists, but I think is | |
Changes
Changes to haskerdeux.hs.
︙ | ︙ | |||
39 40 41 42 43 44 45 | token <- login [username, password] dispatch command (token, todays_date:argList) readnetrc = do home <- getHomeDirectory netrc <- lines Control.Applicative.<$> readFile (home ++ "/.netrc") | | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | token <- login [username, password] dispatch command (token, todays_date:argList) readnetrc = do home <- getHomeDirectory netrc <- lines Control.Applicative.<$> readFile (home ++ "/.netrc") let netrc' = dropWhile (not . ("teuxdeux" `isInfixOf`)) netrc let (username, password) = if "login" `isInfixOf` head netrc' -- if entry is on one line then (getcred "login", getcred "password") -- if entry is on multiple lines else (last $ words $ netrc' !! 1, last $ words $ netrc' !! 2) where getcred c = dropWhile (not . (c `isInfixOf`)) (words $ head netrc') !! 1 return (username, password) curlget (token, todays_date) = do let curlheader = "X-CSRF-Token: " ++ token body <- readProcess "curl" ["-s", "-L", "-c", "haskerdeux.cookies", "-b", "haskerdeux.cookies", "-H", curlheader, "https://teuxdeux.com/api/v1/todos/calendar?begin_date="++todays_date++"&end_date="++todays_date] [] --let opts1 = [] |
︙ | ︙ | |||
110 111 112 113 114 115 116 | --just check body contains stuff? if "done_updated_at" `isInfixOf` body then putStrLn okresponse else putStrLn "Uh Oh! Didn't work!" getauthtoken body = do let bodylines = lines body | | | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | --just check body contains stuff? if "done_updated_at" `isInfixOf` body then putStrLn okresponse else putStrLn "Uh Oh! Didn't work!" getauthtoken body = do let bodylines = lines body let authline = dropWhile (not . ("authenticity_token" `isInfixOf`)) bodylines let authwords = words $ head authline let authtokenword = stripPrefix "value=\"" $ last authwords let revauthtokenword = reverse $ fromJust authtokenword let authtoken = reverse $ fromJust $ stripPrefix ">\"" revauthtokenword --home <- getHomeDirectory --putStrLn authtoken --writeFile (home ++ "/.haskerdeux-token") authtoken |
︙ | ︙ |