Commit cba80181 authored by Mario Botsch's avatar Mario Botsch

Merge branch 'master' into mario

parents ab4850f6 1de9a168
......@@ -114,7 +114,7 @@ test:win:
- win
stage: test
script:
- '& stack test -j1'
- "& stack test -j1"
cache:
key: test-win
paths:
......@@ -124,7 +124,6 @@ test:win:
- job: build:win
interruptible: true
deploy:mac:
stage: deploy
image:
......@@ -173,6 +172,26 @@ deploy:linux:
interruptible: true
resource_group: deploy_linux
deploy:docker:
stage: deploy
tags:
- docker
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context=$CI_PROJECT_DIR --dockerfile=$CI_PROJECT_DIR/Dockerfile-prebuilt --verbosity=warn --destination=$CI_REGISTRY_IMAGE:latest
needs:
- job: build:linux
artifacts: true
rules:
- if: '$CI_COMMIT_REF_NAME == "master"'
when: always
- if: '$CI_COMMIT_REF_NAME =~ /^v\d\.\d\.\d-patching$/'
when: always
interruptible: true
deploy:win:
stage: deploy
image:
......
FROM ubuntu:focal as decker
#set the encoding on UTF-8, so the parser works correctly, german language is also added for umlaute
#source of fix: https://blog.mkowalski.net/2016/05/16/solving-locale-issues-with-docker-containers/
RUN apt-get update && apt-get install --reinstall -y locales && \
sed -i 's/# de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /etc/locale.gen && \
locale-gen de_DE.UTF-8
ENV LANG de_DE.UTF-8
ENV LANGUAGE de_DE
ENV LC_ALL de_DE.UTF-8
RUN dpkg-reconfigure --frontend noninteractive locales
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get -y install tzdata
RUN apt-get install -y \
graphviz \
gnuplot \
rsync \
unzip \
zip
COPY decker /usr/bin/decker
WORKDIR /decker
ENTRYPOINT ["decker"]
export { contactEngine };
export {contactEngine};
// TODO Make into a proper Reveal plugin
const DEBUG = false;
const DEBUG = true;
const DEBUG_AUTH = false;
var timeout = 100; // ms
async function contactEngine(base) {
async function contactEngine(base, publicUrl) {
import(base + "/decker-util.js")
.then(engine => {
prepareEngine(engine.buildApi(base));
prepareEngine(engine.buildApi(base), publicUrl);
})
.catch(e => {
console.log("Can't contact decker engine:" + e);
......@@ -18,26 +18,27 @@ async function contactEngine(base) {
});
}
async function prepareEngine(api) {
async function prepareEngine(api, publicUrl) {
var serverToken;
api
.getToken()
.then(token => {
serverToken = token;
if (Reveal.isReady()) {
buildInterface(api, serverToken);
// buildOverview(api, serverToken);
buildInterface(api, serverToken, publicUrl);
//buildOverview(api, serverToken, publicUrl);
} else {
Reveal.addEventListener("ready", _ => {
buildInterface(api, serverToken);
// buildOverview(api, serverToken);
buildInterface(api, serverToken, publicUrl);
//buildOverview(api, serverToken, publicUrl);
});
}
if (Reveal.isReady() && Reveal.hasPlugin('menu') && Reveal.getPlugin('menu').isInit()) {
buildMenu(api, serverToken);
} else {
Reveal.addEventListener("menu-ready", _ => {
buildMenu(api, serverToken);
buildMenu(api, serverToken publicUrl);
});
}
})
......@@ -58,11 +59,12 @@ function deckId() {
return url.toString();
}
function buildInterface(api, initialToken) {
function buildInterface(api, initialToken, publicUrl) {
var serverToken = initialToken;
if (DEBUG) {
console.log("token:", initialToken);
console.log("publicUrl:", publicUrl);
}
let open = document.createElement("div");
......@@ -196,7 +198,7 @@ function buildInterface(api, initialToken) {
let getContext = () => {
return {
deck: deckId(),
deck: publicUrl || deckId(),
slide: Reveal.getCurrentSlide().id,
token: user.value
};
......@@ -384,7 +386,11 @@ function buildInterface(api, initialToken) {
updateComments();
} else {
api
.getLogin({ login: username.value, password: password.value })
.getLogin({
login: username.value,
password: password.value,
deck: publicUrl || deckId()
})
.then(token => {
serverToken.admin = token.admin;
login.classList.add("admin");
......@@ -393,7 +399,7 @@ function buildInterface(api, initialToken) {
credentials.classList.remove("visible");
updateComments();
})
.catch(e => {
.catch(_ => {
password.value = "";
});
}
......@@ -449,7 +455,7 @@ function buildInterface(api, initialToken) {
updateIds();
}
function buildOverview(api, initialToken) {
function buildOverview(api, initialToken, publicUrl) {
var serverToken = initialToken;
let slides = document.querySelector("div.reveal div.slides");
......@@ -496,10 +502,10 @@ function buildOverview(api, initialToken) {
link.setAttribute("href", `#${comment.slide}`);
link.textContent = comment.slide;
td1.appendChild(link);
let td2 = document.createElement("td");
td2.textContent = comment.votes;
let td3 = document.createElement("td");
td3.innerHTML = comment.html;
tr.appendChild(td1);
......@@ -510,14 +516,14 @@ function buildOverview(api, initialToken) {
};
api
.getComments(deckId())
.getComments(publicUrl || deckId())
.then(updateList)
.catch(console.log);
}
function buildMenu(api, initialToken) {
function buildMenu(api, initialToken, publicUrl) {
var serverToken = initialToken;
let updateMenu = list => {
......@@ -542,7 +548,7 @@ function buildMenu(api, initialToken) {
};
api
.getComments(deckId())
.getComments(publicUrl || deckId())
.then(updateMenu)
.catch(console.log);
}
......@@ -1481,7 +1481,23 @@ let RevealWhiteboard = (function(){
description: 'Toggle Whiteboard' },
toggleWhiteboard );
for (let i = 0; i < 7; i++) {
Reveal.addKeyBinding( { keyCode: 49+i, key: String.fromCharCode(49+i),
description: 'Toggle Whiteboard' },
() => { selectPenColor(penColors[i]); } );
}
Reveal.addKeyBinding( { keyCode: 56, key: '8',
description: 'Toggle Whiteboard' },
() => { selectPenRadius(2); } );
Reveal.addKeyBinding( { keyCode: 57, key: '9',
description: 'Toggle Whiteboard' },
() => { selectPenRadius(4); } );
Reveal.addKeyBinding( { keyCode: 48, key: '0',
description: 'Toggle Whiteboard' },
() => { selectPenRadius(6); } );
return {
init: function() {
......
......@@ -108,7 +108,7 @@ $endif$
$if(highlightjs)$
<link rel="stylesheet" href="$decker-support-dir$/plugins/highlight/$highlightjs$.css">
$endif$
$if(decker-engine-base-url)$
$if(decker-engine.base-url)$
<link rel="stylesheet" href="$decker-support-dir$/css/engine.css">
$endif$
$if(template.base-css)$
......@@ -299,10 +299,10 @@ $body$
prepareSAGE();
</script>
$if(decker-engine-base-url)$
$if(decker-engine.base-url)$
<script type="module" crossorigin>
import {contactEngine} from "./$decker-support-dir$/js/engine.js";
contactEngine("$decker-engine-base-url$")
contactEngine("$decker-engine.base-url$", "$decker-engine.public-url$")
.then(() => Reveal.sync());
</script>
$endif$
......
---
author: Henrik Tramberend
controls: 0
menu: 0
decker-engine:
base-url: 'https://tramberend.beuth-hochschule.de/de-api'
help: 0
decker-engine-base-url: 'https://tramberend.beuth-hochschule.de/de-api'
menu: 0
title: Decker Engine Auth Test
---
[:include](./engine-content.md)
---
author: Henrik Tramberend
controls: 0
decker-engine:
base-url: 'https://tramberend.beuth-hochschule.de/decker'
public-url: 'https://tramberend.beuth-hochschule.de/public/decker/test/decks/engine-deck.html'
help: 0
menu: 0
decker-engine-base-url: 'https://tramberend.beuth-hochschule.de/decker'
title: Decker Engine Test
help: 0
---
[:include](./engine-content.md)
---
author: Henrik Tramberend
controls: 0
decker-engine:
base-url: 'http://localhost:8081'
help: 0
menu: 0
decker-engine-base-url: 'http://localhost:8081'
title: Decker Engine Local Test
help: 0
---
[:include](./engine-content.md)
......@@ -325,10 +325,11 @@ or extending the information in the deck.
To enable this feature a deck must specify the URL of a Decker Engine
server in the meta data by setting the variable
`decker-engine-base-url`. For example:
`decker-engine.base-url`. For example:
``` {.yaml}
decker-engine-base-url: 'https://tramberend.beuth-hochschule.de/decker'
decker-engine:
base-url: 'https://tramberend.beuth-hochschule.de/decker'
```
### Endpoints with authorization
......@@ -344,7 +345,8 @@ authorization is necessary.
The `de-api` endpoint works that way:
``` {.yaml}
decker-engine-base-url: 'https://tramberend.beuth-hochschule.de/de-api'
decker-engine:
base-url: 'https://tramberend.beuth-hochschule.de/de-api'
```
### Public endpoints
......@@ -358,7 +360,8 @@ authenticate with a username and a password.
The `decker` endpoint works that way:
``` {.yaml}
decker-engine-base-url: 'https://tramberend.beuth-hochschule.de/decker'
decker-engine:
base-url: 'https://tramberend.beuth-hochschule.de/decker'
```
### Admistrators
......@@ -366,6 +369,25 @@ decker-engine-base-url: 'https://tramberend.beuth-hochschule.de/decker'
Users that are authorized as administrators can edit and delete all
questions in a set.
### Deck Identification
Decks are identified by their public URL. This can be problematic if a
deck is served locally, for example from
`http://localhost:8888/test/decks/engine-deck.html` during video
recording, but is supposed to show the questions on the published
version. For this situation the public URL of a deck can be set in the
meta data.
``` {.yaml}
decker-engine:
public-url: 'https://tramberend.beuth-hochschule.de/public/decker/test/decks/engine-deck.html'
```
If `decker-engine.public-url` is specified, it overrides the actual deck
URL as far as deck identification for decker engine is concerned. The
questions shown if the deck is served locally will be the questions
added where added to the published deck.
## Quizzes
### Class definition
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment