Skip to content

Commit

Permalink
add Dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
appujet committed Sep 1, 2023
1 parent 7161b37 commit a8cca5e
Show file tree
Hide file tree
Showing 58 changed files with 7,157 additions and 5 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,8 @@
target


yarn.lock
yarn.lock

.next

/node_modules
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
- 24/7 Music Playback
- Playlist commands
- Setup music channel

- Dashboard (Work in progress)
## 🎶 Support Sources

🔍 **Default Sources**:
Expand Down
12 changes: 11 additions & 1 deletion src/LavaClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Lavamusic from './structures/Lavamusic';
import { ClientOptions, GatewayIntentBits } from 'discord.js';
import config from './config';
import { DiscordDashboard } from './api/index';
import { DiscordDashboard } from "./api";
import child from "node:child_process";
const { GuildMembers, MessageContent, GuildVoiceStates, GuildMessages, Guilds, GuildMessageTyping } = GatewayIntentBits;
const clientOptions: ClientOptions = {
intents: [Guilds, GuildMessages, MessageContent, GuildVoiceStates, GuildMembers, GuildMessageTyping],
Expand All @@ -18,8 +19,17 @@ client.start(config.token);
if (config.dashboard.enable) {
const dashboard = new DiscordDashboard();
dashboard.start();
client.logger.start('Starting dashboard...');
child.exec('cd src/dashboard && npm i && npm run dev && cd ../..', (err, stdout) => {
if (err) {
client.logger.error(err);
return;
}
client.logger.start(stdout);
});
}


/**
* Project: lavamusic
* Author: Blacky
Expand Down
2 changes: 1 addition & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export class DiscordDashboard {
public async start() {
try {
this.app.listen(this.config.dashboard.port, () => {
this.logger.info(`Dashboard listening on port ${this.config.dashboard.port}`);
this.logger.info(`[API] listening on port ${this.config.dashboard.port}`);
});
} catch (err) {
this.logger.error(err);
Expand Down
2 changes: 2 additions & 0 deletions src/dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
/.next
674 changes: 674 additions & 0 deletions src/dashboard/LICENSE

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions src/dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
6 changes: 6 additions & 0 deletions src/dashboard/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
18 changes: 18 additions & 0 deletions src/dashboard/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/** @type {import('next').NextConfig} */

const nextConfig = {
reactStrictMode: true,
images: {
domains: ['cdn.discordapp.com'],
},
async rewrites() {
return [
{
source: '/src/app/dashboard/index.tsx',
destination: '/dashboard',
}
];
},
}

module.exports = nextConfig
Loading

0 comments on commit a8cca5e

Please sign in to comment.