HaskerDeux

Timeline
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

50 most recent check-ins

2020-05-15
11:56
Hlint changes

Had to hlint on another computer... cannot get it to install on NetBSD Leaf check-in: 9a429ebc79 user: atomicules tags: origin/issue1, trunk, master

08:29
Handle any case of short day: Mon, mon, MON, etc.

Just because it'll be easier for me to use lowercase. check-in: 386fcc875a user: atomicules tags: origin/issue1, trunk, master

2020-05-14
20:47
Support using "Mon", "Tue", etc aswell as "today", "tomorrow"

Works well, but not having hlint means my code is messy. Could do with a
further commit that means I can use lower case. And probably lots of tidying
up. check-in: beb9ee5fca user: atomicules tags: origin/issue1, trunk, master

06:16
Add `nextweek` command to move todos to "next" Monday

I.e. whatever day of the week the todo is on it'll be moved to the next Monday.
I find myself doing this a fair bit and it's actually fiddly via the web
interface. I could do with figuring out handling multiple todos at once at some
point. check-in: ca6b54431e user: atomicules tags: origin/issue1, trunk, master

2020-03-14
15:15
Follow-up to previous commit - remove all trailing slashes from apiurls

And add to the put and delete where needed.

This is better and more consistent. Also works. Odd that things magically broke
before though. check-in: 06a6b89ac2 user: atomicules tags: origin/issue1, trunk, master

15:09
Always reference cookie files from home dir; API url changes

I forgot to commit the cookie changes awhile back so they've got caught up in a commit fixing the API urls.

The cookie stuff just makes sense. Previously the cookie files were stored in the same directory we were running haskerdeux from, which could lead to multiple files. Makes sense to reference one location (home directory).

The API changes I found when this stopped working: https://atomicules.co.uk/2017/08/27/Remind-to-Teuxdeux.html

Which is friggin' annoying as I almost forgot about Mothering Sunday.

Anyway, it seems some of the URLs haven't so much changed, but now don't like trailing slashes in some cases.

- new, post, can't have trailing slash
- crossoff, put, needs trailing slash
- putoff, put, can't have trailing slash
- moveto, put, can't have trailing slash
- remove, delete, needs trailing slash

Yay for consistency!

Hmm... actually I might tweak this further on a following commit as the puts don't make sense to me. check-in: 4af11b69a0 user: atomicules tags: origin/issue1, trunk, master

2019-02-08
12:52
Add comment for future list usage support check-in: 0fe877fd3b user: atomicules tags: origin/issue1, trunk, master
2017-10-29
17:10
Handle automatic re-login on each separate curl call

I.e. rather than check the validity of the token each time by making a
curl call to get a list of todos (whatever action is being performed)
just assume the token is valid and wait for the actual action to fail.
Relogin at that point and re-call that action.

It's still messy, but I think this approach is right - it'll just be my
implementation of it that lets the side down. check-in: 76a89c1a9b user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2017-10-22
10:56
Sort out markup in README check-in: a393b4c91b user: base@atomicules.co.uk tags: origin/issue1, trunk, master
10:44
Enable auto-login if token has expired

Note: I am aware this is terribly unhaskelly, but making it work was my
main aim, making it less terrible will come. There's also a fair bit of
repetition here.

This tries to get a list of todos whatever the command and checks the
response for an invalid csrf token, if that occurs it removes the file
and calls login again.

This means that if you are actually calling for a list of todos it ends
up doing it twice which is a bit rubbish really. It would be nicer for
it to:

1. Call whatever command is asked for
2. Catch a invalid_csrf_token in the response
3. Re-login
4. Continue to call the original command

It might never be that good, but I do hope at least to get rid of all
the if/then/else though. check-in: e53b9e78fb user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2017-02-26
15:02
Enable commands for any date

Previously Haskerdeux worked around the assumption of "today" and
although you could move todos to any date, view todos for tomorrow and
put off things until tomorrow there was no way to, say, delete a todo on
a random date or list todos from a selected day next week.

