Skip to content
Snippets Groups Projects
Commit 53e7ce65 authored by Tobias Ullerich's avatar Tobias Ullerich
Browse files

Change plugin source to artifactory

parent 14070eb2
No related branches found
No related tags found
No related merge requests found
......@@ -11,17 +11,15 @@ import com.j256.ormlite.table.DatabaseTable
@DatabaseField var name: String = _
@DatabaseField var displayName: String = _
@DatabaseField var description: String = _
@DatabaseField var path: String = _
@DatabaseField var version: String = _
@DatabaseField var build: Int = _
@DatabaseField var icon: String = _
@DatabaseField var category: String = _
def this(name: String, displayName: String, path: String, description: String, version: String, build: Int, icon: String, category: String) {
def this(name: String, displayName: String, description: String, version: String, build: Int, icon: String, category: String) {
this()
this.name = name
this.displayName = displayName
this.path = path
this.description = description
this.version = version
this.build = build
......
package de.tobias.playpad.server.plugin
import java.nio.file.{Files, Paths}
import java.net.URL
import com.google.gson.Gson
import com.j256.ormlite.dao.Dao
import de.thecodelabs.utils.io.IOUtils
import de.tobias.playpad.model.plugin.Plugin
import de.tobias.playpad.server.{Result, Status}
import de.tobias.playpad.utils.settings.Settings
......@@ -14,14 +14,11 @@ import spark.{Request, Response, Route}
*/
class PluginRawGet(dao: Dao[Plugin, Int], settings: Settings) extends Route {
val gson = new Gson()
override def handle(request: Request, response: Response): AnyRef = {
val plugin = dao.queryForId(request.params(":id").toInt)
if (plugin == null) {
return new Result(Status.ERROR, "Bad request")
}
val path = Paths.get(settings.download_folder, plugin.path)
Files.readAllBytes(path)
IOUtils.urlToByteArray(new URL(s"${settings.plugin_source}/${plugin.name}/${plugin.version}/${plugin.name}-${plugin.version}.jar"))
}
}
......@@ -16,5 +16,5 @@ class Settings {
var db_password: String = "password"
var db_database: String = "PlayWall"
var download_folder: String = "./"
var plugin_source: String = "https://maven.thecodelabs.de/artifactory/TheCodeLabs-release/de/tobias/playpad/"
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment