Skip to content

Commit 54e254c

Browse files
committed
web update
1 parent fb365b9 commit 54e254c

25 files changed

+2968
-28
lines changed

WEB_DASHBOARD_README.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
# WeGuardian Web Dashboard
2+
3+
## Overview
4+
The WeGuardian Web Dashboard provides a modern web interface for managing punishments, viewing statistics, and monitoring server activity.
5+
6+
## Features
7+
- **Authentication**: Secure login system with session management
8+
- **Dashboard**: Real-time statistics and server overview
9+
- **Punishment Management**: Apply and revoke punishments through web interface
10+
- **Player Management**: Search players and view punishment history
11+
- **Live Updates**: WebSocket-based real-time updates
12+
- **Responsive Design**: Works on desktop and mobile devices
13+
14+
## Configuration
15+
16+
### Enable the Dashboard
17+
Edit your `config.yml` file:
18+
19+
```yaml
20+
web-dashboard:
21+
enabled: true
22+
host: "127.0.0.1"
23+
port: 8080
24+
credentials:
25+
username: "admin"
26+
password: "supersecret"
27+
session-timeout: 3600
28+
ssl:
29+
enabled: false
30+
keystore-path: ""
31+
keystore-password: ""
32+
security:
33+
require-https: false
34+
max-login-attempts: 5
35+
lockout-duration: 300
36+
```
37+
38+
### Configuration Options
39+
- `enabled`: Enable/disable the web dashboard
40+
- `host`: IP address to bind the server to
41+
- `port`: Port number for the web server
42+
- `credentials`: Login credentials for the dashboard
43+
- `session-timeout`: Session timeout in seconds (default: 3600)
44+
- `ssl`: SSL/TLS configuration (optional)
45+
- `security`: Security settings for login protection
46+
47+
## Usage
48+
49+
### Accessing the Dashboard
50+
1. Start your WeGuardian server
51+
2. Open your web browser
52+
3. Navigate to `http://localhost:8080` (or your configured host:port)
53+
4. Login with the credentials from your config
54+
55+
### Dashboard Pages
56+
57+
#### Main Dashboard
58+
- View server statistics
59+
- Monitor active punishments
60+
- See online player count
61+
- Real-time updates via WebSocket
62+
63+
#### Active Punishments
64+
- View all active punishments
65+
- Revoke punishments with one click
66+
- Filter by punishment type
67+
- Auto-refresh for real-time updates
68+
69+
#### Player Management
70+
- Search for players by name
71+
- Apply new punishments
72+
- View punishment history
73+
- Support for all punishment types (ban, tempban, mute, tempmute, kick, warn)
74+
75+
#### Settings
76+
- Configure dashboard settings
77+
- Change login credentials
78+
- Enable/disable features
79+
80+
## API Endpoints
81+
82+
### Authentication
83+
- `POST /api/login` - Authenticate user
84+
- `POST /api/logout` - Logout user
85+
86+
### Punishments
87+
- `GET /api/punishments/active` - Get active punishments
88+
- `POST /api/punishments/apply` - Apply new punishment
89+
- `POST /api/punishments/revoke/:id` - Revoke punishment
90+
91+
### Statistics
92+
- `GET /api/stats` - Get server statistics
93+
94+
### WebSocket
95+
- `ws://localhost:8080/ws` - Real-time updates
96+
97+
## Security Features
98+
99+
### Session Management
100+
- HttpOnly cookies for session storage
101+
- Configurable session timeouts
102+
- Automatic session cleanup
103+
104+
### Login Protection
105+
- Account lockout after failed attempts
106+
- Configurable lockout duration
107+
- Secure credential validation
108+
109+
### CSRF Protection
110+
- Session-based validation
111+
- Secure token handling
112+
113+
## Troubleshooting
114+
115+
### Common Issues
116+
117+
#### Dashboard Won't Start
118+
- Check if the port is already in use
119+
- Verify the host configuration
120+
- Ensure the dashboard is enabled in config
121+
122+
#### Login Issues
123+
- Verify credentials in config.yml
124+
- Check for account lockout
125+
- Clear browser cookies if needed
126+
127+
#### WebSocket Connection Issues
128+
- Ensure firewall allows WebSocket connections
129+
- Check browser console for errors
130+
- Verify WebSocket endpoint is accessible
131+
132+
### Dependencies
133+
The web dashboard requires the following dependencies:
134+
- Jetty Server 11.0.18
135+
- Jakarta Servlet API 6.0.0
136+
- Gson 2.10.1
137+
138+
These are automatically included when building the plugin.
139+
140+
## Development
141+
142+
### Building
143+
The web dashboard is included in the main WeGuardian plugin. No separate build process is required.
144+
145+
### Customization
146+
The web interface can be customized by modifying the HTML/CSS/JavaScript in the servlet classes. The design uses modern CSS with a responsive layout.
147+
148+
### Adding New Features
149+
To add new features:
150+
1. Create new servlet classes extending `HttpServlet`
151+
2. Add API endpoints as needed
152+
3. Update the navigation and routing
153+
4. Add WebSocket support for real-time updates
154+
155+
## Support
156+
For issues or questions about the web dashboard, please check the main WeGuardian documentation or contact the development team.

dependency-reduced-pom.xml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<groupId>me.wethink</groupId>
55
<artifactId>WeGuardian</artifactId>
66
<name>WeGuardian</name>
7-
<version>1.4</version>
7+
<version>1.5</version>
88
<build>
99
<resources>
1010
<resource>
@@ -17,8 +17,7 @@
1717
<artifactId>maven-compiler-plugin</artifactId>
1818
<version>3.13.0</version>
1919
<configuration>
20-
<source>${java.version}</source>
21-
<target>${java.version}</target>
20+
<release>${maven.compiler.release}</release>
2221
</configuration>
2322
</plugin>
2423
<plugin>
@@ -56,10 +55,6 @@
5655
<id>papermc-repo</id>
5756
<url>https://repo.papermc.io/repository/maven-public/</url>
5857
</repository>
59-
<repository>
60-
<id>sonatype</id>
61-
<url>https://oss.sonatype.org/content/groups/public/</url>
62-
</repository>
6358
<repository>
6459
<id>placeholderapi</id>
6560
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@@ -70,7 +65,7 @@
7065
</repository>
7166
<repository>
7267
<id>CodeMC</id>
73-
<url>https://repo.codemc.org/repository/maven-public</url>
68+
<url>https://repo.codemc.org/repository/maven-public/</url>
7469
</repository>
7570
</repositories>
7671
<dependencies>
@@ -88,6 +83,7 @@
8883
</dependency>
8984
</dependencies>
9085
<properties>
86+
<maven.compiler.release>21</maven.compiler.release>
9187
<java.version>21</java.version>
9288
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
9389
</properties>

pom.xml

Lines changed: 48 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,37 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3-
xmlns="http://maven.apache.org/POM/4.0.0"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
5+
http://maven.apache.org/xsd/maven-4.0.0.xsd">
6+
57
<modelVersion>4.0.0</modelVersion>
68

79
<groupId>me.wethink</groupId>
810
<artifactId>WeGuardian</artifactId>
9-
<version>1.4</version>
11+
<version>1.5</version>
1012
<packaging>jar</packaging>
1113

1214
<name>WeGuardian</name>
1315

1416
<properties>
1517
<java.version>21</java.version>
18+
<maven.compiler.release>21</maven.compiler.release>
1619
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1720
</properties>
1821

