Compare commits

5 Commits
Author SHA1 Message Date
Belupeti 16e22104fb add new models and start making DB strucure 2026-09-10 14:08:52 +02:00
Belupeti e300915144 add some shit 2026-09-08 17:15:33 +02:00
Belupeti b65f46afd8 add vue :( 2026-09-07 16:04:27 +02:00
Belupeti 425169722a start adding vue 2026-09-07 15:13:43 +02:00
Belupeti 298adeb146 finish basic oauth authentication 2026-09-07 00:54:41 +02:00
21 changed files with 955 additions and 84 deletions
+10
View File
@@ -0,0 +1,10 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Guests extends Model
{
protected $fillable=['access_code', 'email']
}
+1 -1
View File
@@ -10,7 +10,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable; use Illuminate\Notifications\Notifiable;
#[Fillable(['name', 'email', 'oauth_token'])] #[Fillable(['id', 'name', 'email', 'oauth_token'])]
#[Hidden(['remember_token'])] #[Hidden(['remember_token'])]
class User extends Authenticatable class User extends Authenticatable
{ {
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
class Wishes extends Model
{
use HasUuids;
protected $table = 'wishes';
protected $fillable = ['title', 'description', 'reward', 'owner_id', 'status', 'agent_id', 'guest_id'];
public function agent(): BelongsTo
{
return $this->belongsTo(User::class, 'agent_id', 'uuid');
}
public function owner(): BelongsTo
{
return $this->belongsTo(User::class, 'owner_id', 'uuid');
}
public function guest(): BelongsTo
{
return $this->belongsTo(Guest::class, 'guest_id', 'uuid');
}
}
@@ -12,7 +12,7 @@ return new class extends Migration
public function up(): void public function up(): void
{ {
Schema::create('users', function (Blueprint $table) { Schema::create('users', function (Blueprint $table) {
$table->id(); $table->string('id', 64)->primary();
$table->string('name'); $table->string('name');
$table->string('email')->unique(); $table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable(); $table->timestamp('email_verified_at')->nullable();
@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('wishes', function (Blueprint $table) {
$table->uuid()->primary();
$table->string('title');
$table->text('description');
$table->string('reward')->nullable();
$table->string('agent_id')->nullable();
$table->string('owner_id')->nullable();
$table->foreignUuid('guest_id')->nullable();
$table->enum('status', ['posted', 'taken', 'disabled', 'completed'])->default('posted');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('wishes');
}
};
@@ -0,0 +1,29 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('guests', function (Blueprint $table) {
$table->uuid()->primary();
$table->string('access_code');
$table->string('email');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('guests');
}
};
+625 -48
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -15,5 +15,9 @@
}, },
"optionalDependencies": { "optionalDependencies": {
"@laravel/multiplex": "^0.4.1" "@laravel/multiplex": "^0.4.1"
},
"dependencies": {
"@vitejs/plugin-vue": "^6.0.8",
"vue-router": "^5.3.1"
} }
} }
Binary file not shown.
Binary file not shown.
Binary file not shown.
+55
View File
@@ -7,3 +7,58 @@
--font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', --font-sans: 'Instrument Sans', ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji',
'Segoe UI Symbol', 'Noto Color Emoji'; 'Segoe UI Symbol', 'Noto Color Emoji';
} }
:root {
--ui-primary: rgb(255, 0, 0);
--background-color: rgb(10,10,10);
--color-primary: rgb(250, 250, 250);
--color-a-primary: rgb(142, 234, 252);
--color-a-visited: rgb(252, 142, 250);
}
@font-face {
font-family: 'Trajan Pro Regular';
font-style: normal;
font-weight: normal;
src: local('Trajan Pro Regular'), url('fonts/TrajanPro-Regular.woff') format('woff');
}
@font-face {
font-family: 'Trajan Pro Bold';
font-style: normal;
font-weight: normal;
src: local('Trajan Pro Bold'), url('fonts/TrajanPro-Bold.woff') format('woff');
}
@font-face {
font-family: 'Perpetua Regular';
src: url('fonts/Perpetua-Regular.woff2');
font-style: normal;
}
footer {
width: 100%;
text-align: center;
color: grey;
font-size: medium;
padding: 2% 0;
position: fixed;
bottom: 0;
}
body {
background-color: var(--background-color);
font-family: Perpetua Regular;
color: var(--color-primary);
text-align: center;
}
a {
color: var(--color-a-primary);
text-decoration: underline;
}
a:visited {
color: var(--color-a-visited);
}
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
import Footer from "./components/Footer.vue";
</script>
<template>
<main>
<router-view v-slot="{ Component,route }">
<component :is="Component" />
</router-view>
</main>
<Footer>Scott 0-val</Footer>
</template>
+8 -1
View File
@@ -1 +1,8 @@
// import { createApp } from 'vue';
import App from './App.vue';
import router from './router';
import '../css/app.css'
createApp(App)
.use(router)
.mount('#app');
+30
View File
@@ -0,0 +1,30 @@
<template>
<footer>
<slot>All rights reserved</slot>
<template v-if="this.date">
{{ this.year }}
</template>
</footer>
</template>
<script>
new Date().getFullYear()
export default {
data() {
return {
year: 0,
}
},
props: {
date: {
type: Boolean,
default: true,
}
},
mounted() {
this.year = new Date().getFullYear();
}
}
</script>
+12
View File
@@ -0,0 +1,12 @@
<script lang="ts" setup>
</script>
<script lang="ts">
</script>
<template>
<body>
asdf
</body>
</template>
+14
View File
@@ -0,0 +1,14 @@
<script lang="ts" setup>
</script>
<script lang="ts">
</script>
<template>
<body>
Several assets were aquired from <a href="https://hollowknight.wiki/">the Hollow Knight wiki</a>, under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">
Creative Commons Attribution-ShareAlike 3.0
</a> licence.
</body>
</template>
+21
View File
@@ -0,0 +1,21 @@
import { createRouter, createWebHistory } from 'vue-router';
import App from '../App.vue';
import HomeView from '../pages/HomeView.vue';
import LegalView from '../pages/LegalView.vue';
const routes = [
{ path: '/',
children:
[
{ path: '', component: HomeView },
{ path: '/legal', component: LegalView },
]
}
];
const router = createRouter({
history: createWebHistory(),
routes,
});
export default router;
+21
View File
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Default favicon (fallback for unsupported browsers) -->
<link rel="icon" href="{{ asset('favicon.ico') }}" type="image/x-icon">
<!-- Light mode favicon -->
<link rel="icon" href="{{ asset('logo_full_tall_light.svg') }}" type="image/x-icon" media="(prefers-color-scheme: light)">
<!-- Dark mode favicon -->
<link rel="icon" href="{{ asset('logo_full_tall_dark.svg') }}" type="image/x-icon" media="(prefers-color-scheme: dark)">
<title>{{ config('app.name') }}</title>
@vite(['resources/js/app.js'])
</head>
<body>
<div id="app" class="isolate"></div>
</body>
</html>
+24 -19
View File
@@ -4,24 +4,29 @@ use Illuminate\Support\Facades\Route;
use Laravel\Socialite\Socialite; use Laravel\Socialite\Socialite;
use App\Models\User; use App\Models\User;
Route::get('/', function () { Route::prefix('auth')->group(function () {
return view('welcome'); Route::get('/login', function () {
return Socialite::driver('authentik')->redirect();
});
Route::get('/redirect', function () {
$user = Socialite::driver('authentik')->user();
$new_user = User::updateOrCreate([
'id' => $user->id,
], [
'id' => $user->id,
'name' => $user->nickname,
'email' => $user->email,
'oauth_token' => $user->token,
]);
Auth::login($new_user);
return redirect('/')->with(['user' => $new_user]);
// $user->token
});
}); });
Route::get('{all}',function(){
Route::get('/auth/login', function () { return view('vue');
return Socialite::driver('authentik')->redirect(); })->where(['all' => '.*'])->name("vue");
});
Route::get('/auth/redirect', function () {
$user = Socialite::driver('authentik')->user();
$new_user = User::updateOrCreate([
'name' => $user->nickname,
'email' => $user->email,
'oauth_token' => $user->token,
]);
Auth::login($new_user);
return view('welcome', ['user'=>$user->name]);
// $user->token
});
+23 -13
View File
@@ -1,24 +1,34 @@
import { defineConfig } from 'vite'; import { defineConfig } from "vite";
import laravel from 'laravel-vite-plugin'; import laravel from "laravel-vite-plugin";
import { bunny } from 'laravel-vite-plugin/fonts'; import vue from "@vitejs/plugin-vue";
import tailwindcss from '@tailwindcss/vite';
const host = process.env.VITE_HMR_HOST || "localhost";
const clientPort = process.env.VITE_HMR_CLIENTPORT || 5173;
const protocol = process.env.VITE_HMR_PROTOCOL || "ws";
export default defineConfig({ export default defineConfig({
plugins: [ plugins: [
vue(),
laravel({ laravel({
input: ['resources/css/app.css', 'resources/js/app.js'], input: ["resources/css/app.css", "resources/js/app.js"],
refresh: true, refresh: true,
fonts: [
bunny('Instrument Sans', {
weights: [400, 500, 600],
}),
],
}), }),
tailwindcss(),
], ],
server: { server: {
watch: { host: '0.0.0.0',
ignored: ['**/storage/framework/views/**'], headers: {
'Cross-Origin-Embedder-Policy': 'unsafe-none',
'Cross-Origin-Resource-Policy': 'cross-origin',
},
hmr: {
protocol: protocol,
host: host,
clientPort: clientPort
},
},
resolve: {
alias: {
vue: "vue/dist/vue.esm-bundler.js",
}, },
}, },
}); });