From 26c2d912527ed053b8c4228ec40f4bf14ecffea9 Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:13:33 +0200 Subject: [PATCH 1/6] fix and refactor mitgucken guide - reorder account acquisition in front of login - rebox explainrole function - adjust external reference to function --- server/commands/guides.ts | 4 ++-- server/commands/mitgucken.ts | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/server/commands/guides.ts b/server/commands/guides.ts index 43c1302..bc281cc 100644 --- a/server/commands/guides.ts +++ b/server/commands/guides.ts @@ -5,7 +5,7 @@ import { accountChoice, joingroup, leavegroup, loginScreen, overview, resume, se import { logger } from '../logger' import { Command } from '../structures/command' import { RunOptions } from '../types/commandTypes' -import { configureServer, explainRoles, installation, loginInfo, useSyncgroup } from './mitgucken' +import { configureServer, explainRole, installation, loginInfo, useSyncgroup } from './mitgucken' export default new Command({ name: 'guides', @@ -70,7 +70,7 @@ export default new Command({ userDMChannel.send({ embeds: useSyncgroup(), files: [overview, joingroup, resume, leavegroup] }) } else if (guideSelection.customId === 'explainRoles') { const userDMChannel = await guideSelection.user.createDM() - userDMChannel.send(explainRoles()) + userDMChannel.send({ embeds: explainRole() }) } guideSelection.update({ content: "Hab ich dir per DM geschickt :)", components: [] }) diff --git a/server/commands/mitgucken.ts b/server/commands/mitgucken.ts index 68af7c9..e3a67ba 100644 --- a/server/commands/mitgucken.ts +++ b/server/commands/mitgucken.ts @@ -16,13 +16,9 @@ export default new Command({ const embedList: APIEmbed[] = [] embedList.push(...installation()) embedList.push(...configureServer()) + embedList.push(...explainRole()) embedList.push(...loginInfo()) embedList.push(...useSyncgroup()) - embedList.push({ - color, - title: "Wie du an einen Account kommst", - description: explainRoles() - }) //logger.info(`Trying to use ${splashScreen.name}`, { requestId, guildId: interaction.interaction.guild?.id }) logger.info(`Sending guide to ${interaction.interaction.user.id}`, { requestId, guildId: interaction.interaction.guild?.id }) @@ -32,6 +28,13 @@ export default new Command({ }) +export function explainRole(): APIEmbed[] { + return [{ + color, + title: "Wie du an einen Account kommst", + description: roleExplanation + }] +} export function installation(): APIEmbed[] { const embedList: APIEmbed[] = [] // DownloadLink and installation @@ -65,9 +68,9 @@ export function configureServer(): APIEmbed[] { embedList.push({ color, title: "Server Verbindung", - description: "Stelle eine Verbindung zum Hartzarett Jellyfin Server her", + description: "Stelle eine Verbindung zum Hartzarett Jellyfin Server her\nDie Adresse lautet:\nhttps://media.hartzarett.ruhr\n\n", fields: [ - { name: "Server Adresse", value: "https://media.hartzarett.ruhr" } + { name: "Server Adresse", value: "`https://media.hartzarett.ruhr`" } ], image: { url: 'attachment://server_verbindung.png' @@ -91,7 +94,7 @@ export function loginInfo(): APIEmbed[] { embedList.push({ color, title: "Login", - description: "Melde dich mit dem Usernamen und Passwort an, welches dir von mir zugeschickt wird. Falls du ein neues brauchst führe einmal /reset_passwort aus :)", + description: "Melde dich mit dem Usernamen und Passwort an, welches dir von mir zugeschickt wird. Falls du ein neues brauchst führe einmal `/passwort_reset` aus :)", image: { url: 'attachment://login_screen.png' } @@ -139,8 +142,7 @@ export function useSyncgroup(): APIEmbed[] { return embedList } -export function explainRoles(): string { - return `Mit einer Rolle kann dafür gesorgt werden, dass du einen dauerhaften Account auf dem Mediaserver hast. Wende dich bei Bedarf an Samantha oder Markus.\n +const roleExplanation = `Mit einer Rolle kann dafür gesorgt werden, dass du einen dauerhaften Account auf dem Mediaserver hast. Wende dich bei Bedarf an Samantha oder Markus.\n Für eine watchparty bekommst du allerdings automatisch einen Account. Hierfür melde einfach Interesse an dem Event an. Wenn du für das Event Interesse angemeldet hast bekommst du automatisch beim Start des Events einen Benutzernamen und das dazugehörige Passwort zugesendet.\n Hast du kein Interesse angemeldet bekommst du automatisch einen Nutzernamen und Passwort zugeschickt wenn du den Channel betrittst in dem das Event stattfindet.` -} \ No newline at end of file + From 7899aac5ce1e0f7f0315400e82a3c877c3073b45 Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:20:01 +0200 Subject: [PATCH 2/6] adjust server connection message remove extraneous repetition of the server address --- server/commands/mitgucken.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/commands/mitgucken.ts b/server/commands/mitgucken.ts index e3a67ba..c90a7f8 100644 --- a/server/commands/mitgucken.ts +++ b/server/commands/mitgucken.ts @@ -68,7 +68,7 @@ export function configureServer(): APIEmbed[] { embedList.push({ color, title: "Server Verbindung", - description: "Stelle eine Verbindung zum Hartzarett Jellyfin Server her\nDie Adresse lautet:\nhttps://media.hartzarett.ruhr\n\n", + description: "Stelle eine Verbindung zum Hartzarett Jellyfin Server her", fields: [ { name: "Server Adresse", value: "`https://media.hartzarett.ruhr`" } ], From 7c8072b295029894f03eb3665be629019942dca7 Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:20:54 +0200 Subject: [PATCH 3/6] add separate compile step should be run on every push to a branch to check for compilability --- .gitea/workflows/compile.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 .gitea/workflows/compile.yaml diff --git a/.gitea/workflows/compile.yaml b/.gitea/workflows/compile.yaml new file mode 100644 index 0000000..0309d61 --- /dev/null +++ b/.gitea/workflows/compile.yaml @@ -0,0 +1,17 @@ +name: Compile the repository +on: [push] +env: + REGISTRY: gitea.brudi.xyz + IMAGE_NAME: ${{ gitea.repository }} + USER: ${{ gitea.actor }} +jobs: + compile: + runs-on: ubuntu-latest + container: catthehacker/ubuntu:act-latest + permissions: + contents: read + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Build Container + run: docker build -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" . From ce4441cee3a669d778e1c87617a8f6bd299722bb Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:22:53 +0200 Subject: [PATCH 4/6] add restriction to master branch on docker push job --- .gitea/workflows/docker-build.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index 995fa23..d7dbeac 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -8,6 +8,7 @@ env: jobs: build-docker-image: runs-on: ubuntu-latest + if: gitea.ref == 'refs/heads/master' container: catthehacker/ubuntu:act-latest permissions: contents: read From 2c09033c3f79675c0b5f45c54137f2eac05ea28c Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:27:49 +0200 Subject: [PATCH 5/6] add new tag restriction to docker push job --- .gitea/workflows/docker-build.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index d7dbeac..eb3985f 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -1,6 +1,9 @@ name: Build a docker image for node-jellyfin-role-bot run-name: ${{ gitea.actor }} is building an image -on: [push] +on: + push: + tags: + - '*' env: REGISTRY: gitea.brudi.xyz IMAGE_NAME: ${{ gitea.repository }} From 1e6a75687a8e635706cc4e83a446542e62de81b4 Mon Sep 17 00:00:00 2001 From: mightypanders Date: Sat, 17 Jun 2023 01:31:03 +0200 Subject: [PATCH 6/6] add package version extraction to docker push job --- .gitea/workflows/docker-build.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/docker-build.yaml b/.gitea/workflows/docker-build.yaml index eb3985f..fe5fe7a 100644 --- a/.gitea/workflows/docker-build.yaml +++ b/.gitea/workflows/docker-build.yaml @@ -19,9 +19,11 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v3 + - name: Get Package Version + run: VERSION = node -p "require('./package.json').version" - name: Log in to the Container registry run: docker login -u ${{ env.USER }} -p ${{ secrets.TOKEN }} ${{ env.REGISTRY }} - name: Build Container - run: docker build -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" . + run: docker build -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" -t "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.VERSION }}". - name: Push Container run: docker push "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest"