Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2 #12

Closed
wants to merge 47 commits into from
Closed

v2 #12

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
0c6b31c
:sparkles: implement filters
May 2, 2021
7544609
:boom: push current v2 code
May 4, 2021
e0d81ec
:memo: redo api docs (wip)
May 6, 2021
23bbfdf
:truck: o.s.i.routes -> o.s.i.rest
May 25, 2021
2991a27
:fire: remove buildSrc and use my jfrog instance for natan's shit
May 25, 2021
0bd5445
:sparkles: ktor eap, rest logs, working natives
May 26, 2021
16d5fc8
:sparkles: add configurable logging (pt 1)
May 26, 2021
4f0ae8a
:sparkles: suspending lavaplayer events and a working websocket
May 26, 2021
8077122
:zap: int -> short
May 26, 2021
c4fc040
:goal_net: more cancellation error handling
May 26, 2021
09521ea
:sparkles: stuff
May 26, 2021
46eeb4f
:zap: use value classes for some filter
May 26, 2021
d32443c
:sparkles: moved config variable, new player update field
May 27, 2021
4028617
:ambulance: fix my stupid logic
May 27, 2021
e481719
:memo: add client and separation of api versions.
Jun 15, 2021
e850b5a
Update README.md
cloudwithax Jul 7, 2021
1a8e7df
Merge pull request #14 from cloudwithax/v2
Jul 7, 2021
80dbc8f
:arrow_up: upgrade kotlin, ktor, and lavaplayer
Jul 7, 2021
b2b1129
:wrench: update config file
Jul 7, 2021
2ddec6c
:ambulance: weird netty things
Jul 7, 2021
b32a773
:art: reformat everything
Jul 31, 2021
654cfcb
:recycle: refactor track loading
Aug 1, 2021
ff54d10
:goal_net: use better errors for route planner
Aug 1, 2021
e268358
:fire: remove redundant error
Aug 1, 2021
925a9e5
:bug: replace camel case with snake case
Aug 1, 2021
706d5ca
:bug: fix broken repository resolution
Aug 1, 2021
5cdd30a
:see_no_evil: ignore version.txt
Aug 1, 2021
30a01b1
:fire: remove version.txt
Aug 1, 2021
5dca035
:art: clearer variable names
Aug 1, 2021
e27f04d
:bug: fix udp queue frame poller
Aug 2, 2021
361194a
:memo: general changes
Aug 2, 2021
1f2b98b
:loud_sound: remove line break in logs
Aug 2, 2021
e9bd0d9
:sparkles: use custom lavaplayer
Oct 24, 2021
82d9880
:sparkles: add a search timeout
Oct 27, 2021
006abff
:rotating_light: weird compiler warning tings
Oct 27, 2021
0530573
:sparkles: make AudioLoader.load return the load result instead of a …
Oct 27, 2021
2be3941
Rename .java to .kt
Oct 27, 2021
90bc75f
:sparkles: convert udpqueue things into kotlin
Oct 27, 2021
352a945
:sparkles: fix natives
Oct 27, 2021
077ab38
:sparkles: push changes to actually fix natives
Oct 27, 2021
4bcc379
:sparkles: ok this SHOULD fix natives
Oct 27, 2021
32445e3
🔀 upgrade lavaplayer (#15)
aaronhnsy Dec 8, 2021
1d33ea2
:sparkles: annual update
Feb 13, 2022
fac699d
:sparkles: allow multiple websocket sessions for a client
Feb 26, 2022
a116fbc
:sparkles: log op name along with json
Feb 26, 2022
b67174e
:memo: update docs
Feb 26, 2022
cbdd304
:memo: update docs
viztea Feb 26, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'type: bug, s: help wanted'
assignees: ''
name: Bug report about: Create a report to help us improve title: ''
labels: 'type: bug, s: help wanted' assignees: ''

---

Expand Down
12 changes: 6 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
.idea/
.settings/

/build/
/logs/
/test/
/target/
/Server/bin
/Server/build
build/
bin/
logs/
test/
target/

.obsidianrc
*.iml
*.jar

.project
.classpath
version.txt
34 changes: 25 additions & 9 deletions API.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@ Magma is the name for the WebSocket and REST server!

---

- **Current Version:** 1.0.0-pre
- **Current Version:** 2.0.0

## Magma REST

As of version `1.0.0` of obsidian the REST API is only used for loading tracks. This will most likely change in future
releases.

### Route Planner

Allows clients to view the route planner and free-up addresses.
Expand Down Expand Up @@ -50,7 +47,8 @@ Authorization: <password>
}
```

*If no route planner was configured, both `class` and `details` will be null, the responses vary depending on what route planner was configured. Fields that are consistent:*
*If no route planner was configured, both `class` and `details` will be null, the responses vary depending on what route
planner was configured. Fields that are consistent:*

- `class` *string* name of the route planner
- `details.ip_block` *string* the current ip-block
Expand All @@ -68,7 +66,8 @@ Authorization: <password>

**RotatingNanoIpRoutePlanner**

- `details.block_index` *string* containing the file information in which /64 block ips are chosen, this number increases on each ban.
- `details.block_index` *string* containing the file information in which /64 block ips are chosen, this number
increases on each ban.
- `details.current_address_index` *long* representing the current offset in the ip-block.

#### Unmark a failed address
Expand Down Expand Up @@ -101,6 +100,22 @@ Authorization: <password>

*204 - No Content*

### Player Controller

Each request must have a `User-Id` header or query parameter containing your bot's user id

- **Base Path:** `/players/{guild id}`

<sub>The `Client-Name` header or query parameter may be required if the node you're using requires it.</sub>

| endpoint | description |
| :------- | :------------------------- |
| / | returns info on the player |
| /play | plays
|
|
|

### Tracks Controller

Allows non-jvm clients to search and decode tracks using Obsidian!
Expand Down Expand Up @@ -131,7 +146,8 @@ Authorization: <configured password>
"length": 270000,
"position": 0,
"is_stream": false,
"is_seekable": true
"is_seekable": true,
"source_name": "youtube"
}
}
],
Expand Down Expand Up @@ -291,7 +307,6 @@ Stats on the node
}
```


