-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
332 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,39 @@ | ||
FROM cgr.dev/chainguard/rust:latest-dev as build | ||
USER root | ||
RUN mkdir -p /usr/src/app | ||
ARG UBUNTU_RELEASE=22.04 | ||
|
||
FROM rust:1.79 AS builder | ||
|
||
WORKDIR /usr/src/app | ||
|
||
COPY . . | ||
RUN cargo build --bin monolith --release | ||
|
||
FROM cgr.dev/chainguard/cc-dynamic:latest | ||
|
||
|
||
# Build the chiselled filesystem based on the desired slices. | ||
FROM ubuntu:$UBUNTU_RELEASE AS chiselled | ||
ARG UBUNTU_RELEASE | ||
ARG TARGETARCH | ||
|
||
# Get chisel binary | ||
ADD https://github.com/canonical/chisel/releases/download/v0.9.1/chisel_v0.9.1_linux_$TARGETARCH.tar.gz chisel.tar.gz | ||
RUN tar -xvf chisel.tar.gz -C /usr/bin/ | ||
RUN apt-get update \ | ||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y ca-certificates | ||
|
||
WORKDIR /rootfs | ||
|
||
|
||
RUN chisel cut --release ubuntu-$UBUNTU_RELEASE --root /rootfs \ | ||
base-files_base \ | ||
base-files_release-info \ | ||
ca-certificates_data \ | ||
libgcc-s1_libs \ | ||
libc6_libs \ | ||
libssl3_libs | ||
|
||
FROM scratch | ||
COPY ./ai_manager_service/migrations /var/lib/db/migrations | ||
EXPOSE 9000 | ||
COPY --from=build --chown=nonroot:nonroot /usr/src/app/target/release/monolith /usr/local/bin/twitch-alerts | ||
CMD ["/usr/local/bin/monolith"] | ||
COPY --from=chiselled /rootfs / | ||
COPY --from=builder /usr/src/app/target/release/monolith /usr/local/bin/twitch-alerts | ||
CMD ["/usr/local/bin/twitch-alerts"] |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
:root { | ||
--font-size: 1.5vw; | ||
} | ||
|
||
div.wrapper { | ||
border-radius: 1vw; | ||
background-color: #2d3140; | ||
align-items: center; | ||
display: flex; | ||
flex-direction: column; | ||
background-image: url('../img/background.png'); | ||
background-size: cover; | ||
width: 30vw; | ||
height: 30vw; | ||
} | ||
|
||
p { | ||
color: #e8e8e8; | ||
font-size: var(--font-size); | ||
padding: 1.5vw; | ||
width: 95%; | ||
height: 90%; | ||
text-align: center; | ||
margin: 0; | ||
} | ||
|
||
p.message { | ||
width: 47%; | ||
height: 93%; | ||
text-align: center; | ||
margin: 0; | ||
font-size: var(--font-size); | ||
padding: 1vw; | ||
} | ||
|
||
p.event { | ||
text-align: center; | ||
margin-bottom: 0vw; | ||
margin-top: .7vw; | ||
font-size: var(--font-size); | ||
height: fit-content; | ||
padding: 1vw; | ||
font-weight: bold; | ||
} | ||
|
||
p.follow { | ||
color: black; | ||
} | ||
|
||
p.subscribe { | ||
color: #de4b35; | ||
} | ||
|
||
p.raid { | ||
color: #9147ff; | ||
} | ||
|
||
p.resubscribe { | ||
color: rgb(32, 117, 42); | ||
|
||
} | ||
|
||
|
||
h2.message { | ||
margin-bottom: .4vw; | ||
padding: 0vw; | ||
text-align: center; | ||
font-size: var(--font-size); | ||
} | ||
|
||
div#message { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
padding: 1.5vw; | ||
flex-direction: row; | ||
justify-content: space-around; | ||
align-items: center; | ||
} | ||
|
||
div#footer { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
padding: 1.5vw; | ||
flex-direction: row; | ||
justify-content: space-around; | ||
align-items: center; | ||
} | ||
|
||
span#sub { | ||
color: #9e2b25; | ||
font-size: 2vw; | ||
padding: 1.5vw; | ||
width: 95%; | ||
height: 90%; | ||
text-align: center; | ||
margin: 0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,111 @@ | ||
use maud::{html, Markup}; | ||
use messages::{DisplayMessage, TwitchEvent}; | ||
|
||
pub fn get_display_html(message: DisplayMessage) -> Markup { | ||
html! { | ||
@match &message.payload { | ||
TwitchEvent::ChannelFollow(follow) => { | ||
p class="event follow" { "Followed" } | ||
p class="message" { (message.message) } | ||
(get_html_name_follow(follow)) | ||
} | ||
TwitchEvent::ChannelSubscribe(sub) => { | ||
p class="event subscribe" { "Subscribed" } | ||
p class="message" { (message.message) } | ||
(get_html_name_channel_subscribe(sub)) | ||
} | ||
TwitchEvent::ChannelRaid(raid) => { | ||
p class="event raid" { "Raided" } | ||
p class="message" { (message.message) } | ||
(get_html_name_raid(raid)) | ||
} | ||
TwitchEvent::ChannelSubGift(gift) => { | ||
p class="event subgift" { "Gifted Sub!" } | ||
p class="message" { (message.message) } | ||
(get_html_name_sub_gift(gift)) | ||
} | ||
TwitchEvent::ChannelCheer(cheer) => { | ||
p class="event cheer" { "Cheered!" } | ||
p class="message" { (message.message) } | ||
(get_html_name_cheer(cheer)) | ||
} | ||
TwitchEvent::ChannelResubscribe(sub) => { | ||
p class="event resubscribe" { "Resubscribed" } | ||
p class="message" { (message.message) } | ||
(get_html_name_channel_subscribe(sub)) | ||
} | ||
} | ||
} | ||
} | ||
|
||
fn get_html_name_cheer(cheer: &messages::CheerEvent) -> Markup { | ||
html! { | ||
h2 class="message" { (format!("{}", cheer.user_name )) } | ||
} | ||
} | ||
|
||
fn get_html_name_raid(raid: &messages::RaidEvent) -> Markup { | ||
html! { | ||
h2 class="message" { (format!("{}", raid.from_broadcaster_user_name)) } | ||
} | ||
} | ||
|
||
fn get_html_name_sub_gift(gift: &messages::ChannelGiftMessage) -> Markup { | ||
if let Some(gifter) = gift.clone().user_name { | ||
html! { | ||
h2 class="message" { (format!("{}", gifter)) } | ||
} | ||
} else { | ||
html! { | ||
h2 class="message" { "Anonymous" } | ||
} | ||
} | ||
} | ||
|
||
fn get_html_name_follow(follow: &messages::FollowEvent) -> Markup { | ||
html! { | ||
h2 class="message" { (format!("{}", follow.user_name)) } | ||
} | ||
} | ||
|
||
fn get_html_name_channel_subscribe(sub: &messages::SubscribeEvent) -> Markup { | ||
html! { | ||
h2 class="message" { (format!("{}", sub.user_name)) } | ||
} | ||
} | ||
|
||
fn get_html_cheer(cheer: &messages::CheerEvent) -> Markup { | ||
html! { | ||
p { (format!("Thank you {} for cheering with {} bits", cheer.user_name, cheer.bits)) } | ||
} | ||
} | ||
|
||
fn get_html_raid(raid: &messages::RaidEvent) -> Markup { | ||
html! { | ||
p { (format!("Thank you {} for raiding with {} viewers", raid.from_broadcaster_user_name, raid.viewers)) } | ||
} | ||
} | ||
|
||
fn get_html_sub_gift(gift: &messages::ChannelGiftMessage) -> Markup { | ||
if let Some(gifter) = gift.clone().user_name { | ||
html! { | ||
p { (format!("Thank you {} for gifting a sub to {}", gifter, gift.broadcaster_user_name)) } | ||
} | ||
} else { | ||
html! { | ||
p { (format!("Thank you for gifting a sub to {}", gift.broadcaster_user_name)) } | ||
} | ||
} | ||
} | ||
|
||
fn get_html_follow(follow: &messages::FollowEvent) -> Markup { | ||
html! { | ||
p { (format!("Thank you {} for following", follow.user_name)) } | ||
} | ||
} | ||
|
||
fn get_html_channel_subscribe(sub: &messages::SubscribeEvent) -> Markup { | ||
html! { | ||
p { (format!("Thank you {} for subscribing", sub.user_name)) } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.