Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ name: CI

on:
push:
branches: [development, master]
branches:
- development
- master
pull_request:
branches: [development, master]
branches:
- development
- master

jobs:
prepare:
Expand All @@ -17,13 +21,13 @@ jobs:
version: ${{ steps.version.outputs.prop }}
commit: ${{ steps.set-commit.outputs.commit }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: get version
id: version
uses: notiz-dev/github-action-json-property@v0.2.0
with:
path: 'package.json'
prop_path: 'version'
path: "package.json"
prop_path: "version"
- name: set commit
id: set-commit
run: echo "commit=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -51,12 +55,11 @@ jobs:
images: ghcr.io/codeanker/brahmsee.digital
tags: type=sha,prefix=
- name: Build and push
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
commitHash=${{needs.prepare.outputs.commit}}
version=${{needs.prepare.outputs.version}}
mode=${{ env.MODE }}
21 changes: 13 additions & 8 deletions .github/workflows/code-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,22 @@ name: code-checks

on:
push:
branches: [main, master, development, feature/**, hotfix/**]
branches:
- main
- master
- development
- feature/**
- hotfix/**

jobs:
turbo-checks:
name: 🔍 turbo-checks
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
uses: actions/checkout@v6
- name: Cache turbo build setup
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
Expand All @@ -22,13 +27,13 @@ jobs:
uses: pnpm/action-setup@v4
with:
run_install: false
- name: Use Node.js 18
uses: actions/setup-node@v4
- name: Use Node.js 22
uses: actions/setup-node@v6
with:
node-version: 18
cache: 'pnpm'
node-version: 22
cache: "pnpm"
- name: corepack
run: corepack enable
run: corepack enable
- name: Install dependencies
run: |
export COREPACK_INTEGRITY_KEYS="$(curl https://registry.npmjs.org/-/npm/v1/keys | jq -c '{npm: .keys}')"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/gh-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ name: GitHub Release
on:
push:
tags:
- 'v*.*.*'
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
11 changes: 6 additions & 5 deletions .github/workflows/helm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ jobs:
version: ${{ steps.version.outputs.prop }}
commit: ${{ steps.set-commit.outputs.commit }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v6
- name: get version
id: version
uses: notiz-dev/github-action-json-property@v0.2.0
with:
path: 'package.json'
prop_path: 'version'
path: "package.json"
prop_path: "version"
- name: set commit
id: set-commit
run: echo "commit=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT

release:
needs: prepare
permissions:
Expand All @@ -33,7 +34,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v6
with:
fetch-depth: 0

Expand All @@ -45,7 +46,7 @@ jobs:
sed -i "s/commit: .*/commit: ${{ needs.prepare.outputs.commit }}/g" chart/brahmsee-digital/values.yaml

- name: Chart | Push brahmsee-digital
uses: appany/helm-oci-chart-releaser@v0.3.0
uses: appany/helm-oci-chart-releaser@v0.5.0
with:
name: brahmsee-digital
repository: codeanker/brahmsee.digital
Expand Down
5 changes: 1 addition & 4 deletions .husky/pre-commit
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

pnpm run lint
npm run lint
16 changes: 4 additions & 12 deletions apps/api/src/routes/oidc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,14 @@ oidcRouter.get('/dlrg/callback', async (c) => {
Authorization: `Bearer ${result.access_token}`,
},
})
const profileRaw = await userInfoResponse.json()
const profileRaw = await userInfoResponse.json() as Record<string, unknown>
const profile = ZProfile.parse(profileRaw)
const existingUser = await prisma.account.findUnique({
where: {
dlrgOauthId: profile.sub,
},
})

let registerAsGliederung = false
const registerAs = c.req.query('as')?.trim()
if (registerAs !== undefined && registerAs?.length > 0) {
registerAsGliederung = true
}

let account: Account

// if user exists, return jwt
Expand All @@ -105,8 +99,8 @@ oidcRouter.get('/dlrg/callback', async (c) => {
dlrgOauthId: profile.sub,
email: profile.email,
password: '',
role: registerAsGliederung ? 'GLIEDERUNG_ADMIN' : 'USER',
status: registerAsGliederung ? 'OFFEN' : 'AKTIV',
role: 'USER',
status: 'AKTIV',
activatedAt: new Date(),
person: {
create: {
Expand All @@ -120,9 +114,7 @@ oidcRouter.get('/dlrg/callback', async (c) => {
})
}

// TODO: Implement onboarding
const redirectUri = new URL(registerAsGliederung ? '/onboarding' : '/login', config.clientUrl)

const redirectUri = new URL('/login', config.clientUrl)
const jwt = sign({
sub: account.id.toString(),
})
Expand Down
1 change: 1 addition & 0 deletions apps/api/src/services/account/accountVerwaltungGet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const accountVerwaltungGetProcedure = defineProtectedQueryProcedure({
status: true,
role: true,
dlrgOauthId: true,
personId: true,
person: {
select: {
firstname: true,
Expand Down
9 changes: 9 additions & 0 deletions apps/api/src/services/anmeldungLink/anmeldeLink.list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ export const anmeldungLinkListProcedure = defineProtectedQueryProcedure({
name: true,
},
},
veranstaltung: {
select: {
hostname: {
select: {
hostname: true,
}
}
}
}
},
},
anmeldung: {
Expand Down
6 changes: 2 additions & 4 deletions apps/api/src/services/person/personList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ export const personListProcedure = defineProtectedQueryProcedure({
},
]
: undefined,
gliederung: {
gliederung: filter?.gliederung_name === undefined ? undefined : {
name: {
contains: filter?.gliederung_name,
contains: filter.gliederung_name,
mode: 'insensitive',
},
},
Expand All @@ -58,8 +58,6 @@ export const personListProcedure = defineProtectedQueryProcedure({
const total = await prisma.person.count({ where })
const { pageIndex, pageSize, pages } = calculatePagination(total, pagination)

console.log(orderBy)

const persons = await prisma.person.findMany({
take: pageSize,
skip: pageSize * pageIndex,
Expand Down
2 changes: 2 additions & 0 deletions apps/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"radix-vue": "^1.9.5",
"reka-ui": "^2.1.1",
"remixicon": "^3.5.0",
"sanitize-html": "^2.17.1",
"simple-syntax-highlighter": "^3.1.1",
"superjson": "catalog:",
"tailwind-merge": "^2.6.0",
Expand All @@ -56,6 +57,7 @@
"@codeanker/eslint-config": "workspace:*",
"@codeanker/typescript-config": "workspace:*",
"@types/node": "catalog:",
"@types/sanitize-html": "^2.16.0",
"@vitejs/plugin-basic-ssl": "^2.1.0",
"@vitejs/plugin-vue": "^6.0.2",
"autoprefixer": "^10.4.16",
Expand Down
29 changes: 21 additions & 8 deletions apps/frontend/src/components/data/AnmeldeLinkTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import DataGridDoubleLineCell from '../DataGridDoubleLineCell.vue'
import DataTable, { type Query } from '../Table/DataTable.vue'
import initialData from '../Table/initialData'
import Badge from '../UIComponents/Badge.vue'
// import Button from '../UIComponents/Button.vue'
import Button from '../UIComponents/Button.vue'
import { toast } from 'vue-sonner'

type AnmeldeLink = RouterOutput['anmeldungLink']['list']['data'][number]

Expand Down Expand Up @@ -73,13 +74,25 @@ const columns = [
})
},
}),
// column.display({
// header: ' ',
// cell({ row }) {
// const link = `?token=${row.original.token}`
// return h(Button, {}, ['Link kopieren'])
// },
// }),
column.display({
header: ' ',
cell({ row }) {
if (row.original.usedAt !== null) {
return h('span', { class: 'italic'}, 'Link bereits benutzt')
}

const hostname = row.original.unterveranstaltung.veranstaltung.hostname?.hostname ?? ''
const ausschreibung = row.original.unterveranstaltung.id
const url = `https://${hostname}/ausschreibung/${ausschreibung}/anmeldung?token=${row.original.accessToken}`

return h(Button, {
onClick: () => {
navigator.clipboard.writeText(url)
toast.success('Link in Zwischenablage kopiert')
}
}, 'Link kopieren')
},
}),
]

const query: Query<AnmeldeLink> = (pagination, filter) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const decide = useMutation({
const column = createColumnHelper<AccessRequest>()
const columns = [
column.accessor('gliederung.name', {
id: 'gliederung',
header: 'Gliederung',
enableColumnFilter: true,
enableSorting: true,
Expand Down
16 changes: 16 additions & 0 deletions apps/frontend/src/components/forms/account/FormAccountGeneral.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { MenuItem } from '@headlessui/vue'
import {
ArrowTopRightOnSquareIcon,
CheckCircleIcon,
ChevronDownIcon,
CodeBracketIcon,
Expand Down Expand Up @@ -201,6 +202,21 @@ const modalAddPermission = useTemplateRef('modalAddPermission')
<h2 class="text-base font-semibold leading-7">Stammdaten</h2>
<Stammdaten v-model="stammdatenForm" />
</div>
<div
v-else
class="mb-6"
>
<h2 class="text-base font-semibold leading-7">Stammdaten</h2>
<Button
v-if="account"
color="info"
class="flex flex-row items-center w-fit"
:to="{ name: 'Verwaltung Persondetails', params: { personId: account.personId } }"
>
<span>Stammdaten bearbeiten</span>
<ArrowTopRightOnSquareIcon class="h-4 w-4" />
</Button>
</div>

<ValidateForm @submit="handle">
<h2 class="text-base font-semibold">Accountdaten</h2>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const fill = (gliederung) => {
return {
name: gliederung?.name,
edv: gliederung?.edv,
email: gliederung?.email,
domain: gliederung?.domain,
}
}

Expand Down Expand Up @@ -96,10 +96,9 @@ const handle = async (event: Event) => {

<div class="sm:col-span-3">
<BasicInput
v-model="gliederungCopy.email"
label="Kontaktadresse"
name="email"
type="email"
v-model="gliederungCopy.domain"
label="Domain"
name="domain"
required
/>
</div>
Expand Down
25 changes: 25 additions & 0 deletions apps/frontend/src/helpers/sanitizeHtml.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import doSanitizeHtml from 'sanitize-html'

export function sanitizeHtml(html: string): string {
return doSanitizeHtml(html, {
allowedTags: [
'h2',
'h3',
'p',
'strong',
'em',
's',
'u',
'a',
'ul',
'ol',
'li',
'img',
],
allowedAttributes: {
img: [
'src', 'alt', 'style',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ist das HTML user-provided? style ermöglicht XSS-Angriffe in manchen Browsern, z.B. IE: https://stackoverflow.com/questions/4546591/xss-attacks-and-style-attributes

],
},
})
}
Loading