Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 customize things #11

Merged
merged 53 commits into from
May 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
f5a092f
move frontend to frontend folder, make proposal form depending on que…
scammo Nov 29, 2023
8d1e830
first work in progress and test deployment
scammo Jan 4, 2024
19c3672
corect path Dockerfile
scammo Jan 4, 2024
f7ed882
more correct context for docker#
scammo Jan 4, 2024
dbffe67
purge supabase
scammo Jan 4, 2024
6f9cba8
logout, change profile information, change password, unique usernames
scammo Jan 4, 2024
5a3c3fb
root can create users and read all users
scammo Jan 4, 2024
dd5611d
show correct labels for orga/proposal view
scammo Jan 4, 2024
1cfec06
users can save and read opinions to proposal
scammo Jan 4, 2024
0dfcbc8
add feature show all users to track
scammo Jan 4, 2024
9cd5090
filter for status inside track of proposals
scammo Jan 4, 2024
e101275
export data functionality
scammo Jan 4, 2024
6275a79
improved docs, improve dev seeder, create initial root user by visiti…
scammo Jan 4, 2024
3d0a3b8
prod default values login
scammo Jan 4, 2024
be6d4eb
Update Dockerfile and docker-compose.yml
flemming-pr Jan 4, 2024
adbb874
Update environment variables and Docker configuration
flemming-pr Jan 4, 2024
ec06c7d
Refactor entrypoint.sh script and add wait for DB to be ready
flemming-pr Jan 4, 2024
72fbbaf
Update Dockerfile and add Caddyfile for backend
flemming-pr Jan 4, 2024
0376cd5
Update PHP version in Dockerfile
flemming-pr Jan 4, 2024
0ef28fe
Update Caddyfile to disable auto HTTPS
flemming-pr Jan 4, 2024
d608b9f
Update Dockerfile and Caddyfile configurations
flemming-pr Jan 6, 2024
042ff54
Update API URL and add CORS middleware
flemming-pr Jan 6, 2024
4e4307b
Update Traefik router middleware for API-PGP
flemming-pr Jan 6, 2024
951227e
Update traefik configuration for API-PGP service
flemming-pr Jan 6, 2024
3a711e3
.env.example update with jwt secret
scammo Jan 8, 2024
7be802a
add to composer.json jwt:secret
scammo Jan 8, 2024
bf6f829
fixed typos
scammo Jan 8, 2024
467d8d1
Merge branch 'v2-customize-things' of github.com:chaostreff-flensburg…
scammo Jan 8, 2024
2380eed
working createInitialRootUser
scammo Jan 8, 2024
c309f36
fix
scammo Jan 8, 2024
7e7de7b
fix migration public_key
scammo Jan 8, 2024
fd9335d
varchar to text migration
scammo Jan 8, 2024
7898b72
change proposal status
scammo Jan 9, 2024
13f8dd7
change proposal status backend
scammo Jan 9, 2024
091d858
working links
scammo Jan 9, 2024
2300f50
#4 diplay correctly if the user has voted for proposal
scammo Mar 27, 2024
1560eb3
#3 fix typo
scammo Mar 27, 2024
0a75639
#2 Preserve line breaks in proposals' texts
scammo Mar 27, 2024
e5bc5f2
improved seederfor local development, improved docs and .env for loca…
scammo Mar 27, 2024
e495370
set timeout to 15000
scammo Mar 29, 2024
042bb1b
new button for export content field with unencrypted data
scammo Apr 3, 2024
fc0422d
deal with rate limit in frontend
scammo Apr 3, 2024
0ab9366
[bug] Format Minutes correclty
scammo Apr 3, 2024
66dc0d8
#5 fix correctly sorting cumulitive votes
scammo Apr 3, 2024
0975a25
#7 the framework has no avaibility to make it link, but name is now a…
scammo Apr 3, 2024
355fcde
improve login layout and cleanup login
scammo Apr 20, 2024
6241cbc
enhence login toast for error messages
scammo Apr 21, 2024
a04d097
fix error messages and display Overview
scammo Apr 21, 2024
681dbb5
fix breadcrumb logic, labels and routes
scammo Apr 21, 2024
5a3e557
after login redirect to path the user tried to visit
scammo Apr 21, 2024
314e2f3
#8 add notification for a new created proposal, the applicant and use…
scammo Apr 21, 2024
bb9369c
cccs-20241 proposal data, first steps for more configurables email texts
scammo May 24, 2024
0815869
change json structure
scammo May 24, 2024
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
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[*.yml]
indent_style = space
indent_size = 2
66 changes: 66 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#Laravel Backend
APP_NAME=PGP
APP_ENV=production
APP_KEY=
APP_DEBUG=false
APP_URL=https://api.bewerben.c3fl.space

LOG_CHANNEL=stack
LOG_DEPRECATIONS_CHANNEL=null
LOG_LEVEL=debug

DB_CONNECTION=mysql
DB_HOST=database
DB_PORT=3306
DB_DATABASE=database
DB_USERNAME=secret
DB_PASSWORD=secret

BROADCAST_DRIVER=log
CACHE_DRIVER=file
FILESYSTEM_DISK=local
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

MEMCACHED_HOST=127.0.0.1

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mailpit
MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS="[email protected]"
MAIL_FROM_NAME="${APP_NAME}"

AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
AWS_BUCKET=
AWS_USE_PATH_STYLE_ENDPOINT=false

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_HOST=
PUSHER_PORT=443
PUSHER_SCHEME=https
PUSHER_APP_CLUSTER=mt1

VITE_APP_NAME="${APP_NAME}"
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
VITE_PUSHER_HOST="${PUSHER_HOST}"
VITE_PUSHER_PORT="${PUSHER_PORT}"
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"

# Database
MYSQL_RANDOM_ROOT_PASSWORD=true
MYSQL_DATABASE=databse
MYSQL_USER=secret
MYSQL_PASSWORD=secret
37 changes: 21 additions & 16 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: Build and deploy
name: Build and deploy V2

on:
push:
branches: ["main"]
branches: ["v2-customize-things"]

concurrency:
group: ${{ github.ref }}
Expand All @@ -29,21 +29,26 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build
- name: Build Frontend
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile
context: frontend
file: frontend/Dockerfile
push: true
tags: "ghcr.io/${{ github.repository }}:latest"
build-args: |
"SUPABASE_URL=${{ secrets.SUPABASE_URL }}"
"SUPABASE_ANON_KEY=${{ secrets.SUPABASE_ANON_KEY }}"

- name: pull and start new image
uses: appleboy/ssh-action@master
tags: "ghcr.io/${{ github.repository }}/frontend:latest"

- name: Build Backend
uses: docker/build-push-action@v3
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USER_NAME }}
key: ${{ secrets.PRIVATE_KEY}}
script: cd ccs-proposal && docker compose pull && docker compose up -d
context: backend
file: backend/Dockerfile
push: true
tags: "ghcr.io/${{ github.repository }}/backend:latest"

# - name: pull and start new image
# uses: appleboy/ssh-action@master
# with:
# host: ${{ secrets.HOST }}
# username: ${{ secrets.USER_NAME }}
# key: ${{ secrets.PRIVATE_KEY}}
# script: cd pretty-good-proposal-v2 && docker compose pull && docker compose up -d
131 changes: 2 additions & 129 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,130 +1,3 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
.pnpm-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
frontend/.env
backend/.env
10 changes: 1 addition & 9 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"editor.codeActionsOnSave": {
"source.fixAll": true
"source.fixAll": "explicit"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
Expand All @@ -10,14 +10,6 @@
"[html]": {
"editor.defaultFormatter": "vscode.html-language-features"
},
"deno.enable": true,
"deno.enablePaths": [
"./supabase"
],
"deno.unstable": true,
"[typescript]": {
"editor.defaultFormatter": "denoland.vscode-deno"
},
"[json]": {
"editor.defaultFormatter": "vscode.json-language-features"
}
Expand Down
43 changes: 31 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
# PGP - Pretty good Proposal
# PGP - Pretty Good Proposal V2

Purpose build for [Chaotic Catalyst Scholarships (CCS)](https://ccs.chaostreff-flensburg.de/). This is a web application to create and manage proposals for the CCS. [License](./LICENSE)
Mange different proposals tracks with a simple web application [License](./LICENSE).

You can see a running version [bewerben.ccs.chaostreff-flensburg.de](https://bewerben.ccs.chaostreff-flensburg.de/#/). You can find a very [short talk (2:40 Minutes) from cccamp23 on youtube](https://youtu.be/y4a9_POxGws?si=DWvt5urfD1hWnc-6)
First build to manage [Chaotic Catalyst Scholarships (CCS)](https://ccs.chaostreff-flensburg.de/).

You can see a running version [bewerben.c3fl.de](https://bewerben.c3fl.de). You can find a very [short talk (2:40 Minutes) from cccamp23 on youtube](https://youtu.be/y4a9_POxGws?si=DWvt5urfD1hWnc-6)

## Features

- Create Tracks
- Create proposals
- Encyrpt proposals with [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). For more infomration please have a look at the [lib](./src/lib/) Folder and different files.
- Save encrypted proposals to a database. In this case to supabase
- Encyrpt proposals with [Web Crypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API). For more infomration please have a look at the [lib](./src/lib/) Folder and different files.
- Save encrypted proposals to a database.
- Only advisary board can decrypt proposals (with a manuel shared private)
- Advisary board can vote and decide on proposals
- Every Track has a custom URL and public key
- A root user can create tracks, users (advisary board) and connect them both
- You can easily export all track data as json

> This is a work in progress. The application is not ready for easy setup for other projects.
> This is a work in progress. The application could be setup for other projects. Please be aware that this is a very early version. There is no guarantee that this application is secure. Only use it if encrytion is a nice to have feature!!!

## Technical Setup

### Frontend
#### Vue 3 + Vite

This template should help get you started developing with Vue 3 in Vite. The template uses Vue 3 `<script setup>` SFCs, check out the [script setup docs](https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup) to learn more.
The Frontendn is a Vue3 (JavaScript) which is completly standalone.

#### Recommended IDE Setup
### Install

- [VS Code](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin).
`npm i`

### Backend
#### Supabase
[Supabase](https://supabase.com/) is a backend as a service tool. It has a JS SDK and a Postgres database. It only stores encrypted proposal information. Because of limited resources, this technology was chosen.

The Backend is a Laravel application. It uses a sqllite as database.

#### Install

1. Composer install dependecies.
2. Copy .env.example to .env (for local development use .env.example.local.dev)
3. For local development: create `backend/database/database.sqlite`
4. You can create test data by seeding: `php artisan migrate:fresh --seed` (Deletes the database and seeds new Data)

You can use the following Private Key for local development:
```
{"alg":"RSA-OAEP-512","d":"TD6MEN65iy9OFv5Qoz6AXTtaS4DbTuA6wXmMhJMT6M-uiWJ0vjRKOS9xSHkwEg7xWRLIOPmad2oNo9rt7GY6p_bFtYDZ0p4Ug9ji_I-O8TuppRYtROq8uuj8ALSsTFQR2QbCp1QnJOItt0bl05P5LzJ-L3iYwo2RIDbGq5sDRC0Gv0RK0ubUY8OhDpqLh0FUROYcSrT6oKCN4JVs4zD3YIQjOJB6BcbOncn5DT1cnN96sZa9cou7x388ED0DgFTIj564rs7n7iEraoklUTKzT6RPkx5kRmcHpGuMpRfusaWt-Hf1TAP3JFrfg0L__J7SEWnm0n10LyBsqJS1H72oeHP29GWkA80c8XG0g6Quu-DuK8AR-PNhd85qQBgAnSkrUrgWHsIK7nqVX9ljs2ZYmd1k5ZyR9okIDskT6pL1G397O8yMxP3vQo1vqqz8khRm_kIAivqSAPv0GcHlKwycLRio_VJijHWck_NQ6L3gizjDnPNxQSvFtQ92nIiTD17Gz40h5IDWOYNBmui_mKnb08FF_wmm07a9lOnICurdTeMQ-GXVxPB3eRpp9l683zNc7JSpxDbbp21v9es6Y2fc_jiIyn8ICh4QMbYNu2wtUQg--G9HtMgjtj9lW4-LsPu3WlcI3pLXX5Ufu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xN23qYQEf70AGT2pbXg51xlLjVHFCczYb8HzFSyZYwV83ECRFldBAnWdWRo7GxCwxiHtnGuXF5UCBPW3bxL8630TvzmIbXwbYtSs5iLLX3m0uceWxtaplSqZNXpm1j9VE0_w2dEu0uOR6KZDVgV6lY_7IcVGtItcMcOc-4DgUObB0djWCBhmQoC4nekz4FV1kJZP0zDMVN1vbvSpoLIW1pUxzNit3_TOjATfxVtFTSrHsVvxqQZwNj1bWZl_5nmGL3z8HYHkDcCR8Uq5iRu3ylxpzBzaCISyQvcYLhhOypHVD8NMyEReQ1_XDV1YQzxw"}
```
18 changes: 18 additions & 0 deletions backend/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[docker-compose.yml]
indent_size = 4
Loading
Loading