Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Comment: | Enable auto-login if token has expired
Note: I am aware this is terribly unhaskelly, but making it work was my This tries to get a list of todos whatever the command and checks the This means that if you are actually calling for a list of todos it ends 1. Call whatever command is asked for It might never be that good, but I do hope at least to get rid of all |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/issue1 | trunk | master |
Files: | files | file ages | folders |
SHA3-256: |
e53b9e78fb39186f1eefd0009bb26e7c |
User & Date: | base@atomicules.co.uk 2017-10-22 10:44:02 |
2017-10-22
| ||
10:56 | Sort out markup in README check-in: a393b4c91b user: base@atomicules.co.uk tags: master, origin/issue1, trunk | |
10:44 |
Enable auto-login if token has expired
Note: I am aware this is terribly unhaskelly, but making it work was my This tries to get a list of todos whatever the command and checks the This means that if you are actually calling for a list of todos it ends 1. Call whatever command is asked for It might never be that good, but I do hope at least to get rid of all | |
2017-02-26
| ||
15:02 |
Enable commands for any date
Previously Haskerdeux worked around the assumption of "today" and This does change the syntax a little bit. Supplying a date argument is The command "today" is now called "todos" since it can list todos for | |
Changes to haskerdeux.hs.
︙ | ︙ | |||
111 112 113 114 115 116 117 | let authtokenword = stripPrefix "value=\"" $ last authwords let revauthtokenword = reverse $ fromJust authtokenword let authtoken = reverse $ fromJust $ stripPrefix ">\"" revauthtokenword return authtoken login [username, password] = do | < < | > > > > > > > > > > | | > > | > < | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | let authtokenword = stripPrefix "value=\"" $ last authwords let revauthtokenword = reverse $ fromJust authtokenword let authtoken = reverse $ fromJust $ stripPrefix ">\"" revauthtokenword return authtoken login [username, password] = do home <- getHomeDirectory savedtoken <- doesFileExist (home ++ "/.haskerdeux-token") --Need to make a query here and check token is still valid --I am aware this is horribly unhaskelly and I plan on sorting that. if savedtoken then do token <- readFile (home ++ "/.haskerdeux-token") time <- getClockTime >>= toCalendarTime --https://wiki.haskell.org/Unix_tools/Date let date = formatCalendarTime defaultTimeLocale "%Y-%m-%d" time 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="++date++"&end_date="++date] [] let ok = not ("Invalid CSRF Token" `isInfixOf` body) if ok then return token else do removeFile (home ++ "/.haskerdeux-token") login [username, password] else do body <- readProcess "curl" ["-s", "-L", "-c", "haskerdeux.cookies", "https://teuxdeux.com/login"] [] token <- getauthtoken body writeFile (home ++ "/.haskerdeux-token") token let curlheader = "X-CSRF-Token: " ++ token let curlpostfields = "username=" ++ username ++ "&password=" ++ password ++ "&authenticity_token=" ++ token body <- readProcess "curl" ["-s", "-L", "-c", "haskerdeux.cookies", "-b", "haskerdeux.cookies", "-H", curlheader, "-d", curlpostfields, "https://teuxdeux.com/login"] [] return token todos (token, [todos_date]) = do |
︙ | ︙ |