This does change the syntax a little bit. Supplying a date argument is
now compulsory, but it "understands" the dates of "today" and
"tomorrow".

The command "today" is now called "todos" since it can list todos for
any date. The command "tomorrow" has been removed similarly. Variables
have also been renamed to suit (`todays_date` is now `todos_date`). check-in: ab44c0ddfb user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2017-01-29
14:33
Add a tomorrow command to fetch tomorrow's todos

Since there is no way to interact with todos from tomorrow don't number
these when outputing them. Rename some variable names from todays_date
to date since they can be any date really.

Really I should think about how to make this work nicely with todos on
any date, but for now this will do. check-in: 674b1e8fba user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2016-12-04
16:04
Add note about used to use Network.Curl check-in: 5f083ddb12 user: base@atomicules.co.uk tags: origin/issue1, trunk, master
15:56
Enable response on delete, forgot about this check-in: a09dcdd1f3 user: base@atomicules.co.uk tags: origin/issue1, trunk, master
15:49
Clean up and correct comments check-in: 97901a5951 user: base@atomicules.co.uk tags: origin/issue1, trunk, master
15:43
Be consistent with how isInfixOf is used check-in: bec4f0a542 user: base@atomicules.co.uk tags: origin/issue1, trunk, master
15:09
hlint changes

- Duplication between curldelete and curlput still exists, but I think is
legitimate.
- Also, I'm really not sure use of Control.Applicative makes
it any more readable, but I'll go with it.
- Would also be nice if I could get all the isInfixOf the same check-in: 6b4d755c96 user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2016-12-03
00:07
Update README to reflect it works again check-in: 02acc587fc user: base@atomicules.co.uk tags: origin/issue1, trunk, master
2016-12-02
23:28
Add back in "new" todo functionality.

Now, finally, has the same functionality it did four years ago!

But is a messy piece of crap. In fact it's pretty horrible, but it works
so if I'm really honest I'm probably just going to leave it like this. I
just can gel with Haskell like I can Erlang (and I ain't saying I'm good
there).

Things of note:

- Remembered why I needed Just/Maybe on the curlpost
- The json bit in the curlpost, need to let the statements rather than
returning them directly. I don't understand why, but get errors.
- The way the curlpost works to sort out the correct json string
depending on whether adding a new todo or modifying an existing is
just horrible. I really need to figure out using association lists as
args and cleanly converting these to a json string. check-in: 5927c4835d user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2016-11-27
21:43
Enable putoff and moveto commands

This is an utter mess and soooooo unhaskelly, but nearly back to the
original functionality.

