WIP: It's bun time
This commit is contained in:
parent
24247d938f
commit
301a3ac595
8 changed files with 36 additions and 2041 deletions
BIN
bun.lockb
Executable file
BIN
bun.lockb
Executable file
Binary file not shown.
|
@ -1,3 +1,4 @@
|
|||
import DashboardViewModel from "../models/home/DashboardViewModel";
|
||||
import Config from "../objects/Config";
|
||||
import HashFS from "../objects/HashFS";
|
||||
import UserService from "../services/UserService";
|
||||
|
@ -5,9 +6,13 @@ import Controller from "./Controller";
|
|||
import { randomBytes } from "crypto";
|
||||
|
||||
export default class HomeController extends Controller {
|
||||
public Index_Get_AllowAnonymous() {
|
||||
public async Index_Get_AllowAnonymous() {
|
||||
if (this.session) {
|
||||
return this.view("dashboard");
|
||||
const dashboardViewModel: DashboardViewModel = {
|
||||
recentUploads: await UserService.GetRecentUploads(this.session.userId)
|
||||
}
|
||||
|
||||
return this.view("dashboard",dashboardViewModel);
|
||||
}
|
||||
|
||||
return this.view();
|
||||
|
|
2
index.ts
2
index.ts
|
@ -100,7 +100,7 @@ fastify.addHook("onSend", (req, res, _payload, done) => {
|
|||
|
||||
fastify.setNotFoundHandler(async (req, res) => {
|
||||
|
||||
return res.status(404).view("views/404.ejs", { session: null });
|
||||
return res.status(404).view("views/404.ejs");
|
||||
});
|
||||
|
||||
HashFS.STARTUP_DIR = __dirname;
|
||||
|
|
5
models/home/DashboardViewModel.ts
Normal file
5
models/home/DashboardViewModel.ts
Normal file
|
@ -0,0 +1,5 @@
|
|||
import Media from "../../entities/Media";
|
||||
|
||||
export default interface DashboardViewModel {
|
||||
recentUploads: Array<Media>
|
||||
}
|
2034
package-lock.json
generated
2034
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -12,7 +12,8 @@
|
|||
"type": "commonjs",
|
||||
"scripts": {
|
||||
"updateCheck": "check-outdated",
|
||||
"dev": "nodemon --watch './**/*.ts' index.ts",
|
||||
"dev:legacy_node": "nodemon --watch './**/*.ts' index.ts",
|
||||
"dev": "bun --watch index.ts",
|
||||
"build": "tsc --build"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
<%- include("./base/header", { title: "404", session }) %>
|
||||
<%- include("./base/header", { title: "404" }) %>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1>404</h1>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%- include("./base/footer") %>
|
|
@ -10,7 +10,17 @@
|
|||
<div class="col text-end"><a aria-label="View All Uploads" href="/imagelist">View All >></a></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body"></div>
|
||||
<div class="card-body">
|
||||
<table>
|
||||
<tbody>
|
||||
<% for (const upload of recentUploads) { %>
|
||||
<tr>
|
||||
<td><%= upload.FileName %></td>
|
||||
</tr>
|
||||
<% } %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Stats -->
|
||||
|
|
Loading…
Reference in a new issue