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

feat: marketplace #5226

Draft
wants to merge 8 commits into
base: nextgen
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 5 commits
Commits
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
2 changes: 2 additions & 0 deletions src/main/kotlin/net/ccbluex/liquidbounce/LiquidBounce.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import net.ccbluex.liquidbounce.features.itemgroup.ClientItemGroups
import net.ccbluex.liquidbounce.features.itemgroup.groups.heads
import net.ccbluex.liquidbounce.features.misc.AccountManager
import net.ccbluex.liquidbounce.features.misc.FriendManager
import net.ccbluex.liquidbounce.features.misc.MarketplaceSubscriptionManager
import net.ccbluex.liquidbounce.features.misc.proxy.ProxyManager
import net.ccbluex.liquidbounce.features.module.ModuleManager
import net.ccbluex.liquidbounce.features.module.modules.client.ipcConfiguration
Expand Down Expand Up @@ -158,6 +159,7 @@ object LiquidBounce : EventListener {
ConfigSystem.root(ClientItemGroups)
ConfigSystem.root(LanguageManager)
ConfigSystem.root(ClientAccountManager)
ConfigSystem.root(MarketplaceSubscriptionManager)
BrowserManager
FontManager
PostRotationExecutor
Expand Down
3 changes: 2 additions & 1 deletion src/main/kotlin/net/ccbluex/liquidbounce/api/core/BaseApi.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ abstract class BaseApi(protected val baseUrl: String) {

protected suspend inline fun <reified T> delete(
endpoint: String,
body: RequestBody? = null,
crossinline headers: Headers.Builder.() -> Unit = {}
): T = request(endpoint, HttpMethod.DELETE, headers)
): T = request(endpoint, HttpMethod.DELETE, headers, body)

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import net.minecraft.client.texture.NativeImageBackedTexture
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.toRequestBody
import okio.BufferedSource
import java.io.File
import java.io.IOException
import java.io.InputStream
Expand Down Expand Up @@ -125,9 +124,9 @@ suspend inline fun <reified T> Response.parse(): T {
return use {
when (T::class) {
String::class -> body.string() as T
ByteArray::class -> body.bytes() as T
Unit::class -> Unit as T
InputStream::class -> body.byteStream() as T
BufferedSource::class -> body.source() as T
NativeImageBackedTexture::class -> body.byteStream().use { stream ->
NativeImageBackedTexture(NativeImage.read(stream)) as T
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ data class ClientAccount(
@Exclude
var cosmetics: Set<Cosmetic>? = null
) {
private suspend fun takeSession(): OAuthSession = session?.takeIf { !it.accessToken.isExpired() } ?: run {
suspend fun takeSession(): OAuthSession = session?.takeIf { !it.accessToken.isExpired() } ?: run {
renew()
session ?: error("No session")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.api.models.marketplace

import com.google.gson.annotations.SerializedName

data class MarketplaceItem(
val id: Int,
val uid: String,
val type: MarketplaceItemType,
val name: String,
val branch: String,
val description: String,
@SerializedName("thumbnail_pid")
val thumbnailPid: String?,
val featured: Boolean,
@SerializedName("created_at")
val createdAt: String,
val status: MarketplaceItemStatus
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.api.models.marketplace

import com.google.gson.annotations.SerializedName

data class MarketplaceItemRevision(
val id: Int,
@SerializedName("item_id")
val itemId: Int,
val version: String,
@SerializedName("file_pid")
val filePid: String,
val changelog: String?,
@SerializedName("created_at")
val createdAt: String,
val status: MarketplaceItemStatus
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.api.models.marketplace

import com.google.gson.annotations.SerializedName

enum class MarketplaceItemStatus {
@SerializedName("Active")
ACTIVE,
@SerializedName("Inactive")
INACTIVE,
@SerializedName("Pending")
PENDING,
@SerializedName("Rejected")
REJECTED,
@SerializedName("Deleted")
DELETED
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.api.models.marketplace

import com.google.gson.annotations.SerializedName

enum class MarketplaceItemType {
@SerializedName("Script")
SCRIPT,
@SerializedName("Config")
CONFIG,
@SerializedName("Theme")
THEME,
@SerializedName("Other")
OTHER
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.api.models.marketplace

import com.google.gson.annotations.SerializedName

data class MarketplaceReview(
val id: Int,
@SerializedName("item_id")
val itemId: Int,
val uid: String,
val rating: Int,
val review: String?,
@SerializedName("created_at")
val createdAt: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* This file is part of LiquidBounce (https://github.com/CCBlueX/LiquidBounce)
*
* Copyright (c) 2015 - 2025 CCBlueX
*
* LiquidBounce is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LiquidBounce is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LiquidBounce. If not, see <https://www.gnu.org/licenses/>.
*/
package net.ccbluex.liquidbounce.api.models.marketplace

import com.google.gson.annotations.SerializedName

data class MarketplaceRevisionDependency(
val id: Int,
@SerializedName("revision_id")
val revisionId: Int,
@SerializedName("dependency_revision_id")
val dependencyRevisionId: Int,
@SerializedName("created_at")
val createdAt: String,
@SerializedName("dependency_revision")
val dependencyRevision: MarketplaceItemRevision?
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package net.ccbluex.liquidbounce.api.models.pagination

data class PaginatedResponse<T>(
val items: List<T>,
val pagination: Pagination
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package net.ccbluex.liquidbounce.api.models.pagination

data class Pagination(
val current: Int,
val pages: Int,
val items: Int
)
Loading
Loading