Skip to content
This repository has been archived by the owner on Dec 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #17 from BBN-Holding/plugin-store
Browse files Browse the repository at this point in the history
WIP: Plugin Store
  • Loading branch information
greg6775 authored Dec 5, 2023
2 parents ce8a41a + c0e1abf commit a099242
Show file tree
Hide file tree
Showing 70 changed files with 753 additions and 656 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ jobs:
echo "PATH=${PATH}" >> $GITHUB_ENV
deno upgrade
- name: Lint
run: deno lint

- name: Building bbn.one
run: deno run --no-check -A serve.ts build
run: deno run -A serve.ts build

- name: Login to GitHub Container Registry
uses: docker/[email protected]
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.DS_Store
dist
deno.lock
dist
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"deno.cacheOnSave": true,
"deno.suggest.imports.autoDiscover": true,
"deno.suggest.autoImports": true,
"typescript.suggest.autoImports": true,
"deno.suggest.imports.hosts": {
"https://deno.land": true,
"https://esm.sh": true,
Expand Down
6 changes: 1 addition & 5 deletions assets/imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@ import dots from './img/dots.svg';
import templateArtwork from "./img/template-artwork.png";

export {
heroImage,
googleLogo,
discordLogo,
dots,
templateArtwork
discordLogo, dots, googleLogo, heroImage, templateArtwork
};
2 changes: 1 addition & 1 deletion components/nav.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API } from "shared";
import { API } from "shared/mod.ts";
import { delay } from "std/async/delay.ts";
import { BasicLabel, Box, Button, ButtonStyle, Component, Custom, Grid, Horizontal, Image, Label, MIcon, Spacer, Vertical, createElement } from "webgen/mod.ts";
import { IsLoggedIn, activeUser, permCheck, showProfilePicture } from "../pages/_legacy/helper.ts";
Expand Down
4 changes: 2 additions & 2 deletions components/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import bbnAdminLogo from '../assets/img/bbnAdmin.svg';
// @deno-types="https://raw.githubusercontent.com/lucsoft-DevTeam/lucsoft.de/master/custom.d.ts"
import bbnWalletLogo from '../assets/img/bbnWallet.svg';

import { Permission } from "shared";
import { Permission } from "shared/mod.ts";

export const pages: [ logo: any, perm: Array<Permission>, route: string ][] = [
export const pages: [ logo: string, perm: Array<Permission>, route: string ][] = [
[ bbnHolding, [], "/" ],
[ bbnMusicLogo, [], "/music" ],
[ bbnHostingLogo, [], "/hosting" ],
Expand Down
12 changes: 0 additions & 12 deletions data/servers.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,5 @@
},
"/minecraft/pocketmine/": {
"name": "Pocketmine MP"
},
"/minecraft/legacy/magma/": {
"name": "Minecraft Magma"
},
"/minecraft/legacy/nukkit/": {
"name": "Minecraft Nukkit"
},
"/minecraft/legacy/pgf/": {
"name": "Minecraft Purpur Geyser Floodgate"
},
"/minecraft/legacy/purpur/": {
"name": "Minecraft Purpur"
}
}
7 changes: 4 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"imports": {
"webgen/": "https://raw.githubusercontent.com/lucsoft/WebGen/99f109f/",
"webgen/": "https://raw.githubusercontent.com/lucsoft/WebGen/b6fafd3/",
// "webgen/": "../WebGen/",
"std/": "https://deno.land/std@0.207.0/",
"shared": "./pages/shared/mod.ts"
"std/": "https://deno.land/std@0.208.0/",
"shared/": "./pages/shared/"
},
"lock": false,
"compilerOptions": {
"lib": [
"dom",
Expand Down
6 changes: 3 additions & 3 deletions pages/_legacy/helper.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This code Will be ported to webgen

import { API, fileCache, Permission, stupidErrorAlert } from "shared";
import { API, fileCache, Permission, stupidErrorAlert } from "shared/mod.ts";
import { Box, Button, Cache, Component, Custom, Dialog, DropDownInput, Horizontal, Image, Label, Page, Spacer, State, StateHandler, Style, SupportedThemes, Table, TextInput, Vertical } from "webgen/mod.ts";
import artwork from "../../assets/img/template-artwork.png";
import { loginRequired } from "../../components/pages.ts";
Expand Down Expand Up @@ -234,7 +234,7 @@ export function EditArtists(list: Artist[]) {
Spacer(),
Button("Add Artist") // TODO: Remove this in the future => switch to ghost rows
.onClick(() => {
state.list = <any>[ ...state.list, [ "", "", ArtistTypes.Primary ] ];
state.list = State([ ...state.list, [ "", "", ArtistTypes.Primary ] ] as [ string, string, ArtistTypes ][]);
})
).setPadding("0 0 3rem 0")
)
Expand Down Expand Up @@ -284,7 +284,7 @@ function update(state: StateHandler<{ list: [ name: string, img: string, type: A
state.list = [ ...state.list ];
}

export function getDropFromPages(data: StateHandler<any>[], restore?: Drop): Drop {
export function getDropFromPages(data: StateHandler<Partial<Drop>>[], restore?: Drop): Drop {
return <Drop>{
...restore,
...Object.assign({}, ...data)
Expand Down
2 changes: 1 addition & 1 deletion pages/_legacy/music/changeDrop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, stupidErrorAlert, uploadFilesDialog } from "shared";
import { API, stupidErrorAlert, uploadFilesDialog } from "shared/mod.ts";
import { AdvancedImage, Box, Button, DropAreaInput, DropDownInput, Grid, IconButton, Image, MIcon, Page, Spacer, State, TextInput, Wizard } from "webgen/mod.ts";
import artwork from "../../../assets/img/template-artwork.png";
import language from "../../../data/language.json" assert { type: "json" };
Expand Down
2 changes: 1 addition & 1 deletion pages/_legacy/music/changeSongs.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, uploadFilesDialog } from "shared";
import { API, uploadFilesDialog } from "shared/mod.ts";
import { Button, Grid, Horizontal, Page, Spacer, Wizard } from "webgen/mod.ts";
import { Drop, pageFive } from "../../../spec/music.ts";
import { allowedAudioFormats, getDropFromPages } from "../helper.ts";
Expand Down
2 changes: 1 addition & 1 deletion pages/_legacy/music/data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, StreamingUploadHandler } from "shared";
import { API, StreamingUploadHandler } from "shared/mod.ts";
import { delay } from "std/async/delay.ts";
import { AdvancedImage, State, StateHandler } from "webgen/mod.ts";
import { Drop } from "../../../spec/music.ts";
Expand Down
2 changes: 1 addition & 1 deletion pages/_legacy/music/edit.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, LoadingSpinner, Navigation, createActionList, createBreadcrumb, createTagList, stupidErrorAlert } from "shared";
import { API, LoadingSpinner, Navigation, createActionList, createBreadcrumb, createTagList, stupidErrorAlert } from "shared/mod.ts";
import { Box, Grid, Horizontal, Label, Spacer, State, Vertical, View, WebGen, isMobile } from "webgen/mod.ts";
import '../../../assets/css/main.css';
import '../../../assets/css/music.css';
Expand Down
2 changes: 1 addition & 1 deletion pages/_legacy/music/table.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Progress } from "shared";
import { Progress } from "shared/mod.ts";
import { Box, ButtonStyle, Checkbox, Color, DropDownInput, IconButton, Image, InlineTextInput, Label, MIcon, State, StateHandler, Table, View } from "webgen/mod.ts";
import language from "../../../data/language.json" assert { type: "json" };
import primary from "../../../data/primary.json" assert { type: "json" };
Expand Down
2 changes: 1 addition & 1 deletion pages/_legacy/newDrop.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, LoadingSpinner, stupidErrorAlert, uploadFilesDialog } from "shared";
import { API, LoadingSpinner, stupidErrorAlert, uploadFilesDialog } from "shared/mod.ts";
import { AdvancedImage, Button, ButtonStyle, Center, CenterV, Color, DropAreaInput, DropDownInput, Grid, Horizontal, Image, Label, MediaQuery, Page, Spacer, State, SupportedThemes, TextInput, Vertical, View, WebGen, Wizard } from "webgen/mod.ts";
import '../../assets/css/main.css';
import { DynaNavigation } from "../../components/nav.ts";
Expand Down
2 changes: 1 addition & 1 deletion pages/admin/dialog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API } from "shared";
import { API } from "shared/mod.ts";
import { Box, Checkbox, Custom, Dialog, Horizontal, Image, Label, Page, Spacer, State, Wizard, createElement } from "webgen/mod.ts";
import reviewTexts from "../../data/reviewTexts.json" assert { type: "json" };
import { Drop, ReviewResponse } from "../../spec/music.ts";
Expand Down
2 changes: 1 addition & 1 deletion pages/admin/loading.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, StreamingUploadHandler } from "shared";
import { API, StreamingUploadHandler } from "shared/mod.ts";
import { delay } from "std/async/delay.ts";
import { UploadFilesDialog } from "webgen/mod.ts";
import { DropType } from "../../spec/music.ts";
Expand Down
2 changes: 1 addition & 1 deletion pages/admin/review.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, LoadingSpinner, Navigation, createActionList, createBreadcrumb, createTagList, stupidErrorAlert } from "shared";
import { API, LoadingSpinner, Navigation, createActionList, createBreadcrumb, createTagList, stupidErrorAlert } from "shared/mod.ts";
import { Box, Button, ButtonStyle, Color, Entry, Grid, Horizontal, Label, Spacer, Vertical, View, WebGen, isMobile } from "webgen/mod.ts";
import '../../assets/css/main.css';
import '../../assets/css/music.css';
Expand Down
8 changes: 4 additions & 4 deletions pages/admin/state.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { External } from "shared";
import { External } from "shared/mod.ts";
import { State } from "webgen/mod.ts";
import { AdminStats, Drop, File, OAuthApp, Payout, Server, Transcript, Wallet } from "../../spec/music.ts";
import { AdminStats, Drop, File, Group, OAuthApp, Payout, Server, Transcript, Wallet } from "../../spec/music.ts";
import { ProfileData } from "../_legacy/helper.ts";

export const state = State({
Expand All @@ -13,7 +13,7 @@ export const state = State({
drafts: <External<Drop[]> | "loading">"loading",
},
users: <External<ProfileData[]> | "loading">"loading",
groups: <External<any[]> | "loading">"loading",
groups: <External<Group[]> | "loading">"loading",
payouts: <External<Payout[]> | "loading">"loading",
oauth: <External<OAuthApp[]> | "loading">"loading",
files: <External<File[]> | "loading">"loading",
Expand All @@ -24,6 +24,6 @@ export const state = State({
});

export const reviewState = State({
drop: <any | undefined>undefined,
drop: <Drop | undefined>undefined,
drops: <Drop[] | undefined>undefined,
});
2 changes: 1 addition & 1 deletion pages/admin/views/entryReview.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { API } from "shared/mod.ts";
import { Button, ButtonStyle, Color, Dialog, DropDownInput, Entry, State, Vertical } from "webgen/mod.ts";
import { Drop, DropType } from "../../../spec/music.ts";
import { showPreviewImage } from "../../_legacy/helper.ts";
import { API } from "../../shared/restSpec.ts";

export function ReviewEntry(x: Drop) {
return Entry({
Expand Down
3 changes: 2 additions & 1 deletion pages/admin/views/entryUser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Entry } from "webgen/mod.ts";
import { Group } from "../../../spec/music.ts";
import { ProfileData, showProfilePicture } from "../../_legacy/helper.ts";

export function UserEntry(x: ProfileData) {
Expand All @@ -10,7 +11,7 @@ export function UserEntry(x: ProfileData) {
.addPrefix(showProfilePicture(x));
}

export function GroupEntry(x: any) {
export function GroupEntry(x: Group) {
return Entry({
title: x.displayName,
subtitle: `${x._id} - ${x.permission}`
Expand Down
2 changes: 1 addition & 1 deletion pages/admin/views/list.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, External, fileCache, RenderItem, stupidErrorAlert } from "shared";
import { API, External, fileCache, RenderItem, stupidErrorAlert } from "shared/mod.ts";
import { Box, Button, Cache, Color, Dialog, Entry, Grid, IconButton, Image, MIcon, ref, TextInput } from "webgen/mod.ts";
import { templateArtwork } from "../../../assets/imports.ts";
import { File, OAuthApp, Transcript, Wallet } from "../../../spec/music.ts";
Expand Down
2 changes: 1 addition & 1 deletion pages/admin/views/menu.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { API, count, HeavyList, loadMore, Navigation, placeholder } from "shared";
import { API, count, HeavyList, loadMore, Navigation, placeholder } from "shared/mod.ts";
import { sumOf } from "std/collections/sum_of.ts";
import { Box, Button, Color, Dialog, Entry, Grid, Horizontal, isMobile, Label, ref, Spacer, State, Table, TextInput, Vertical } from "webgen/mod.ts";
import { DropType } from "../../../spec/music.ts";
Expand Down
2 changes: 1 addition & 1 deletion pages/holding/distributionAgreement.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Footer } from "shared/footer.ts";
import { Box, Label, View, WebGen } from "webgen/mod.ts";
import { DynaNavigation } from "../../components/nav.ts";
import { RegisterAuthRefresh } from "../_legacy/helper.ts";
import { Footer } from "../shared/footer.ts";
import './flowText.css';
WebGen();
await RegisterAuthRefresh();
Expand Down
2 changes: 1 addition & 1 deletion pages/holding/imprint.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Footer } from "shared/footer.ts";
import { Box, Button, ButtonStyle, Horizontal, Label, Spacer, View, WebGen } from "webgen/mod.ts";
import { DynaNavigation } from "../../components/nav.ts";
import { RegisterAuthRefresh } from "../_legacy/helper.ts";
import { Footer } from "../shared/footer.ts";
import './flowText.css';
WebGen();
await RegisterAuthRefresh();
Expand Down
9 changes: 7 additions & 2 deletions pages/holding/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,19 @@ import { RegisterAuthRefresh } from "../_legacy/helper.ts";
import './landing.css';
import { data, streamingPool } from "./loading.ts";
// Main
// @deno-types="https://raw.githubusercontent.com/lucsoft-DevTeam/lucsoft.de/master/custom.d.ts"
import bbnHosting from "./resources/bbnHosting.svg";
// @deno-types="https://raw.githubusercontent.com/lucsoft-DevTeam/lucsoft.de/master/custom.d.ts"
import bbnMusic from "./resources/bbnMusic.svg";

// External
import { Counter } from "../shared/counter.ts";
import { Footer } from "../shared/footer.ts";
import { Counter } from "shared/counter.ts";
import { Footer } from "shared/footer.ts";
// @deno-types="https://raw.githubusercontent.com/lucsoft-DevTeam/lucsoft.de/master/custom.d.ts"
import bbnCard from "./resources/bbnCard.svg";
// @deno-types="https://raw.githubusercontent.com/lucsoft-DevTeam/lucsoft.de/master/custom.d.ts"
import bbnGameStudios from "./resources/bbnGameStudios.svg";
// @deno-types="https://raw.githubusercontent.com/lucsoft-DevTeam/lucsoft.de/master/custom.d.ts"
import bbnPublishing from "./resources/bbnPublishing.svg";
WebGen();
await RegisterAuthRefresh();
Expand Down
23 changes: 9 additions & 14 deletions pages/holding/loading.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { lazyInit, State } from "webgen/mod.ts";
import { API } from "../shared/restSpec.ts";
import { createStableWebSocket } from "webgen/network.ts";

export const data = State({
stats: {
Expand All @@ -9,20 +10,14 @@ export const data = State({
}
});

// deno-lint-ignore require-await
export const streamingPool = lazyInit(async () => {
function connect() {
const ws = new WebSocket(API.WS_URL.replace("/ws", "/api/@bbn/public/stats"));

ws.onmessage = ({ data: msg }) => {
const json = JSON.parse(msg);
await createStableWebSocket({
url: API.WS_URL.replace("/ws", "/api/@bbn/public/stats")
}, {
onMessage: (msg) => {
if(typeof msg !== "string") return;
const json = JSON.parse(msg)
data.stats = State(json as typeof data.stats);
};
ws.onerror = () => {

};
ws.onclose = () => setTimeout(() => connect(), 1000);

}
connect();
}
});
});
60 changes: 0 additions & 60 deletions pages/hosting/asyncRequest.ts

This file was deleted.

File renamed without changes.
Loading

0 comments on commit a099242

Please sign in to comment.