Skip to content

Commit

Permalink
Merge pull request #414 from Mindgamesnl/development
Browse files Browse the repository at this point in the history
6.10.1
  • Loading branch information
Mindgamesnl authored May 6, 2024
2 parents 877b315 + 19febe7 commit 607e11c
Show file tree
Hide file tree
Showing 71 changed files with 1,132 additions and 82 deletions.
17 changes: 17 additions & 0 deletions api/src/main/java/com/craftmend/openaudiomc/api/MediaApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,21 @@ static MediaApi getInstance() {
*/
void stopFor(@NotNull String id, @NotNull Client... clients);

/**
* Stop a specific media by ID for a client
*
* @param id Media ID
* @param fadeTime Fade time in milliseconds
* @param clients Target clients
*/
void stopFor(@NotNull String id, int fadeTime, @NotNull Client... clients);

/**
* Stop all media (except regions and speakers) for a client
*
* @param fadeTime Fade time in milliseconds
* @param clients Target clients
*/
void stopFor(int fadeTime, @NotNull Client... clients);

}
46 changes: 46 additions & 0 deletions api/src/main/java/com/craftmend/openaudiomc/api/VoiceApi.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package com.craftmend.openaudiomc.api;

import com.craftmend.openaudiomc.api.channels.VoiceChannel;
import com.craftmend.openaudiomc.api.clients.Client;
import com.craftmend.openaudiomc.api.voice.CustomPlayerFilter;
import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.List;
import java.util.UUID;

