diff --git a/cmd/pollsvc/main.go b/cmd/pollsvc/main.go
index d944f9a..78abfc6 100644
--- a/cmd/pollsvc/main.go
+++ b/cmd/pollsvc/main.go
@@ -16,8 +16,8 @@ import (
"log"
"net/http"
"os"
- "path"
"path/filepath"
+ "strings"
"sync"
"time"
@@ -65,7 +65,7 @@ Possible flags are below.
return
}
- tc.Setup(path.Base(r.URL.Path))
+ tc.Setup(r.URL.Query().Get("name"))
rw.WriteHeader(http.StatusOK)
_, _ = rw.Write([]byte(tc.CurrentId()))
})
@@ -110,7 +110,7 @@ func (tc *talkConfig) Setup(name string) {
tc.mu.Lock()
defer tc.mu.Unlock()
suffix := sha256.Sum256([]byte(time.Now().String()))
- tc.talkId = name + "/" + hex.EncodeToString(suffix[:])
+ tc.talkId = strings.TrimSpace(name) + "/" + hex.EncodeToString(suffix[:])
}
func (tc *talkConfig) CurrentId() string {
diff --git a/cmd/pollsvc/www/index.html b/cmd/pollsvc/www/index.html
index cc08eb9..56bbf60 100644
--- a/cmd/pollsvc/www/index.html
+++ b/cmd/pollsvc/www/index.html
@@ -3,6 +3,8 @@
poll
+
+
+
+
Do you agree with the speaker?
@@ -43,9 +50,10 @@ Thanks for your participation!
const questions = [
{q: 'Do you agree with the speaker?', neg: 'No', pos: 'Yes'},
{q: 'Does it make sense?', neg: 'Not to me', pos: 'Sure'},
+ {q: 'Still following?', neg: 'You lost me', pos: "I'm all ears"},
];
- const deadline = Date.now() + 1000*60; // TODO.
+ const deadline = Date.now() + 1000*60*60;
function init(talkId) {
if (Date.now() >= deadline) {
@@ -112,10 +120,15 @@ Thanks for your participation!
}
currentTalkId().then(id => {
+ if (!id) {
+ return;
+ }
+
+ document.getElementById('talk-title').innerText = id.split('/')[0];
+
const reInit = () => init(id);
reInit();
- //const period = 1000*60*3; // TODO
- const period = 1000;
+ const period = 1000*60*3;
window.setInterval(reInit, period);
});
diff --git a/cmd/pollsvc/www/intro-link.html b/cmd/pollsvc/www/intro-link.html
deleted file mode 100644
index 66ccde6..0000000
--- a/cmd/pollsvc/www/intro-link.html
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
- How to join
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/start-presentation.sh b/start-presentation.sh
new file mode 100755
index 0000000..1de5215
--- /dev/null
+++ b/start-presentation.sh
@@ -0,0 +1,13 @@
+#!/usr/bin/env bash
+
+title=$1
+
+encoded_title=$(echo "$title" | jq -sRr @uri)
+
+talk_id=$(curl -f -X POST -H "Authorization: $(cat .creds/admin)" "https://poll.rmazur.io/config/new/$encoded_title" 2>/dev/null)
+
+link="https://poll.rmazur.io?id=$(echo "$talk_id" | jq -sRr @uri)"
+
+qrencode -o present/poll/qr.png "$link"
+
+cd present && present --base=.