Skip to content

Commit 607e11c

Browse files
authored
Merge pull request #414 from Mindgamesnl/development
6.10.1
2 parents 877b315 + 19febe7 commit 607e11c

File tree

71 files changed

+1132
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1132
-82
lines changed

api/src/main/java/com/craftmend/openaudiomc/api/MediaApi.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,21 @@ static MediaApi getInstance() {
123123
*/
124124
void stopFor(@NotNull String id, @NotNull Client... clients);
125125

126+
/**
127+
* Stop a specific media by ID for a client
128+
*
129+
* @param id Media ID
130+
* @param fadeTime Fade time in milliseconds
131+
* @param clients Target clients
132+
*/
133+
void stopFor(@NotNull String id, int fadeTime, @NotNull Client... clients);
134+
135+
/**
136+
* Stop all media (except regions and speakers) for a client
137+
*
138+
* @param fadeTime Fade time in milliseconds
139+
* @param clients Target clients
140+
*/
141+
void stopFor(int fadeTime, @NotNull Client... clients);
142+
126143
}

api/src/main/java/com/craftmend/openaudiomc/api/VoiceApi.java

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
package com.craftmend.openaudiomc.api;
22

3+
import com.craftmend.openaudiomc.api.channels.VoiceChannel;
34
import com.craftmend.openaudiomc.api.clients.Client;
45
import com.craftmend.openaudiomc.api.voice.CustomPlayerFilter;
56
import com.craftmend.openaudiomc.api.voice.VoicePeerOptions;
7+
import org.jetbrains.annotations.Nullable;
68

9+
import java.util.Collection;
710
import java.util.List;
811
import java.util.UUID;
912

@@ -105,4 +108,47 @@ static VoiceApi getInstance() {
105108
*/
106109
List<CustomPlayerFilter> getCustomPlayerFilters();
107110

111+
/**
112+
* Get a list of all registered channels
113+
* @return a list of all registered channels
114+
* @since 6.10.1
115+
*/
116+
Collection<VoiceChannel> getChannels();
117+
118+
/**
119+
* Get a channel by its name
120+
* @param name the name of the channel
121+
* @return the channel, or null if the channel does not exist
122+
* @since 6.10.1
123+
*/
124+
@Nullable
125+
VoiceChannel getChannel(String name);
126+
127+
/**
128+
* Create a new channel
129+
* @param name the name of the channel
130+
* @param creator the creator of the channel
131+
* @param requiresPermission if the channel requires permission to join
132+
* @param requiredPermission the permission required to join the channel
133+
* @return the created channel
134+
* @since 6.10.1
135+
*/
136+
VoiceChannel createChannel(String name, Client creator, boolean requiresPermission, @Nullable String requiredPermission);
137+
138+
/**
139+
* Delete a channel
140+
* @param channel the channel to delete
141+
* @since 6.10.1
142+
*/
143+
void deleteChannel(VoiceChannel channel);
144+
145+
/**
146+
* Check if a channel name is valid
147+
* @param s the name to check
148+
* @return true if the name is valid
149+
* @since 6.10.1
150+
*/
151+
boolean isChannelNameValid(String s);
152+
153+
108154
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package com.craftmend.openaudiomc.api.channels;
2+
3+
public enum ChannelJoinResponse {
4+
5+
/**
6+
* The client is allowed to join the channel
7+
*/
8+
ALLOWED,
9+
10+
/**
11+
* The client is only allowed to join this channel if they are invited
12+
*/
13+
INVITE_ONLY,
14+
15+
/**
16+
* The client is not allowed to join this channel
17+
*/
18+
NO_PERMISSION,
19+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.craftmend.openaudiomc.api.channels;
2+
3+
import com.craftmend.openaudiomc.api.basic.Actor;
4+
import com.craftmend.openaudiomc.api.clients.Client;
5+
import org.jetbrains.annotations.Nullable;
6+
7+
import java.util.Collection;
8+
import java.util.UUID;
9+
10+
public interface VoiceChannel {
11+
12+
/**
13+
* Get the name of the channel
14+
* @return the name of the channel
15+
*/
16+
String getName();
17+
18+
/**
19+
* Get the members of the channel
20+
* @return the members of the channel
21+
*/
22+
Collection<Client> getMembers();
23+
24+
/**
25+
* Get the creator of the channel
26+
* @return the creator of the channel, or null if the channel is not a user channel
27+
*/
28+
@Nullable
29+
Actor getCreator();
30+
31+
/**
32+
* If this channel requires permission to join
33+
* @return true if the channel requires permission to join
34+
*/
35+
boolean requiresPermission();
36+
37+
/**
38+
* Get the required permission to join this channel
39+
* @return the required permission to join this channel, or null if the channel does not require permission
40+
*/
41+
@Nullable
42+
String getRequiredPermission();
43+
44+
/**
45+
* Check if a client is a member of this channel
46+
* @param actor the actor to check
47+
* @return true if the actor is a member of this channel
48+
*/
49+
boolean isMember(Actor actor);
50+
51+
/**
52+
* Check if a client is a member of this channel
53+
* @param uuid the uuid of the actor to check
54+
* @return true if the actor is a member of this channel
55+
*/
56+
boolean isMember(UUID uuid);
57+
58+
/**
59+
* Check if a client would be allowed to join this channel
60+
* @param client the client to check
61+
* @return the response of the join check
62+
*/
63+
ChannelJoinResponse joinPreconditionCheck(Client client);
64+
65+
/**
66+
* Add a member to the channel
67+
* @param client the client to add
68+
*/
69+
void addMember(Client client);
70+
71+
/**
72+
* Remove a member from the channel
73+
* @param client the client to remove
74+
*/
75+
void removeMember(Client client);
76+
}

api/src/main/java/com/craftmend/openaudiomc/api/media/Media.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ public class Media {
1616
/**
1717
* Source value for the media. Typically, a web compatible web link or translatable OA value
1818
*/
19-
private final String source;
19+
@Setter
20+
private String source;
2021

2122
/**
2223
* The unique id of the media, used by the client to keep track of media pools.

client/public/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"buildMajor":1,"buildMinor":125,"buildRevision":239,"buildTag":"dev","buildDate":"Sun Mar 31 2024","build":"1.125.239 dev"}
1+
{"buildMajor":1,"buildMinor":125,"buildRevision":240,"buildTag":"dev","buildDate":"Sun May 05 2024","build":"1.125.240 dev"}

client/src/client/login/ClientTokenSet.jsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ export default class ClientTokenSet {
8787
return;
8888
}
8989

90+
if (body.status === 409) {
91+
setGlobalState({
92+
isLoading: false,
93+
isBlocked: true,
94+
isValidationError: true,
95+
});
96+
ReportError('Invalid token', window.tokenCache.name);
97+
resolve(null);
98+
return;
99+
}
100+
90101
body.json().then((sessionValidationResponse) => {
91102
if (sessionValidationResponse.errors.length > 0) {
92103
if (this.attempts < 3) {

client/src/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"buildMajor":1,"buildMinor":125,"buildRevision":239,"buildTag":"dev","buildDate":"Sun Mar 31 2024","build":"1.125.239 dev"}
1+
{"buildMajor":1,"buildMinor":125,"buildRevision":240,"buildTag":"dev","buildDate":"Sun May 05 2024","build":"1.125.240 dev"}

client/src/state/store.jsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ const initialState = {
122122
isLoading: true,
123123
isBlocked: false, // whenever an account is temporarily blocked (rate-limiting, abuse)
124124
isPersonalBlock: false, // whenever this user is personally rate-limited or blocked (due to for example, dmca abuse)
125+
isValidationError: false, // whenever the client is not whitelisted to be used on this server
125126
loadingState: 'Preparing to load OpenAudioMc',
126127
fixedFooter: null,
127128
navbarDetails: true,

client/src/views/login/BlockedLoginView.jsx

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ function BlockedLoginView(props) {
1010
<div className="card flex-shrink-0 w-full max-w-sm shadow-2xl bg-base-100">
1111
<div className="card-body">
1212
<div>
13-
{props.isPersonalBlock ? (
13+
{!props.isValidationError && props.isPersonalBlock ? (
1414
<p className="w-80 text-center text-sm mb-8 text-white tracking-wide cursor-pointer">
1515
You are currently blocked from using OpenAudioMc. Please contact support at
1616
{' '}
@@ -20,7 +20,7 @@ function BlockedLoginView(props) {
2020
</p>
2121
) : null}
2222

23-
{!props.isPersonalBlock && (
23+
{!props.isValidationError && !props.isPersonalBlock && (
2424
<p className="w-80 text-center text-sm mb-8 text-white tracking-wide cursor-pointer">
2525
This server/account is (temporarily) blocked from using OpenAudioMc.
2626
If you&apos;re the owner of this server, please contact support at
@@ -30,6 +30,13 @@ function BlockedLoginView(props) {
3030
to appeal.
3131
</p>
3232
)}
33+
34+
{props.isValidationError ? (
35+
<p className="w-80 text-center text-sm mb-8 text-white tracking-wide cursor-pointer">
36+
This client is not whitelisted to be used on this server. Please set this client as your base url in
37+
your account and try again.
38+
</p>
39+
) : null}
3340
</div>
3441
</div>
3542
</div>
@@ -40,11 +47,14 @@ function BlockedLoginView(props) {
4047

4148
BlockedLoginView.propTypes = {
4249
isPersonalBlock: PropTypes.bool.isRequired,
50+
isValidationError: PropTypes.bool.isRequired,
4351
};
4452

4553
export default connect(mapStateToProps)(BlockedLoginView);
54+
4655
function mapStateToProps(state) {
4756
return {
4857
isPersonalBlock: state.isPersonalBlock,
58+
isValidationError: state.isValidationError,
4959
};
5060
}

0 commit comments

Comments
 (0)