Expand Down Expand Up @@ -105,4 +108,47 @@ static VoiceApi getInstance() {
*/
List<CustomPlayerFilter> getCustomPlayerFilters();

/**
* Get a list of all registered channels
* @return a list of all registered channels
* @since 6.10.1
*/
Collection<VoiceChannel> getChannels();

/**
* Get a channel by its name
* @param name the name of the channel
* @return the channel, or null if the channel does not exist
* @since 6.10.1
*/
@Nullable
VoiceChannel getChannel(String name);

/**
* Create a new channel
* @param name the name of the channel
* @param creator the creator of the channel
* @param requiresPermission if the channel requires permission to join
* @param requiredPermission the permission required to join the channel
* @return the created channel
* @since 6.10.1
*/
VoiceChannel createChannel(String name, Client creator, boolean requiresPermission, @Nullable String requiredPermission);

/**
* Delete a channel
* @param channel the channel to delete
* @since 6.10.1
*/
void deleteChannel(VoiceChannel channel);

/**
* Check if a channel name is valid
* @param s the name to check
* @return true if the name is valid
* @since 6.10.1
*/
boolean isChannelNameValid(String s);


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package com.craftmend.openaudiomc.api.channels;

public enum ChannelJoinResponse {

/**
* The client is allowed to join the channel
*/
ALLOWED,

/**
* The client is only allowed to join this channel if they are invited
*/
INVITE_ONLY,

/**
* The client is not allowed to join this channel
*/
NO_PERMISSION,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package com.craftmend.openaudiomc.api.channels;

import com.craftmend.openaudiomc.api.basic.Actor;
import com.craftmend.openaudiomc.api.clients.Client;
import org.jetbrains.annotations.Nullable;

import java.util.Collection;
import java.util.UUID;

public interface VoiceChannel {

/**
* Get the name of the channel
* @return the name of the channel
*/
String getName();

/**
* Get the members of the channel
* @return the members of the channel
*/
Collection<Client> getMembers();

/**
* Get the creator of the channel
* @return the creator of the channel, or null if the channel is not a user channel
*/
@Nullable
Actor getCreator();

/**
* If this channel requires permission to join
* @return true if the channel requires permission to join
*/
boolean requiresPermission();

/**
* Get the required permission to join this channel
* @return the required permission to join this channel, or null if the channel does not require permission
*/
@Nullable
String getRequiredPermission();

/**
* Check if a client is a member of this channel
* @param actor the actor to check
* @return true if the actor is a member of this channel
*/
boolean isMember(Actor actor);

/**
* Check if a client is a member of this channel
* @param uuid the uuid of the actor to check
* @return true if the actor is a member of this channel
*/
boolean isMember(UUID uuid);

/**
* Check if a client would be allowed to join this channel
* @param client the client to check
* @return the response of the join check
*/
ChannelJoinResponse joinPreconditionCheck(Client client);

/**
* Add a member to the channel
* @param client the client to add
*/
void addMember(Client client);

/**
* Remove a member from the channel
* @param client the client to remove
*/
void removeMember(Client client);
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public class Media {
/**
* Source value for the media. Typically, a web compatible web link or translatable OA value
*/
private final String source;
@Setter
private String source;

/**
* The unique id of the media, used by the client to keep track of media pools.
Expand Down
2 changes: 1 addition & 1 deletion client/public/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildMajor":1,"buildMinor":125,"buildRevision":239,"buildTag":"dev","buildDate":"Sun Mar 31 2024","build":"1.125.239 dev"}
{"buildMajor":1,"buildMinor":125,"buildRevision":240,"buildTag":"dev","buildDate":"Sun May 05 2024","build":"1.125.240 dev"}
11 changes: 11 additions & 0 deletions client/src/client/login/ClientTokenSet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,17 @@ export default class ClientTokenSet {
return;
}

if (body.status === 409) {
setGlobalState({
isLoading: false,
isBlocked: true,
isValidationError: true,
});
ReportError('Invalid token', window.tokenCache.name);
resolve(null);
return;
}

body.json().then((sessionValidationResponse) => {
if (sessionValidationResponse.errors.length > 0) {
if (this.attempts < 3) {
Expand Down
2 changes: 1 addition & 1 deletion client/src/metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"buildMajor":1,"buildMinor":125,"buildRevision":239,"buildTag":"dev","buildDate":"Sun Mar 31 2024","build":"1.125.239 dev"}
{"buildMajor":1,"buildMinor":125,"buildRevision":240,"buildTag":"dev","buildDate":"Sun May 05 2024","build":"1.125.240 dev"}
1 change: 1 addition & 0 deletions client/src/state/store.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ const initialState = {
isLoading: true,
isBlocked: false, // whenever an account is temporarily blocked (rate-limiting, abuse)
isPersonalBlock: false, // whenever this user is personally rate-limited or blocked (due to for example, dmca abuse)
isValidationError: false, // whenever the client is not whitelisted to be used on this server
loadingState: 'Preparing to load OpenAudioMc',
fixedFooter: null,
navbarDetails: true,
Expand Down
14 changes: 12 additions & 2 deletions client/src/views/login/BlockedLoginView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ function BlockedLoginView(props) {
<div className="card flex-shrink-0 w-full max-w-sm shadow-2xl bg-base-100">
<div className="card-body">
<div>
{props.isPersonalBlock ? (
{!props.isValidationError && props.isPersonalBlock ? (
<p className="w-80 text-center text-sm mb-8 text-white tracking-wide cursor-pointer">
You are currently blocked from using OpenAudioMc. Please contact support at
{' '}
Expand All @@ -20,7 +20,7 @@ function BlockedLoginView(props) {
</p>
) : null}

{!props.isPersonalBlock && (
{!props.isValidationError && !props.isPersonalBlock && (
<p className="w-80 text-center text-sm mb-8 text-white tracking-wide cursor-pointer">
This server/account is (temporarily) blocked from using OpenAudioMc.
If you&apos;re the owner of this server, please contact support at
Expand All @@ -30,6 +30,13 @@ function BlockedLoginView(props) {
to appeal.
</p>
)}

{props.isValidationError ? (
<p className="w-80 text-center text-sm mb-8 text-white tracking-wide cursor-pointer">
This client is not whitelisted to be used on this server. Please set this client as your base url in
your account and try again.
</p>
) : null}
</div>
</div>
</div>
Expand All @@ -40,11 +47,14 @@ function BlockedLoginView(props) {

BlockedLoginView.propTypes = {
isPersonalBlock: PropTypes.bool.isRequired,
isValidationError: PropTypes.bool.isRequired,
};

export default connect(mapStateToProps)(BlockedLoginView);

function mapStateToProps(state) {
return {
isPersonalBlock: state.isPersonalBlock,
isValidationError: state.isValidationError,
};
}
4 changes: 2 additions & 2 deletions dev-resources/spawn-test-spigot.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export JAVA_HOME=`/usr/libexec/java_home -v 17`
export JAVA_HOME=`/usr/libexec/java_home -v 18`
mkdir -p test-server-spigot/plugins/
mkdir -p test-server-spigot/plugins/OpenAudioMc/
echo "Building new OpenAudioMc jar without unit tests.."
Expand Down Expand Up @@ -29,4 +29,4 @@ echo "Starting server.."
rm world/session.lock
rm world_the_end/session.lock
rm world_nether/session.lock
java -Xms3G -Xmx3G -DIReallyKnowWhatIAmDoingISwear -jar spigot-1.20.2.jar nogui
java -Xms3G -Xmx3G -DIReallyKnowWhatIAmDoingISwear -jar paper-1.20.6-49.jar nogui
17 changes: 17 additions & 0 deletions dev-resources/spawn-test-velocity-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export JAVA_HOME=`/usr/libexec/java_home -v 17`
mkdir -p test-server-spigot/plugins/
mkdir -p test-server-spigot/plugins/OpenAudioMc/
echo "Building new OpenAudioMc jar without unit tests.."

cd plugin
./src/main/bash/post-build.sh
cd ..

mvn -T 4.5C clean install -Dmaven.test.skip=true

# permission workaround
rm -rf dev-resources/velocity-test/plugins/openaudiomc-*.jar
mkdir -p dev-resources/velocity-test/plugins/
cp plugin/target/openaudiomc-*.jar dev-resources/velocity-test/plugins/
cd dev-resources/velocity-test/
docker-compose up --build
1 change: 1 addition & 0 deletions dev-resources/velocity-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plugins/*
44 changes: 44 additions & 0 deletions dev-resources/velocity-test/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
version: '3'

services:
velocity-paper1:
restart: on-failure
image: itzg/minecraft-server
environment:
- EULA=TRUE
- ONLINE_MODE=FALSE
- TYPE=PAPER
- SPIGOT_BUNGEE=true
- BUNGEECORD_IP=0.0.0.0
- VERSION=1.20.2
#- BUILD_FROM_SOURCE=true
volumes:
- ./velocity-spigot1:/data
- ./plugins:/plugins

velocity-paper2:
restart: on-failure
image: itzg/minecraft-server
environment:
- EULA=TRUE
- ONLINE_MODE=FALSE
- TYPE=PAPER
- SPIGOT_BUNGEE=true
- BUNGEECORD_IP=0.0.0.0
- VERSION=1.20.2
# - BUILD_FROM_SOURCE=true
volumes:
- ./velocity-spigot2:/data
- ./plugins:/plugins

velocity:
restart: on-failure
image: itzg/bungeecord
ports:
- 25565:25565
environment:
- TYPE=VELOCITY
- EULA=TRUE
volumes:
- ./plugins:/plugins
- ./velocity:/config
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
big L
14 changes: 14 additions & 0 deletions dev-resources/velocity-test/velocity-spigot1/ops.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"uuid": "88243ba3-382f-4eb0-874f-c5831eb3c0a6",
"name": "ToetMats",
"level": 4,
"bypassesPlayerLimit": false
},
{
"uuid": "f0c8657b-f384-4df6-9d66-e9f36c36ce8a",
"name": "Mindgamesnl",
"level": 4,
"bypassesPlayerLimit": false
}
]
Loading

0 comments on commit 607e11c

Please sign in to comment.