diff --git a/.gitignore b/.gitignore index 93374fd..13f1110 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ .envrc -twit2blog -twit2blog.db +tweetlog.db bookmarklet.min.js +tweetlog diff --git a/README.md b/README.md index 2ca400b..11a1aed 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -### Twit2Blog +### TweetLog A simple tool to help make it easier to archive readable tweets you can browse. No external server or proprietary SaaS solution needed. ### Building -`nimble build` is all you'll need at this point. +Running `nimble build` is all you'll need at this point. ### Usage Requires `TWITTER_CONSUMER_KEY` and `TWITTER_CONSUMER_SECRET`, both of which you can only get if you have a registered developer account and an application created for twitter. @@ -11,9 +11,9 @@ Requires `TWITTER_CONSUMER_KEY` and `TWITTER_CONSUMER_SECRET`, both of which you 1. Compile the server with `nimble build` and then start the server like so. ``` -./twit2blog +./tweetlog ``` -2. Install the bookmarklet (run `nimble bookmark` to generate it and then create a bookmark in your browser with it as the location). This requires `uglifyjs` to be installed for now. +2. Install the bookmarklet. Copy the contents of the `bookmarklet.min.js` file, and then create a bookmark in your browser with it as the location. You may read the unoptimized source in `bookmarklet.js`. 3. Go to a twitter thread, click the bookmarklet, it will open up a new page where your thread will eventually be. Wait a bit and come back to your beautifully archived thread! diff --git a/bookmarklet.js b/bookmarklet.js index 56f8604..47ce7f0 100644 --- a/bookmarklet.js +++ b/bookmarklet.js @@ -17,7 +17,6 @@ function getLastTweet() { var author = window.location.pathname.split('/')[1]; var xp = "//a[contains(@href, '"+author+"/status')]"; - return getLastXPath(xp).pathname; } diff --git a/bookmarklet.min.js b/bookmarklet.min.js new file mode 100644 index 0000000..ea7f280 --- /dev/null +++ b/bookmarklet.min.js @@ -0,0 +1 @@ +k="http://localhost:8080/thread"+b(),window.open(k,"_blank");function b(){return function(t){for(var n=document.evaluate(t,document,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),a=n.iterateNext(),e=a;null!=a&&null!=(a=n.iterateNext());)e=a;return e}("//a[contains(@href, '"+window.location.pathname.split("/")[1]+"/status')]").pathname}var k; diff --git a/src/tweetlogpkg/server.nim b/src/tweetlogpkg/server.nim index f063c10..91c806f 100644 --- a/src/tweetlogpkg/server.nim +++ b/src/tweetlogpkg/server.nim @@ -28,7 +28,7 @@ chan.open(20) # Database functions -let db = open("twit2blog.db", "", "", "") +let db = open("tweetlog.db", "", "", "") proc createTweetTable() = db.exec(sql"""CREATE TABLE IF NOT EXISTS threads ( diff --git a/tests/test1.nim b/tests/test1.nim index afc1c73..2c9ce43 100644 --- a/tests/test1.nim +++ b/tests/test1.nim @@ -7,6 +7,6 @@ import unittest -import twit2blogpkg/twitter +import tweetlogpkg/twitter #test "correct welcome": #check getWelcomeMessage() == "Hello, World!" diff --git a/tweetlog.nimble b/tweetlog.nimble index 69671fd..e8bd4ef 100644 --- a/tweetlog.nimble +++ b/tweetlog.nimble @@ -1,6 +1,6 @@ # Package -version = "0.1.0" +version = "0.11.0" author = "Wesley Kerfoot" description = "Turn Your Tweets Into Blog Posts" license = "MIT" @@ -14,6 +14,5 @@ requires "https://github.com/dom96/jester" requires "https://github.com/pragmagic/karax" task bookmark, "Builds the minified bookmarklet": - "bookmarklet.min.js".rmFile "echo -n 'javascript:' > ./bookmarklet.min.js".exec - "uglifyjs bookmarklet.js >> ./bookmarklet.min.js".exec + "uglifyjs --mangle --compress toplevel,sequences=false bookmarklet.js > ./bookmarklet.min.js".exec