21 Commits
1.0.7 ... 1.1.5

Author SHA1 Message Date
gitea
d0a6a9ce3f [no ci] release 1.1.5 2025-02-16 16:13:12 +00:00
87f4d71cc9 moves userId to index
All checks were successful
CI / deploy (push) Successful in 5m49s
2025-02-16 17:07:24 +01:00
gitea
53a047217a [no ci] prepare new Version 2025-02-16 15:40:18 +00:00
gitea
3dbd19ee3b [no ci] release 1.1.4 2025-02-16 15:40:09 +00:00
c0415561ee fixes rich-preview
All checks were successful
CI / deploy (push) Successful in 6m0s
2025-02-16 16:31:53 +01:00
gitea
7b9143c26d [no ci] prepare new Version 2025-02-16 14:56:49 +00:00
gitea
a21db87b98 [no ci] release 1.1.3 2025-02-16 14:56:42 +00:00
f1c5792a12 Merge pull request 'deploy to dice-tower.com' (#32) from rich-preview into main
All checks were successful
CI / deploy (push) Successful in 5m59s
Reviewed-on: #32
2025-02-16 15:50:49 +01:00
d163160eb6 deploy to dice-tower.com
All checks were successful
CI / deploy (push) Successful in 5m44s
CI / deploy (pull_request) Successful in 5m23s
2025-02-16 15:35:25 +01:00
gitea
1c7e793fb2 [no ci] prepare new Version 2025-02-16 12:39:04 +00:00
gitea
cb1d34fd09 [no ci] release 1.1.2 2025-02-16 12:38:55 +00:00
8a212a5044 Merge pull request 'adds html rich preview' (#31) from rich-preview into main
All checks were successful
CI / deploy (push) Successful in 10m46s
Reviewed-on: #31
2025-02-16 13:28:16 +01:00
09473f627b adds html rich preview
All checks were successful
CI / deploy (push) Successful in 5m15s
CI / deploy (pull_request) Successful in 10m10s
2025-02-16 12:56:33 +01:00
gitea
fbfd23d335 [no ci] prepare new Version 2025-02-12 17:07:20 +00:00
gitea
0ccbd9dd0b [no ci] release 1.1.1 2025-02-12 17:07:14 +00:00
b79c2b1e42 adds user to chatoverlay
All checks were successful
CI / deploy (push) Successful in 4m50s
2025-02-12 18:02:24 +01:00
gitea
f3f788ea51 [no ci] prepare new Version 2025-02-12 15:20:36 +00:00
gitea
cd5417d1d1 [no ci] release 1.1.0 2025-02-12 15:20:29 +00:00
f3e8432452 Merge pull request 'creates chatoverlay' (#30) from chatoverlay into main
All checks were successful
CI / deploy (push) Successful in 4m48s
Reviewed-on: #30
2025-02-12 16:15:48 +01:00
1eae3a8bbf creates chatoverlay
All checks were successful
CI / deploy (push) Successful in 4m25s
CI / deploy (pull_request) Successful in 4m28s
2025-02-12 16:06:22 +01:00
gitea
dd1497c432 [no ci] prepare new Version 2025-02-12 12:28:34 +00:00
12 changed files with 343 additions and 9 deletions

View File

@@ -43,7 +43,14 @@ jobs:
name: Version
run: echo "VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)" >> ${GITHUB_OUTPUT}
- name: Build Container
- name: Build unstable Container
if: github.ref_name != 'main'
run: |
echo ${{secrets.PACKAGES_TOKEN}} | docker login --username ${{ secrets.PACKAGES_USER }} --password-stdin git.arindy.de
docker build -f src/main/docker/Dockerfile.native-micro -t git.arindy.de/arindy/dice-tower:unstable -t git.arindy.de/arindy/dice-tower:${{ steps.version.outputs.VERSION }} .
docker push git.arindy.de/arindy/dice-tower:unstable
- name: Build stable Container
if: github.ref_name == 'main'
run: |
echo ${{secrets.PACKAGES_TOKEN}} | docker login --username ${{ secrets.PACKAGES_USER }} --password-stdin git.arindy.de
@@ -51,10 +58,28 @@ jobs:
docker push git.arindy.de/arindy/dice-tower:${{ steps.version.outputs.VERSION }}
docker push git.arindy.de/arindy/dice-tower:latest
- name: Prepare deploy
run: |
echo ${{secrets.SSH_KNOWN_HOSTS}} >> ~/.ssh/known_hosts
base64 -d <<< ${{secrets.SSH_KEY}} > ./.key
chmod 600 ./.key
- name: Deploy unstable
if: github.ref_name != 'main'
run: "ssh -i ./.key dice-tower@${{secrets.SSH_HOST}} 'docker compose -f compose.unstable.yml pull && docker compose -f compose.unstable.yml up -d' "
- name: Deploy
if: github.ref_name == 'main'
run: "ssh -i ./.key dice-tower@${{secrets.SSH_HOST}} 'docker compose -f compose.yml pull && docker compose -f compose.yml up -d' "
- name: Deploy local
if: github.ref_name == 'main'
run: "docker compose up -d"
- name: clean up
run: |
rm ./.key
- name: create tag
if: github.ref_name == 'main'
run: |

2
.gitignore vendored
View File

@@ -124,3 +124,5 @@ fabric.properties
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
.key
.key/

View File

@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>de.arindy</groupId>
<artifactId>dice-tower</artifactId>
<version>1.0.7</version>
<version>1.1.5</version>
<properties>
<compiler-plugin.version>3.13.0</compiler-plugin.version>

View File

@@ -0,0 +1,40 @@
package de.arindy.dicetower
import io.quarkus.qute.TemplateInstance
import jakarta.ws.rs.GET
import jakarta.ws.rs.Path
import jakarta.ws.rs.PathParam
import jakarta.ws.rs.Produces
import jakarta.ws.rs.QueryParam
import jakarta.ws.rs.core.MediaType
@Path("chatoverlay")
class ChatOverlayResource {
@GET
@Path("/{channel}")
@Produces(MediaType.TEXT_HTML)
fun get(
@PathParam("channel") channel: String,
@QueryParam("scale") scale: Int? = 7,
@QueryParam("maxDice") maxDice: Int? = 20,
@QueryParam("modsAllowed") modsAllowed: Boolean = false,
@QueryParam("vipAllowed") vipAllowed: Boolean = false,
@QueryParam("subsAllowed") subsAllowed: Boolean = false,
@QueryParam("cmd") cmd: String? = "roll",
@QueryParam("theme") theme: String? = "default",
@QueryParam("themeColor") themeColor: String? = "default",
@QueryParam("clearAfter") clearAfter: Long? = -1,
@QueryParam("timeout") timeout: Long? = -1
): TemplateInstance {
return Templates.chatoverlay(channel, scale ?: 7, maxDice ?: 20, modsAllowed, vipAllowed, subsAllowed, cmd ?: "roll", theme ?: "default", themeColor ?: "ff0202", clearAfter ?: 10, timeout ?: 60)
}
@GET
@Produces(MediaType.TEXT_HTML)
fun config(
): TemplateInstance {
return Templates.chatoverlayconfig()
}
}

View File

@@ -7,8 +7,28 @@ import io.quarkus.qute.TemplateInstance
object Templates {
@JvmStatic
external fun overlay(diceid: String, scale: Int?, clearAfter: Long?): TemplateInstance
@JvmStatic
external fun results(room: String, name: String?, user: String?): TemplateInstance
@JvmStatic
external fun index(version: String): TemplateInstance
@JvmStatic
external fun chatoverlayconfig(): TemplateInstance
@JvmStatic
external fun chatoverlay(
channel: String,
scale: Int?,
maxDice: Int?,
modsAllowed: Boolean,
vipAllowed: Boolean,
subsAllowed: Boolean,
cmd: String?,
theme: String?,
themeColor: String?,
clearAfter: Long?,
timeout: Long?
): TemplateInstance
}

View File

@@ -27,6 +27,7 @@ function start(event = undefined) {
document.getElementById('name').hidden = true;
document.getElementById('room').hidden = true;
document.getElementById('how-to').hidden = true;
document.getElementById('chatOverlay').hidden = true;
document.getElementById('results').hidden = false;
document.getElementById('all-results').hidden = !document.getElementById('gm').checked;
document.getElementById('all-results-urls').style.display = document.getElementById('gm').checked ? 'fles' : 'none';
@@ -178,11 +179,7 @@ document.addEventListener("DOMContentLoaded", async () => {
}
})
document.addEventListener("DOMContentLoaded", async () => {
if (!localStorage.getItem("userId")) {
localStorage.setItem("userId", self.crypto.randomUUID());
}
})
document.getElementById('chatOverlayLink').href = url() + '/chatoverlay'
configurePopover();
})

View File

@@ -24,3 +24,13 @@ body {
width: 100%;
height: 100%;
}
.tooltip {
position: fixed;
border-radius: 0.5rem;
padding: 15px;
max-width: 80%;
font-size: 400%;
color: #fff; !important;
background-color: #333333dd; !important
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dice-Tower - Overlay</title>
<link rel="icon" type="image/png" href="/favicon.png">
<link rel="stylesheet" href="/overlay/style.css">
<script src="/vendor/comfy.js/comfy.min.js"></script>
</head>
<body>
<div id="dice-box"></div>
<div popover id="results" class="tooltip">
</div>
<script type="module">
import DiceBox from "/vendor/dice-box/dice-box.es.js";
const diceBox = new DiceBox("#dice-box", {
assetPath: "/vendor/assets/",
theme: '{theme}',
themeColor: '{themeColor}',
scale: {scale}
});
diceBox.init()
ComfyJS.Init('{channel}');
//maxDice
ComfyJS.onCommand = async (user, command, message, flags) => {
if ((
flags.broadcaster || ({modsAllowed} && flags.mod) || ({vipAllowed} && flags.vip) || ({subsAllowed} && flags.subscriber
)) && '{cmd}' === command && !shouldWait() && message.match(/^\d+d(4|6|8|10|12|20|100)$/) && (+message.split('d')[0] <= {maxDice})
) {
toggleWait(true);
diceBox.onRollComplete = (rollResult) => {
rollResult.forEach(result => {
let values = []
result.rolls.forEach(roll => {
values.push(roll.value);
})
document.getElementById('results').innerHTML = '<strong>' + user + '</strong> rolls <strong>' + message + '</strong>:<br/> [' + values.map(value => value === 1 ? '<strong style="text-shadow: 2px 2px 10px red">' + value + '</strong>' : value === result.sides ? '<strong style="text-shadow: 2px 2px 10px green">' + value + '</strong>' : value).join(' + ') + (result.modifier > 0 ? ' <a style="text-decoration: underline">+' + result.modifier + '</a>' : result.modifier < 0 ? ' <a style="text-decoration: underline">' + result.modifier + '</a>' : '') + '] = <strong>' + result.value + '</strong> '
})
document.getElementById('results').showPopover()
setTimeout(() => {
diceBox.clear();
document.getElementById('results').hidePopover()
}, {clearAfter} * 1000)
}
diceBox.roll(message);
setTimeout(() => {
toggleWait(false);
}, {clearAfter} * 1000 + {timeout} * 1000)
} else {
console.log('Not a valid command or not ready yet');
}
};
let wait;
function shouldWait() {
return wait;
}
function toggleWait(value) {
wait = value;
}
</script>
</body>
</html>

View File

@@ -0,0 +1,142 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Dice-Tower - Chatoverlay</title>
<link rel="stylesheet" href="/vendor/w3css/4/w3.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/fontawesome.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/all.css">
<link rel="stylesheet" href="/style.css">
<link rel="icon" type="image/png" href="/favicon.png">
<script src="/vendor/color-picker.js"></script>
</head>
<body class="w3-theme-l1">
<div class="w3-container w3-content"
style="height: 95vh; display: flex; flex-direction: column; justify-content: space-between; padding: 25px">
<h1 style="text-align: center"><i class="fa-solid fa-dice-d20"></i> Dice-Tower - Chatoverlay <i
class="fa-solid fa-dice-d20"></i></h1>
<div class="w3-panel w3-theme-l4 w3-card w3-display-container" style="padding: 25px; text-align: center;">
<p>Allows Chat to roll a given amount of one dice</p>
<p>Example: "!roll 5d20"</p>
</div>
<div class="w3-panel w3-theme-l4 w3-card w3-display-container"
style="padding: 25px; text-align: center; margin-bottom: auto;">
<label for="theme">Theme </label>
<select name="theme" id="theme" style="margin: 25px">
<option value="default">Default</option>
<option value="blueGreenMetal">Blue-Green Metal</option>
<option value="diceOfRolling">Dice of Rolling</option>
<option value="gemstone">Gemstone</option>
<option value="gemstoneMarble">Marble Gemstone</option>
<option value="rock">Rock</option>
<option value="rust">Rust</option>
<option value="smooth">Smooth</option>
<option value="wooden">Wooden</option>
</select>
<color-picker id="themeColor"></color-picker>
<div>
<label for="channel">Channel </label>
<input type="text" id="channel" style="width: 400px; margin-top: 20px" value="arindy"/>
<label for="cmd">Command !</label>
<input type="text" id="cmd" style="width: 100px; margin-top: 20px; margin-left: 0" value="roll"/>
</div>
<div>
<label class="checkbox" id="modsAllowed-container">Allow mods to roll
<input type="checkbox" id="modsAllowed">
<span class="checkmark"></span>
</label>
<label class="checkbox" id="vipAllowed-container">Allow VIPs to roll
<input type="checkbox" id="vipAllowed">
<span class="checkmark"></span>
</label>
<label class="checkbox" id="subsAllowed-container">Allow subs to roll
<input type="checkbox" id="subsAllowed">
<span class="checkmark"></span>
</label>
</div>
<div>
<label for="scale">Dice-Scale </label>
<input type="number" id="scale" style="width: 50px; margin-top: 20px" value="9"/>
<label for="maxDice">Max number of dice </label>
<input type="number" id="maxDice" style="width: 50px; margin-top: 20px" value="20"/>
</div>
<div>
<label for="clearAfter">Clear dice after (in seconds)</label>
<input type="number" id="clearAfter" style="width: 50px; margin-top: 20px" value="10"/>
<label for="timeout">Command-timeout (in seconds)</label>
<input type="number" id="timeout" style="width: 50px; margin-top: 20px" value="60"/>
</div>
<div id="dice-box" style="height: 400px"></div>
<button style="margin: 10px" id="preview">Preview <i class="fa-solid fa-magnifying-glass"></i></button>
<button style="margin: 10px" id="generate">Generate overlay-link <i class="fa-solid fa-link"></i></button>
<div>
<input type="text" readonly id="link" style="width: 80%; margin-top: 20px"
onclick="copyToClipboard(this.id)"/>
</div>
</div>
</div>
<div id="snackbar-container">
<div id="snackbar">.. they see them rolling</div>
</div>
<script>
function copyToClipboard(id) {
let copyText = document.getElementById(id)
if (copyText.value.length > 0) {
copyText.select();
copyText.setSelectionRange(0, 99999);
navigator.clipboard.writeText(copyText.value).then(() => {
showSnackbar("<i class='fa-regular fa-copy'></i> Link copied to clipboard: <br/>" + copyText.value);
})
}
}
function showSnackbar(message) {
let snackbar = document.getElementById("snackbar");
let snackbarContainer = document.getElementById("snackbar-container");
snackbar.innerHTML = message;
snackbar.className = "show";
snackbarContainer.className = "show";
setTimeout(() => {
snackbar.className = "";
snackbarContainer.className = "";
}, 3000)
}
</script>
<script type="module">
import DiceBox from "/vendor/dice-box/dice-box.es.js";
function url() {
return window.location.protocol + '//' + window.location.hostname + (window.location.port?.length > 0 ? ':' + window.location.port : '');
}
document.addEventListener("DOMContentLoaded", async () => {
document.getElementById('preview').onclick = async () => {
document.getElementById('dice-box').replaceChildren(...[])
const diceBox = new DiceBox("#dice-box", {
assetPath: "/vendor/assets/",
theme: document.getElementById('theme').value,
themeColor: document.getElementById('themeColor').value,
scale: +document.getElementById('scale').value
});
await diceBox.init()
diceBox.roll(['1d2', '1d4', '1d6', '1d8', '1d10', '1d12', '1d20', '1d100']);
}
document.getElementById('generate').onclick = async () => {
document.getElementById('link').value = url() +
"/chatoverlay/" + document.getElementById('channel').value +
"?cmd=" + document.getElementById('cmd').value +
"&theme=" + document.getElementById('theme').value +
"&themeColor=" + encodeURIComponent(document.getElementById('themeColor').value) +
"&scale=" + document.getElementById('scale').value +
"&maxDice=" + document.getElementById('maxDice').value +
"&clearAfter=" + document.getElementById('clearAfter').value +
"&timeout=" + document.getElementById('timeout').value +
"&modsAllowed=" + document.getElementById('modsAllowed').checked +
"&vipAllowed=" + document.getElementById('vipAllowed').checked +
"&subsAllowed=" + document.getElementById('subsAllowed').checked
}
})
</script>
</body>
</html>

View File

@@ -3,6 +3,8 @@
<head>
<meta charset="UTF-8">
<title>Dice-Tower</title>
<meta name="version" content="{version}">
<link rel="stylesheet" href="/vendor/w3css/4/w3.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/fontawesome.css">
<link rel="stylesheet" href="/vendor/font-awesome/css/all.css">
@@ -11,12 +13,32 @@
<script src="/vendor/color-picker.js"></script>
<script type="module" src="/dice-preview.js"></script>
<script type="text/javascript" src="/app.js"></script>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="Dice-Tower">
<meta name="twitter:image" content="{http:request.scheme}://{http:request.authority}/rich.png">
<meta name="description" content="Easy to use online dice rolling with customizable overlays.">
<meta name="twitter:description" content="Easy to use online dice rolling with customizable overlays.">
<meta property="og:url" content="{http:request.absoluteURI}">
<meta property="og:image" content="{http:request.scheme}://{http:request.authority}/rich.png">
<meta property="og:description" content="Easy to use online dice rolling with customizable overlays.">
<meta property="og:title" content="Dice-Tower">
<meta property="og:site_name" content="Dice-Tower">
<meta property="og:type" content="website">
<meta property="twitter:url" content="{http:request.absoluteURI}">
<meta property="twitter:domain" content="{http:request.authority}">
</head>
<body class="w3-theme-l1">
<script>
if (!localStorage.getItem("userId")) {
localStorage.setItem("userId", self.crypto.randomUUID());
}
</script>
<div class="w3-container w3-content"
style="height: 95vh; display: flex; flex-direction: column; justify-content: space-between; padding: 25px">
<h1 style="text-align: center"><i class="fa-solid fa-dice-d20"></i> Dice-Tower <i class="fa-solid fa-dice-d20"></i>
</h1>
<div class="w3-panel w3-theme-l4 w3-card w3-display-container"
style="padding: 25px; text-align: center; margin-bottom: auto;">
<h2 id="nameH" popovertarget="room-hint" data-trigger="hover" style="margin: 0" hidden>Name</h2>
@@ -150,8 +172,8 @@
<p>How is your character called?</p>
</div>
<div style="margin-top: 20px; flex-grow: 1" id="how-to">
<div class="w3-panel w3-theme-l4 w3-card w3-display-container" style="padding: 25px; margin-bottom: auto">
<div style="margin-top: 20px" id="how-to">
<div class="w3-panel w3-theme-l4 w3-card w3-display-container" style="padding: 25px;">
<h2 style="text-align: center">How-To</h2>
<ul>
<li>
@@ -174,6 +196,11 @@
</ul>
</div>
</div>
<div style="margin-top: 20px; flex-grow: 1" id="chatOverlay">
<div class="w3-panel w3-theme-l4 w3-card w3-display-container" style="padding: 25px; margin-bottom: auto">
If you are looking for a way to let your twitch chat roll click <a href target="_blank" id="chatOverlayLink">here</a>
</div>
</div>
</div>
<div id="snackbar-container">
<div id="snackbar">.. they see them rolling</div>