Update github workflows & alerts

This commit is contained in:
Mononaut 2022-02-09 00:02:23 -06:00
parent 83cb8cb2e7
commit 5b53d15fa2
6 changed files with 120 additions and 8 deletions

View File

@ -6,7 +6,6 @@ permissions:
on: on:
push: push:
branches: branches:
- main
- master - master
jobs: jobs:
@ -42,12 +41,12 @@ jobs:
run: | run: |
docker buildx build \ docker buildx build \
--platform linux/amd64,linux/arm64 \ --platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-client:$BRANCH \ --tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-client:alpha \
--output "type=registry" ./client/ --output "type=registry" ./client/
- name: Build server images - name: Build server images
run: | run: |
docker buildx build \ docker buildx build \
--platform linux/amd64,linux/arm64 \ --platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-server:$BRANCH \ --tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-server:alpha \
--output "type=registry" ./server/ --output "type=registry" ./server/

View File

@ -42,6 +42,7 @@ jobs:
docker buildx build \ docker buildx build \
--platform linux/amd64,linux/arm64 \ --platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-client:$TAG \ --tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-client:$TAG \
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-client:master \
--output "type=registry" ./client/ --output "type=registry" ./client/
- name: Build server images - name: Build server images
@ -49,4 +50,5 @@ jobs:
docker buildx build \ docker buildx build \
--platform linux/amd64,linux/arm64 \ --platform linux/amd64,linux/arm64 \
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-server:$TAG \ --tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-server:$TAG \
--tag ghcr.io/${{ github.repository_owner }}/$IMAGE_NAME-server:master \
--output "type=registry" ./server/ --output "type=registry" ./server/

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -6,6 +6,7 @@ import ByMononaut from './ByMononaut.svelte'
import HeroMsg from './Hero.svelte' import HeroMsg from './Hero.svelte'
import SponsoredMsg from './Sponsored.svelte' import SponsoredMsg from './Sponsored.svelte'
import GenericAlert from './GenericAlert.svelte' import GenericAlert from './GenericAlert.svelte'
import GenericAlertv2 from './GenericAlertv2.svelte'
import { fly } from 'svelte/transition' import { fly } from 'svelte/transition'
const components = { const components = {
@ -13,15 +14,17 @@ const components = {
"sponsored-by": SponsoredMsg, "sponsored-by": SponsoredMsg,
// "be-a-hero": BeAHero, // "be-a-hero": BeAHero,
"thank-you-hero": HeroMsg, "thank-you-hero": HeroMsg,
msg: GenericAlert msg: GenericAlert,
msg2: GenericAlertv2,
} }
let ready let ready
$: { $: {
ready = { ready = {
mononaut: true, mononaut: true,
"sponsored-by": SponsoredMsg, "sponsored-by": true,
"thank-you-hero": $haveSupporters ? HeroMsg : null, "thank-you-hero": $haveSupporters ? HeroMsg : null,
msg: GenericAlert msg: true,
msg2: true,
} }
} }
@ -49,7 +52,7 @@ $: {
} }
function processAlert (alert) { function processAlert (alert) {
if (alert && alert.type && components[alert.type] && ready[alert.type]) { if (alert && alert.type && components[alert.type] && ready[alert.type] && (!alert.publicOnly || config.public)) {
if (!sequences[alert.key]) sequences[alert.key] = 0 if (!sequences[alert.key]) sequences[alert.key] = 0
return { return {
...alert, ...alert,

View File

@ -0,0 +1,108 @@
<script>
export let msg
export let shortmsg = null
export let imgs
let displayImgs = []
function chooseImgs () {
displayImgs = []
const randomIndex = Math.floor(Math.random() * imgs.length)
for (let i = 0; i < Math.min(3, imgs.length); i++) {
const randomImg = imgs[(randomIndex + i) % imgs.length]
displayImgs.push(randomImg)
}
}
$: {
if (imgs && !displayImgs.length) {
chooseImgs()
}
}
</script>
<div class="alert-content">
<p class="msg">
{@html msg }
</p>
<p class="shortmsg">
{@html shortmsg || msg }
</p>
<div class="imgs">
{#each displayImgs as img}
{#if img.href }
<a href={img.href} target="_blank">
<img src={img.img} alt={img.name} title={img.name} class="image">
</a>
{:else}
<img src={img.img} alt={img.name} title={img.name} class="image">
{/if}
{/each}
</div>
</div>
<style type="text/scss">
.alert-content {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
color: var(--palette-x);
.imgs {
height: 2.5em;
width: 7.5em;
margin-left: 10px;
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
flex-shrink: 1;
min-width: 6em;
.image {
width: 2.3em;
height: 2.3em;
margin: 0 0.1em;
border-radius: 50%;
object-fit: contain;
}
}
@media screen and (max-width: 480px) {
.imgs {
max-width: 5em;
.image:nth-child(3) {
display: none;
}
}
}
}
.msg, .shortmsg {
margin: 0;
font-size: .9em;
width: 100%;
text-align: center;
max-height: 100%;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
.shortmsg {
display: none;
}
img {
height: 2.8em;
}
@media screen and (max-width: 480px) {
.shortmsg {
display: inline;
}
.msg {
display: none;
}
}
</style>