Skip to content

Commit

Permalink
Misc changes and docker file
Browse files Browse the repository at this point in the history
  • Loading branch information
ThatGravyBoat committed Aug 22, 2024
1 parent 0de688a commit e41ef91
Show file tree
Hide file tree
Showing 16 changed files with 215 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.nuxt
node_modules
60 changes: 60 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish
on:
workflow_dispatch:
push:
branches:
- 'master'
jobs:
publish:
if: contains(github.event.head_commit.message, '[Build]')
name: Publish
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
### Checkout Repo
- uses: actions/checkout@v4
with:
ref: master

### Setup Node
- uses: actions/setup-node@v4
with:
node-version: 18

### Install Dependencies and Build
- run: npm install

### Login to GHCR
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

### Set Build Version
- name: Set Build Version
id: build-version
run:
echo "BUILD_VERSION=`date +%y%j%H%M`" >> "$GITHUB_OUTPUT"

### Extract Docker Metadata
- name: Extract Docker Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
tags: |
${{ steps.build-version.outputs.BUILD_VERSION }}
latest
### Build and Push Package
- name: Build and Push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
17 changes: 17 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM node:18.13-alpine

WORKDIR /app

COPY . .

RUN npm install -g pnpm@8.6.10
RUN pnpm install --frozen-lockfile

ENV NODE_ENV=production

RUN pnpm run build
CMD ["node", "/app/.output/server/index.mjs"]

LABEL org.opencontainers.image.source=https://github.com/Team-Resourceful/beehive
LABEL org.opencontainers.image.description="Beehive"
LABEL org.opencontainers.image.licenses=AGPL-3.0
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
![knossos banner](https://user-images.githubusercontent.com/12068027/100479893-d9b5a380-30ac-11eb-9db9-0c09d400f13f.png)
### Beehive

## Modrinth's center for its frontend service

For contributing information, please see the knossos section of the [Modrinth contributing guide](https://docs.modrinth.com/docs/details/contributing/#knossos-frontend).

For a detailed explanation on how things work in general, check out the [Nuxt.js docs](https://nuxt.com).
This is a fork of Modrinth Knossos, from a specific redesign which we thought was good.
This fork is a wrapper for the Team Resourceful maven.
14 changes: 14 additions & 0 deletions assets/styles/components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,17 @@ svg.inline-svg {
.joined-buttons {
height: fit-content;
}

.stylized-toggle {
border-radius: var(--radius-sm) !important;
background-color: var(--color-tag-bg);
}

.stylized-toggle:checked {
background-color: #48bf53;
}

.stylized-toggle:after {
border-radius: var(--radius-xs) !important;
background-color: aliceblue !important;
}
2 changes: 1 addition & 1 deletion nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ function getDomain() {
// @ts-ignore
return process.env.CF_PAGES_URL ?? globalThis.CF_PAGES_URL
} else {
return 'https://beehive.resourceful.team'
return 'https://beehive.teamresourceful.com'
}
} else {
return 'http://localhost:3000'
Expand Down
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"private": true,
"scripts": {
"build": "nuxi build",
"dev": "nuxi dev",
"generate": "nuxi generate",
"preview": "nuxi preview",
"postinstall": "nuxi prepare",
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare",
"lint:js": "eslint . --ext .js,.vue,.ts",
"lint": "npm run lint:js && prettier --check .",
"fix": "eslint . --fix --ext .js,.vue,.ts && prettier --write .",
"intl:extract": "formatjs extract \"{,components,composables,layouts,middleware,modules,pages,plugins,utils}/**/*.{vue,ts,tsx,js,jsx,mts,cts,mjs,cjs}\" --ignore '**/*.d.ts' --ignore 'node_modules' --out-file locales/en-US/index.json --format crowdin --preserve-whitespace"
"intl:extract": "formatjs extract \"{,components,composables,layouts,middleware,modules,pages,plugins,utils}/**/*.{vue,ts,tsx,js,jsx,mts,cts,mjs,cjs}\" --ignore '**/*.d.ts' --ignore 'node_modules' --out-file locales/en-US/index.json --format crowdin --preserve-whitespace",
"start": "node .output/server/index.mjs"
},
"devDependencies": {
"@formatjs/cli": "^6.1.2",
Expand Down
41 changes: 30 additions & 11 deletions pages/[type]/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,7 @@
</div>
</div>
</Modal>
<div
:class="{
'normal-page': true,
'alt-layout': $route.name.startsWith('type-id-settings'),
}"
>
<div class="normal-page">
<div class="normal-page__header">
<div class="breadcrumbs">
<span>Minecraft: Java Edition</span>
Expand Down Expand Up @@ -379,9 +374,17 @@
<ShareIcon />
Share
</Button>
<nuxt-link
v-if="cosmetics.developerMode"
:to="`/panel/${route.params.id}`"
class="dev-button"
>
<WrenchIcon />
</nuxt-link>

</div>
</div>
<div v-if="project.links.length > 0" class="members card">
<div v-if="project.links.length > 0" class="card">
<h2>Links</h2>
<div class="links">
<CustomLink
Expand All @@ -393,7 +396,7 @@
/>
</div>
</div>
<div class="members card">
<div class="card">
<h2>Members</h2>
<a
v-for="member in allMembers"
Expand Down Expand Up @@ -451,9 +454,11 @@ import WrenchIcon from '~/assets/images/utils/wrench.svg'
import GameIcon from '~/assets/images/utils/game.svg'
import { computeVersions } from '~/helpers/projects'
import CustomLink from '~/components/ui/CustomLink.vue'
import {useCosmetics} from "~/composables/cosmetics";
const route = useRoute()
const config = useRuntimeConfig()
const cosmetics = useCosmetics()
const tags = useTags()
const vintl = useVIntl()
Expand All @@ -475,7 +480,7 @@ try {
;[{ data: project }, { data: allMembers }, { data: versions }] = await Promise.all([
useAsyncData(
`project/${route.params.id}`,
() => $fetch(`http://localhost:9000/projects/${route.params.id}`),
() => $fetch(`https://beehive-api.teamresourceful.com/projects/${route.params.id}`),
{
transform: (project) => {
if (project) {
Expand All @@ -491,10 +496,10 @@ try {
}
),
useAsyncData(`project/${route.params.id}/members`, () =>
$fetch(`http://localhost:9000/teams/${route.params.id}`)
$fetch(`https://beehive-api.teamresourceful.com/teams/${route.params.id}`)
),
useAsyncData(`project/${route.params.id}/version`, () =>
$fetch(`http://localhost:9000/versions/${route.params.id}`)
$fetch(`https://beehive-api.teamresourceful.com/versions/${route.params.id}`)
),
])
Expand Down Expand Up @@ -713,6 +718,20 @@ const moreVersions = computed(() => {
})
</script>
<style lang="scss" scoped>
.dev-button {
background-color: var(--color-button-bg);
padding: 0.5rem;
border-radius: 0.5rem;
display: flex;
align-items: center;
justify-content: center;
&:hover {
filter: brightness(1.2);
}
}
.card {
padding: 1.25rem;
Expand Down
6 changes: 3 additions & 3 deletions pages/panel/[id].vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ try {
;[{data: project}, {data: allMembers}, {data: versions}] = await Promise.all([
useAsyncData(
`project/${route.params.id}`,
() => $fetch(`http://localhost:9000/projects/${route.params.id}`),
() => $fetch(`https://beehive-api.teamresourceful.com/projects/${route.params.id}`),
{
transform: (project) => {
if (project) {
Expand All @@ -68,10 +68,10 @@ try {
}
),
useAsyncData(`project/${route.params.id}/members`, () =>
$fetch(`http://localhost:9000/teams/${route.params.id}`)
$fetch(`https://beehive-api.teamresourceful.com/teams/${route.params.id}`)
),
useAsyncData(`project/${route.params.id}/version`, () =>
$fetch(`http://localhost:9000/versions/${route.params.id}`)
$fetch(`https://beehive-api.teamresourceful.com/versions/${route.params.id}`)
),
])
Expand Down
2 changes: 1 addition & 1 deletion pages/panel/[id]/description.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const fetchDescription = (project) => {
.then((data) => {
project.body = data.body
fetch(`http://localhost:9000/panel/projects/${route.params.id}`, {
fetch(`https://beehive-api.teamresourceful.com/panel/projects/${route.params.id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Expand Down
70 changes: 69 additions & 1 deletion pages/panel/[id]/index.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<template>
<section class="card">
<section class="card actions">
<h2>Project Details</h2>
<Button color="primary" @click="() => {updateProject(project)}">
<SaveIcon/>
Save
</Button>
</section>
<section class="card">
<h2>Info</h2>

<div class="adjacent-input small">
<label>
Expand Down Expand Up @@ -42,9 +49,42 @@
</div>

</section>
<section class="card">
<h2>Display</h2>

<div class="adjacent-input small">
<label>
<span class="label__title">Project Name</span>
<span class="label__description">The name of the project</span>
</label>
<input
type="text"
v-model="project.title"
/>
</div>

</section>
<section class="card">
<h2>Maven Info</h2>

<div class="adjacent-input small">
<label>
<span class="label__title">Project Group</span>
<span class="label__description">The maven group of the project</span>
</label>
<input
type="text"
disabled
:value="project.group"
/>
</div>

</section>
</template>

<script setup>
import {Button, SaveIcon} from 'omorphia'
const route = useRoute()
defineProps({
Expand All @@ -55,4 +95,32 @@ defineProps({
},
},
})
const updateProject = (project) => {
fetch(`https://beehive-api.teamresourceful.com/panel/projects/${route.params.id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${localStorage.getItem('token')}`,
},
body: JSON.stringify({
info: {
title: project.title
},
}),
})
}
</script>

<style lang="scss" scoped>
.actions {
display: flex;
justify-content: space-between;
align-items: center;
h2 {
margin: 0;
}
}
</style>
6 changes: 3 additions & 3 deletions pages/panel/[id]/links.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@
</div>
<div>
<Button @click="() => {
editingMember = member
editMemberModal.show()
editingLink = link
editLinkModal.show()
}">
<EditIcon/>
Edit
Expand Down Expand Up @@ -105,7 +105,7 @@ defineProps({
})
const updateLinks = (links) => {
fetch(`http://localhost:9000/panel/projects/${route.params.id}`, {
fetch(`https://beehive-api.teamresourceful.com/panel/projects/${route.params.id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Expand Down
4 changes: 2 additions & 2 deletions pages/panel/[id]/members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ defineProps({
},
},
})
0
const updateMembers = (members) => {
fetch(`http://localhost:9000/panel/projects/${route.params.id}`, {
fetch(`https://beehive-api.teamresourceful.com/panel/projects/${route.params.id}`, {
method: 'PATCH',
headers: {
'Content-Type': 'application/json',
Expand Down
Loading

0 comments on commit e41ef91

Please sign in to comment.