diff --git a/Dockerfile b/Dockerfile
index ce2947a..83164d0 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -23,7 +23,12 @@ RUN lein uberjar
FROM clojure
WORKDIR /root/
+RUN apt-get update
+RUN apt-get -y install xvfb
+RUN apt-get -y install wkhtmltopdf
+
COPY --from=builder /usr/src/app/target/uberjar/commiteth.jar .
+COPY html2png.sh .
CMD [""]
ENTRYPOINT ["/usr/bin/java", "-Duser.timezone=UTC", "-Dconf=config-test.edn", "-jar", "/root/commiteth.jar"]
diff --git a/Jenkinsfile b/Jenkinsfile
index 219d449..4b24c0e 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -36,4 +36,4 @@ def dockerreponame = "statusim/openbounty-app"
// slackSend color: 'bad', message: REPO + ":" + BRANCH_NAME + ' failed to build. ' + env.BUILD_URL
throw e
}
-}
\ No newline at end of file
+}
diff --git a/README.md b/README.md
index de5fd30..ced4f88 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
# Status Open Bounty
+[![Riot Chat Badge](https://img.shields.io/badge/join%20%23openbounty-riot-green.svg)](https://chat.status.im/#/room/#openbounty:status.im)
Allows you to set bounties for Github issues, paid out in Ether or any ERC-20 token.
@@ -71,6 +72,7 @@ eth-account | Ethereum account ID for the bot
eth-password | Ethereum account password for the bot
eth-rpc-url | RPC URL to Ethereum node, e.g. Geth. Either local or remote
eth-wallet-file | Location of wallet file. If Geth is run with the parameters as given below, it will reside under `$HOME/.ropsten/keystore`
+offline-signing | Specifies whether to sign transactions locally before sending. Default is true. Set to false when connecting to local Geth node that unlocks accounts
tokenreg-base-format | Should be set to `:status`
github-client-id | Related to OAuth. Copied from GitHub account Settings->Developer settings->OAuth Apps
github-client-secret | Related to OAuth. Copied from GitHub account Settings->Developer settings->OAuth Apps
@@ -91,14 +93,22 @@ Follow the steps [here](https://developer.github.com/apps/building-github-apps/c
## Running
-### Geth
-Launch a local geth node with the bot account unlocked:
+### Ethereum node
+There are two options for connecting to an Ethereum node: either run a local node with an unlocked account, or connect to a remote Geth node or Infura. We will be connecting to Ropsten which is a test Ethereum network.
+
+#### Local
+
+In order to launch a local geth node with the bot account unlocked issue the following command:
```
#!/bin/bash
geth --fast --testnet --cache=1024 --datadir=$HOME/.ropsten --verbosity 4 --port 50100 --ipcpath ~/.ropsten/geth.ipc --rpc --rpcaddr 127.0.0.1 --rpcport 8545 --rpcapi db,eth,net,web3,personal --rpccorsdomain "https://wallet.ethereum.org" --unlock "0xYOUR_ADDR" --password <(echo "YOUR_PASSPHRASE")
```
+#### Remote
+Register at [Infura](https://infura.io/signup). You will receive an email with provider URLs. Paste an URL for the Ropsten network into `config.edn` under `:eth-rpc-url` key, and set `:offline-signing` to true.
+
+
### CSS auto-compilation
Launch the following command in a separate shell:
diff --git a/env/dev/resources/config.edn b/env/dev/resources/config.edn
index 571a6ae..1f8248f 100644
--- a/env/dev/resources/config.edn
+++ b/env/dev/resources/config.edn
@@ -14,6 +14,9 @@
:eth-rpc-url "http://localhost:8545"
:eth-wallet-file "/some/location"
+ ;; Specifies whether to sign transactions before sending. Should be false for local Geth, true for remote Infura
+ :offline-signing true
+
;; address of token registry to be used
;; this is the default value for ropsten
:tokenreg-addr "0x7d127a3e3b5e72cd8f15e7dee650abe4fcced2b9"
diff --git a/html2png.sh b/html2png.sh
new file mode 100755
index 0000000..781d8d5
--- /dev/null
+++ b/html2png.sh
@@ -0,0 +1,3 @@
+#!/bin/bash -eu
+# need to run wkhtmltoimage in quiet mode because it misuses stdout
+xvfb-run -a -s "-screen 0 640x480x16" wkhtmltoimage -q "$@" 2>/dev/null
diff --git a/project.clj b/project.clj
index 094f2f9..3711bfd 100644
--- a/project.clj
+++ b/project.clj
@@ -5,7 +5,7 @@
:exclusions [joda-time]]
[re-frame "0.10.2"]
[cljs-ajax "0.7.2"]
- [secretary "1.2.3"]
+ [funcool/bide "1.6.0"]
[reagent-utils "0.2.1"]
[reagent "0.7.0"]
[org.clojure/clojurescript "1.9.946"]
diff --git a/resources/sql/queries.sql b/resources/sql/queries.sql
index 2335e72..dbe24c3 100644
--- a/resources/sql/queries.sql
+++ b/resources/sql/queries.sql
@@ -102,19 +102,16 @@ WHERE i.repo_id = :repo_id
AND i.confirm_hash is null
AND i.is_open = true;
--- :name update-repo-generic :! :n
-/* :require [clojure.string :as string]
- [hugsql.parameters :refer [identifier-param-quote]] */
+-- :name update-repo-name :! :n
UPDATE repositories
-SET
-/*~
-(string/join ","
- (for [[field _] (:updates params)]
- (str (identifier-param-quote (name field) options)
- " = :v:updates." (name field))))
-~*/
-where repo_id = :repo_id;
+SET repo = :repo_name
+WHERE repo_id = :repo_id
+AND repo != :repo_name
+-- :name update-repo-state :! :n
+UPDATE repositories
+SET state = :repo_state
+WHERE repo_id = :repo_id
-- Issues --------------------------------------------------------------------------
@@ -401,6 +398,14 @@ SELECT exists(SELECT 1
FROM issues
WHERE issue_id = :issue_id);
+-- :name get-issue :? :1
+-- :doc get issue from DB by repo-id and issue-number
+SELECT issue_id, issue_number, is_open, winner_login, commit_sha
+FROM issues
+WHERE repo_id = :repo_id
+AND issue_number = :issue_number;
+
+
-- :name open-bounties :? :*
-- :doc all open bounty issues
diff --git a/resources/templates/home.html b/resources/templates/home.html
index 590156e..6afe0ca 100644
--- a/resources/templates/home.html
+++ b/resources/templates/home.html
@@ -65,6 +65,7 @@ height="0" width="0" style="display:none;visibility:hidden">
src="https://www.facebook.com/tr?id=293089407869419&ev=PageView&noscript=1"
/>
+