forked from mirrors/homebox
Compare commits
1 commit
main
...
renovate/d
Author | SHA1 | Date | |
---|---|---|---|
|
b8b3c6677e |
7 changed files with 1506 additions and 575 deletions
2
.github/workflows/partial-publish.yaml
vendored
2
.github/workflows/partial-publish.yaml
vendored
|
@ -35,7 +35,7 @@ jobs:
|
|||
|
||||
- name: install buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
with:
|
||||
install: true
|
||||
|
||||
|
|
12
Dockerfile
12
Dockerfile
|
@ -1,6 +1,6 @@
|
|||
|
||||
# Build Nuxt
|
||||
FROM r.batts.cloud/node:18 as frontend-builder
|
||||
FROM node:18-alpine as frontend-builder
|
||||
WORKDIR /app
|
||||
RUN npm install -g pnpm
|
||||
COPY frontend/package.json frontend/pnpm-lock.yaml ./
|
||||
|
@ -9,12 +9,13 @@ COPY frontend .
|
|||
RUN pnpm build
|
||||
|
||||
# Build API
|
||||
FROM r.batts.cloud/golang:1.21 AS builder
|
||||
FROM golang:alpine AS builder
|
||||
ARG BUILD_TIME
|
||||
ARG COMMIT
|
||||
ARG VERSION
|
||||
RUN apt update && \
|
||||
apt install -y git build-essential gcc g++
|
||||
RUN apk update && \
|
||||
apk upgrade && \
|
||||
apk add --update git build-base gcc g++
|
||||
|
||||
WORKDIR /go/src/app
|
||||
COPY ./backend .
|
||||
|
@ -27,12 +28,13 @@ RUN CGO_ENABLED=0 GOOS=linux go build \
|
|||
-v ./app/api/*.go
|
||||
|
||||
# Production Stage
|
||||
FROM r.batts.cloud/debian:bookworm
|
||||
FROM alpine:latest
|
||||
|
||||
ENV HBOX_MODE=production
|
||||
ENV HBOX_STORAGE_DATA=/data/
|
||||
ENV HBOX_STORAGE_SQLITE_URL=/data/homebox.db?_fk=1
|
||||
|
||||
RUN apk --no-cache add ca-certificates
|
||||
RUN mkdir /app
|
||||
COPY --from=builder /go/bin/api /app
|
||||
|
||||
|
|
|
@ -45,8 +45,7 @@ class AuthContext implements IAuthContext {
|
|||
private _attachmentToken: CookieRef<string | null>;
|
||||
|
||||
get token() {
|
||||
// @ts-ignore sometimes it's a boolean I guess?
|
||||
return this._token.value === "true" || this._token.value === true;
|
||||
return this._token.value === "true";
|
||||
}
|
||||
|
||||
get attachmentToken() {
|
||||
|
@ -67,11 +66,11 @@ class AuthContext implements IAuthContext {
|
|||
}
|
||||
|
||||
isExpired() {
|
||||
return !this.token;
|
||||
return this.token;
|
||||
}
|
||||
|
||||
isAuthorized() {
|
||||
return this.token;
|
||||
return !this.isExpired();
|
||||
}
|
||||
|
||||
invalidateSession() {
|
||||
|
@ -80,6 +79,7 @@ class AuthContext implements IAuthContext {
|
|||
// Delete the cookies
|
||||
this._token.value = null;
|
||||
this._attachmentToken.value = null;
|
||||
|
||||
console.log("Session invalidated");
|
||||
}
|
||||
|
||||
|
|
|
@ -3,18 +3,14 @@ export default defineNuxtRouteMiddleware(async () => {
|
|||
const api = useUserApi();
|
||||
|
||||
if (!ctx.isAuthorized()) {
|
||||
if (window.location.pathname !== "/") {
|
||||
return navigateTo("/");
|
||||
}
|
||||
return navigateTo("/");
|
||||
}
|
||||
|
||||
if (!ctx.user) {
|
||||
console.log("Fetching user data");
|
||||
const { data, error } = await api.user.self();
|
||||
if (error) {
|
||||
if (window.location.pathname !== "/") {
|
||||
return navigateTo("/");
|
||||
}
|
||||
return navigateTo("/");
|
||||
}
|
||||
|
||||
ctx.user = data.item;
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
"eslint-plugin-vue": "^9.4.0",
|
||||
"h3": "^1.7.1",
|
||||
"isomorphic-fetch": "^3.0.0",
|
||||
"nuxt": "3.6.5",
|
||||
"nuxt": "3.7.4",
|
||||
"prettier": "^2.7.1",
|
||||
"typescript": "^5.0.0",
|
||||
"vite-plugin-eslint": "^1.8.1",
|
||||
|
|
|
@ -166,13 +166,6 @@
|
|||
<section v-if="location && items">
|
||||
<ItemViewSelectable :items="items" />
|
||||
</section>
|
||||
|
||||
<section v-if="location && location.children.length > 0" class="mt-6">
|
||||
<BaseSectionHeader class="mb-5"> Child Locations </BaseSectionHeader>
|
||||
<div class="grid gap-2 grid-cols-1 sm:grid-cols-3">
|
||||
<LocationCard v-for="item in location.children" :key="item.id" :location="item" />
|
||||
</div>
|
||||
</section>
|
||||
</BaseContainer>
|
||||
</div>
|
||||
</template>
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue