Browse Source

cleanup, proper nimble tasks, rename everything

master
Wesley Kerfoot 4 years ago
parent
commit
c6e84bfb51
  1. 4
      .gitignore
  2. 8
      README.md
  3. 1
      bookmarklet.js
  4. 1
      bookmarklet.min.js
  5. 2
      src/tweetlogpkg/server.nim
  6. 2
      tests/test1.nim
  7. 5
      tweetlog.nimble

4
.gitignore

@ -1,4 +1,4 @@
.envrc
twit2blog
twit2blog.db
tweetlog.db
bookmarklet.min.js
tweetlog

8
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!

1
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;
}

1
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;

2
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 (

2
tests/test1.nim

@ -7,6 +7,6 @@
import unittest
import twit2blogpkg/twitter
import tweetlogpkg/twitter
#test "correct welcome":
#check getWelcomeMessage() == "Hello, World!"

5
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

Loading…
Cancel
Save