I'm most miserable about the passing of args to curlpost. Ideally I'd
like to pass an association list representing the json data and then
convert this into a string representation of the json data for posting
with curl. Perhaps Text.Json can do this (probably Aeson can do if
Text.Json can't), but I couldn't figure it out so I've done this an
crappy way.

The other thing I need to do is to do is make it so the resposition
moves it to the bottom of the list. Not figured that out yet. Doesn't
happen automatically anymore.

Maybe one day I can make this better. check-in: 57b994daa8 user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2016-11-13
16:29
Get remove/delete working

Need to work on what happens if it isn't successful, etc. check-in: ad71dd9ca4 user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2016-11-11
22:44
Revive the code to stash the token, i.e. don't log on everytime

This is probably very un-Haskelly, but it works for me.

To reset the logon we simply delete the token file. check-in: 0bd7f22080 user: base@atomicules.co.uk tags: origin/issue1, trunk, master

21:42
WIP on master: 9bf7cc9 Use silent option on curl calls Leaf check-in: 3fc1147726 user: base@atomicules.co.uk tags: origin/issue1, trunk, refs/stash
21:42
index on master: 9bf7cc9 Use silent option on curl calls check-in: 1b034b19ac user: base@atomicules.co.uk tags: origin/issue1, trunk, refs/stash
2016-11-06
18:02
Use silent option on curl calls check-in: f57e108787 user: base@atomicules.co.uk tags: origin/issue1, trunk, master
17:31
Get today and crossoff working with system call approach

As mentioned in the previous commit I decided to give up on
Network.Curl and libcurl. There seem to be issues there that could be
due to either of them two or me. I know that the curl command line works
so I'll just make this program a wrapper around that. It's not as pretty
or elegant, but it'll work.

So this commit is basically that, moving from Network.Curl to using
readprocess. Still much tidying up to do.

- Need to figure out hiding the curl UI feedback
- Need to figure out re-using cookies. Network.Curl did strange things
with the cookie files, but I know command line curl works properly so
I can cache the token and re-use cookies, etc to save logging on
everytime. check-in: 3965e8f532 user: base@atomicules.co.uk tags: origin/issue1, trunk, master

2016-10-30
22:23
Reference commit - Attempt to get crossoff working

Commiting this and then changing tack. This *should* work, but doesn't.
I'm going to give up with Network.Curl and libcurl and just try system
calls to curl command line tool as I can get things to work there.

For this attempt:

- I switched from passing curlheaders around to just the
token so I could later the headings for the PUT request.
- Tried all the headers I could, but it just hangs. I.e. added in
content-length and blanked out Expect to get rid of the 100 response
thing (which I thought was causing the hang, but still hangs.)
- Removed some putStrLn I was using for debugging
- Removed some CurlVerbose for the same reason Leaf check-in: fb2b1427c2 user: base@atomicules.co.uk tags: origin/issue1, trunk, neux-api-libcurl

2016-10-09
13:13
Reference commit - Get today command working (bug in getCurrentTime)

The main thing to note here is that getCurrentTime is no longer working.
It returns a date three years out of sync. I spent a lot of time
debugging what I thought were problems with JSON parsing because I kept
getting no results before I realised the friggin' date was out by that
much. Switching to getClockTime works.

- Pass curl headers around with curl between commands to save storing
and reading the token
- Only support username and password from .netrc. It's just me using
this anyway
- around between commands to ensure the same curl session is
used
- Use do_curl_ in curlget since passing around the curl object.
- Comment out curlpost and curldelete for now check-in: 2276a866ab user: base@atomicules.co.uk tags: origin/issue1, trunk

2016-10-02
15:54
Reference commit - test command for new API works!

- Commented a load of stuff out to avoid having to tweak it to get it to
compile
- I think I was doing things wrong before with the old API (too many
curl initialisations, etc), but it worked for me because the old API
didn't really care about cookies, etc.
- This time round think will have to have one withCurlDo and one
initialisation and then pass this around to use as otherwise a new
session starts and we lose the cookies, etc
- The CookieJar thing does not seem to persist to disk. I don't
understand it :-(
- So will probably have to login EVERYTIME we do a command. Oh well.
That's not too bad. check-in: edb54e1885 user: base@atomicules.co.uk tags: origin/issue1, trunk

2016-09-18
22:20
Reference commit - Compiles, in theory logs in, test command fails

- Use Network.URI.Encode instead of web-encodings (not tested yet)
- Mostly get it so it compiles
- Add a test command so I can check login works (obviously not working
fully)
- Remove all old username/password stuff
- Qualify a lot of commands because of conflicts
- Update the Json derivable thing to match new API field names

Since I KNOW these curl commands work when run via GHCI I have a
cookie/token mistmatch going on. check-in: ab1c93346f user: base@atomicules.co.uk tags: origin/issue1, trunk

2016-09-11
20:49
WIP - Reference commit of work towards neux API. Login stuff

This very much doesn't work as a whole, but contains some bits that do
on their own. check-in: 19d4084714 user: base@atomicules.co.uk tags: origin/issue1, trunk

2014-04-24
12:37
Add Abandonware note to README check-in: 225bfadbdf user: atomicules@users.noreply.github.com tags: origin/issue1, trunk, old-api
2014-02-11
12:17
Clicked too soon check-in: 57ad135e97 user: atomicules@users.noreply.github.com tags: origin/issue1, trunk
12:16
Re-license as BSD 2-Clause check-in: ce7ddde28d user: atomicules@users.noreply.github.com tags: origin/issue1, trunk
2013-07-16
11:46
Create LICENSE check-in: 1c944b0bd4 user: atomicules@lavabit.com tags: origin/issue1, trunk
2013-03-26
12:41
Cleaning up to start again Leaf check-in: 76091f552c user: atomicules@lavabit.com tags: trunk, origin/develop
12:40
Merge branch 'develop' of github.com:atomicules/HaskerDeux into develop

Conflicts:
haskerdeux-api.hs

Don't really care though as starting anew. check-in: eb27ab8b3f user: atomicules@lavabit.com tags: trunk, origin/develop

12:29
Committing for reference. Going to start again. check-in: 043a9f642f user: atomicules@lavabit.com tags: trunk, origin/develop
2012-12-22
19:38
Add delete function to completely remove a todo

As far as I know, Network.Curl doesn't support making a XDELETE request
via Curl, but fortunately the Teuxdeux API supports faking this via a
PUT request with "_method=delete"

There's some duplication of code with this commit, but it saves making
the `curlpost` function even more messy than it already is - so that's
my excuse. check-in: 446e5b0165 user: atomicules@lavabit.com tags: origin/issue1, trunk

2012-09-12
10:37
Use Web.Encodings to URL Encode new todo text

Noticed text was getting chopped off at ampersands, etc. URL encoding
seems to be the correct option. Just passing a "&" is no good. Needs
to be "%26".

I know Web.Encodings is depreciated, but I'm unsure of it's replacement.
If need be I could just pull out the encodeUrl bit from it and include
directly. check-in: 995a268eb7 user: atomicules@lavabit.com tags: origin/issue1, trunk

2012-09-05
14:16
hlint changes check-in: 1dbf8f7a81 user: atomicules@lavabit.com tags: origin/issue1, trunk
10:30
Perform curlget conditionally within curlpost

Previous commits DRY-ed up the code so all TeuxDeux functions used
a shared a curlpost function, but meant that a curlget was performed
even when not necessary. I.e. when adding a new todo it is not necessary
to fetch a list of the todos. Fetching a list of todos is only necessary
when making some change to an existing todo.

I'm quite sure I could make yet more improvements to this code, but it
is a lot better than it was!

With this last change of the last few commits, closes #1. check-in: 3a891cc5f3 user: atomicules@lavabit.com tags: origin/issue1, trunk

10:11
Re-order code only check-in: 539f0bc805 user: atomicules@lavabit.com tags: origin/issue1, trunk
2012-09-03
15:31
Further DRY-ing up of code. WIP

This is pretty close, but the one down side of this is that curlget is
now also called when creating a new todo and this is a redundant call.
Unfortunately I have not figured out how to make this call
conditionally. Simply including these statements within a do statement
in the curlpostfields conditional doesn't work. check-in: 10092e6bc2 user: atomicules@lavabit.com tags: origin/issue1, trunk

12:11
Use one function for curlget requests

Continue to make DRY check-in: 64bbe94dcc user: atomicules@lavabit.com tags: origin/issue1, trunk

11:57
Start making code more DRY check-in: 76a52b82ca user: atomicules@lavabit.com tags: origin/issue1, trunk
2012-08-31
10:51
Minor formatting corrections check-in: 28e54b2cb0 user: atomicules@lavabit.com tags: origin/issue1, trunk
10:35
Make username and password arguments optional using netrc

- If username and pasword are not supplied will attempt to read from netrc
- Also document the moveto function in the README, forgot to document
that last time

Yes, yes, I know the code *still* isn't DRY. It bugs me too! check-in: 107dba13e8 user: atomicules@lavabit.com tags: origin/issue1, trunk

2012-08-30
23:27
Add function to read netrc, prep for future changes

Function isn't used anywhere yet, but will be. check-in: e5795c8187 user: atomicules@lavabit.com tags: origin/issue1, trunk

07:22
Change order of function arguments to be more sensible check-in: 3a8ddd1cb3 user: atomicules@lavabit.com tags: origin/issue1, trunk