#### Player Events

List of current player events Example:
Expand Down Expand Up @@ -367,7 +382,8 @@ dispatched when track playback is stuck
}
```

- [**Lavaplayer**](https://github.com/sedmelluq/lavaplayer/blob/bec39953a037b318663fad76873fbab9ce13c033/main/src/main/java/com/sedmelluq/discord/lavaplayer/player/event/TrackStuckEvent.java)
- [**
Lavaplayer**](https://github.com/sedmelluq/lavaplayer/blob/bec39953a037b318663fad76873fbab9ce13c033/main/src/main/java/com/sedmelluq/discord/lavaplayer/player/event/TrackStuckEvent.java)

##### `TRACK_EXCEPTION`

Expand Down
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

## Usage.

For obsidian to work correctly you must use **Java 11** or above.
For obsidian to work correctly you must use **Java 11** or above.

- Goto the [releases page](/releases).
- Download the **Latest Jar File**
- Download the **The Latest Jar File**
- Make an [`obsidian.yml`](/obsidian.yml) file in the same directory as the jar file
- Open a prompt in the same directory as the jar file.

Expand All @@ -25,7 +25,13 @@ Now go make a bot with the language and client of your choice!

> Clients are used to interface with Magma, Obsidian's WebSocket and REST API.

- [obby.js](https://github.com/Sxmurai/obby.js), NodeJS (v14+)
###### v2

- [slate](https://github.com/Axelancerr/Slate), discord.py (Python 3.7+)

###### v1

- [obby.js](https://github.com/Sxmurai/obby.js), generic (NodeJS v14+)

**Want to make your own? Read our [API Docs](/API.md)**

Expand Down
96 changes: 0 additions & 96 deletions Server/build.gradle

This file was deleted.

95 changes: 95 additions & 0 deletions Server/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.io.ByteArrayOutputStream

plugins {
application
id("com.github.johnrengelman.shadow") version "7.0.0"
kotlin("jvm") version "1.6.10"
kotlin("plugin.serialization") version "1.6.10"
}

apply(plugin = "kotlin")

description = "A robust and performant audio sending node meant for Discord Bots."
version = "2.0.0"

application {
mainClass.set("obsidian.server.Application")
}

dependencies {
/* kotlin */
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.6.10") // standard library
implementation("org.jetbrains.kotlin:kotlin-reflect:1.6.10") // reflection
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0") // core coroutine library
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.2") // json serialization

/* server */
val ktorVersion = "1.6.7"
implementation("io.ktor:ktor-server-core:$ktorVersion") // ktor server core
implementation("io.ktor:ktor-server-cio:$ktorVersion") // ktor cio engine
implementation("io.ktor:ktor-locations:$ktorVersion") // ktor locations
implementation("io.ktor:ktor-serialization:$ktorVersion") // ktor serialization
implementation("io.ktor:ktor-websockets:$ktorVersion") // ktor websockets

/* audio */
implementation("moe.kyokobot.koe:core:koe-v2-SNAPSHOT") // discord send system

implementation("com.sedmelluq:lavaplayer:1.6.1") // lavaplayer
// implementation("com.sedmelluq:udp-queue-natives:2.0.0") // udp-queue natives
implementation(group = "com.sedmelluq", name = "udp-queue-natives", version = "2.0.0")
implementation("com.sedmelluq:lavaplayer-ext-ip-rotator:0.3.1") { // ip rotation
exclude(group = "com.sedmelluq", module = "lavaplayer")
}

implementation("com.github.natanbc:lavadsp:0.7.7") // audio filters
implementation("com.github.natanbc:native-loader:0.7.2") // lp-cross natives

/* logging */
implementation("ch.qos.logback:logback-classic:1.2.6") // slf4j logging backend
implementation("io.github.microutils:kotlin-logging-jvm:2.0.11") // logging

val konfVersion = "1.1.2"
implementation("com.github.uchuhimo.konf:konf-core:$konfVersion") // konf core shit
implementation("com.github.uchuhimo.konf:konf-yaml:$konfVersion") // yaml source
}

tasks.withType<ShadowJar> {
archiveBaseName.set("Obsidian")
archiveClassifier.set("")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = "16"
incremental = true
freeCompilerArgs = listOf(
"-Xopt-in=kotlin.ExperimentalStdlibApi",
"-Xopt-in=kotlin.RequiresOptIn",
"-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi",
"-Xopt-in=io.ktor.locations.KtorExperimentalLocationsAPI",
"-Xopt-in=kotlinx.coroutines.ObsoleteCoroutinesApi"
)
}
}

/* version info task */
fun getVersionInfo(): String {
val gitVersion = ByteArrayOutputStream()
exec {
commandLine("git", "rev-parse", "--short", "HEAD")
standardOutput = gitVersion
}

return "$version\n${gitVersion.toString().trim()}"
}

tasks.create("writeVersion") {
val resourcePath = sourceSets["main"].resources.srcDirs.first()
if (!file(resourcePath).exists()) {
resourcePath.mkdirs()
}

file("$resourcePath/version.txt").writeText(getVersionInfo())
}
Loading