1922
<build>
2023
<plugins>
24+
<!-- Compiler -->
2125
<plugin>
2226
<groupId>org.apache.maven.plugins</groupId>
2327
<artifactId>maven-compiler-plugin</artifactId>
2428
<version>3.13.0</version>
2529
<configuration>
26-
<source>${java.version}</source>
27-
<target>${java.version}</target>
30+
<release>${maven.compiler.release}</release>
2831
</configuration>
2932
</plugin>
33+
34+
<!-- Shade -->
3035
<plugin>
3136
<groupId>org.apache.maven.plugins</groupId>
3237
<artifactId>maven-shade-plugin</artifactId>
@@ -57,6 +62,7 @@
5762
</configuration>
5863
</plugin>
5964
</plugins>
65+
6066
<resources>
6167
<resource>
6268
<directory>src/main/resources</directory>
@@ -70,10 +76,6 @@
7076
<id>papermc-repo</id>
7177
<url>https://repo.papermc.io/repository/maven-public/</url>
7278
</repository>
73-
<repository>
74-
<id>sonatype</id>
75-
<url>https://oss.sonatype.org/content/groups/public/</url>
76-
</repository>
7779
<repository>
7880
<id>placeholderapi</id>
7981
<url>https://repo.extendedclip.com/content/repositories/placeholderapi/</url>
@@ -84,17 +86,20 @@
8486
</repository>
8587
<repository>
8688
<id>CodeMC</id>
87-
<url>https://repo.codemc.org/repository/maven-public</url>
89+
<url>https://repo.codemc.org/repository/maven-public/</url>
8890
</repository>
8991
</repositories>
9092

9193
<dependencies>
94+
<!-- Paper API -->
9295
<dependency>
9396
<groupId>io.papermc.paper</groupId>
9497
<artifactId>paper-api</artifactId>
9598
<version>1.21.1-R0.1-SNAPSHOT</version>
9699
<scope>provided</scope>
97100
</dependency>
101+
102+
<!-- Database -->
98103
<dependency>
99104
<groupId>com.zaxxer</groupId>
100105
<artifactId>HikariCP</artifactId>
@@ -110,23 +115,53 @@
110115
<artifactId>sqlite-jdbc</artifactId>
111116
<version>3.45.3.0</version>
112117
</dependency>
118+
119+
<!-- PlaceholderAPI -->
113120
<dependency>
114121
<groupId>me.clip</groupId>
115122
<artifactId>placeholderapi</artifactId>
116123
<version>2.11.5</version>
117124
<scope>provided</scope>
118125
</dependency>
126+
127+
<!-- FoliaLib -->
119128
<dependency>
120129
<groupId>com.tcoded</groupId>
121130
<artifactId>FoliaLib</artifactId>
122131
<version>0.5.1</version>
123-
<scope>compile</scope>
124132
</dependency>
133+
134+
<!-- bStats -->
125135
<dependency>
126136
<groupId>org.bstats</groupId>
127137
<artifactId>bstats-bukkit</artifactId>
128138
<version>3.0.2</version>
129-
<scope>compile</scope>
139+
</dependency>
140+
141+
<!-- Embedded Tomcat -->
142+
<dependency>
143+
<groupId>org.apache.tomcat.embed</groupId>
144+
<artifactId>tomcat-embed-core</artifactId>
145+
<version>10.1.30</version>
146+
</dependency>
147+
<dependency>
148+
<groupId>org.apache.tomcat.embed</groupId>
149+
<artifactId>tomcat-embed-websocket</artifactId>
150+
<version>10.1.30</version>
151+
</dependency>
152+
153+
<!-- Jakarta WebSocket API -->
154+
<dependency>
155+
<groupId>jakarta.websocket</groupId>
156+
<artifactId>jakarta.websocket-api</artifactId>
157+
<version>2.1.1</version>
158+
</dependency>
159+
160+
<!-- Gson -->
161+
<dependency>
162+
<groupId>com.google.code.gson</groupId>
163+
<artifactId>gson</artifactId>
164+
<version>2.10.1</version>
130165
</dependency>
131166
</dependencies>
132167
</project>

0 commit comments

Comments
 (0)