Fix jar
This commit is contained in:
parent
1b84ab88e3
commit
990cdaf1a4
3 changed files with 73 additions and 59 deletions
|
@ -8,53 +8,49 @@ import io.ktor.application.Application
|
|||
import io.ktor.server.engine.embeddedServer
|
||||
import io.ktor.server.netty.Netty
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import java.nio.file.Files
|
||||
|
||||
object Main {
|
||||
@Suppress("UnusedMainParameter")
|
||||
@JvmStatic
|
||||
fun main(args: Array<String>) {
|
||||
Resources.init()
|
||||
@Suppress("UnusedMainParameter")
|
||||
fun main(args: Array<String>) {
|
||||
Resources.init()
|
||||
|
||||
Connection.init()
|
||||
Connection.init()
|
||||
|
||||
// twitter()
|
||||
// twitter()
|
||||
|
||||
runBlocking {
|
||||
if (UserRepository.all().isEmpty()) {
|
||||
runBlocking {
|
||||
if (UserRepository.all().isEmpty()) {
|
||||
|
||||
println("Please create a root user")
|
||||
println("Please create a root user")
|
||||
|
||||
var username: String? = null
|
||||
while (username == null) {
|
||||
print("Username: ")
|
||||
username = readLine()
|
||||
}
|
||||
|
||||
var password: String? = null
|
||||
while (password == null) {
|
||||
print("Password: ")
|
||||
password = System.console()?.readPassword()?.toString() ?: readLine()
|
||||
}
|
||||
|
||||
println("Create root user '$username' with pw '${"*".repeat(password.length)}'")
|
||||
|
||||
UserRepository.create(
|
||||
User(
|
||||
null,
|
||||
username,
|
||||
hashPassword(password),
|
||||
setOf(Permission.ADMIN)
|
||||
)
|
||||
)
|
||||
var username: String? = null
|
||||
while (username == null) {
|
||||
print("Username: ")
|
||||
username = readLine()
|
||||
}
|
||||
}
|
||||
|
||||
embeddedServer(
|
||||
factory = Netty,
|
||||
port = Configuration.Server.port,
|
||||
host = Configuration.Server.host,
|
||||
module = Application::main
|
||||
).start(wait = true)
|
||||
var password: String? = null
|
||||
while (password == null) {
|
||||
print("Password: ")
|
||||
password = System.console()?.readPassword()?.toString() ?: readLine()
|
||||
}
|
||||
|
||||
println("Create root user '$username' with pw '${"*".repeat(password.length)}'")
|
||||
|
||||
UserRepository.create(
|
||||
User(
|
||||
null,
|
||||
username,
|
||||
hashPassword(password),
|
||||
setOf(Permission.ADMIN)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
embeddedServer(
|
||||
factory = Netty,
|
||||
port = Configuration.Server.port,
|
||||
host = Configuration.Server.host,
|
||||
module = Application::main
|
||||
).start(wait = true)
|
||||
}
|
||||
|
|
|
@ -27,6 +27,9 @@ object Resources {
|
|||
return
|
||||
}
|
||||
|
||||
|
||||
destination.toFile().deleteRecursively()
|
||||
|
||||
val fileSystem: FileSystem?
|
||||
val src: Path = if (uri.scheme == "jar") {
|
||||
fileSystem = FileSystems.newFileSystem(uri, mutableMapOf<String, Any?>())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue