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

4.0.0 #129

Merged
merged 35 commits into from
Nov 28, 2024
Merged

4.0.0 #129

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
58a5c43
Exclude shadowJar from maven central publish
serivesmejia Nov 19, 2024
6fd723e
Pull AprilTagDesktop from maven-central
serivesmejia Nov 19, 2024
008e332
Fix runtime exclusion mistake
serivesmejia Nov 19, 2024
c9e40ee
Migrate plugin signing utilities to the Common module
serivesmejia Nov 19, 2024
6c3dc16
Merge branch 'dev' of https://github.com/deltacv/EOCV-Sim into dev
serivesmejia Nov 19, 2024
4dc3bb7
Improve signing tool
serivesmejia Nov 19, 2024
de7d7a9
Autoaccept super access coming from trusted source & bundle PaperVision
serivesmejia Nov 21, 2024
2e2ad47
Add welcome dialogs to EOCV-Sim
serivesmejia Nov 21, 2024
6073ef3
Improve flag naming
serivesmejia Nov 21, 2024
3e70359
Add better create workspace dialog
serivesmejia Nov 21, 2024
3b0c1d7
Better order of welcome dialogs to endorse PaperVision
serivesmejia Nov 21, 2024
fe17d11
Improve default highlighting of PaperVision tab
serivesmejia Nov 21, 2024
f4f0ebe
Change to artifact version 4.0.0
serivesmejia Nov 21, 2024
98606a9
Update PaperVision to 1.0.2
serivesmejia Nov 22, 2024
dc1bc2d
Add PaperVision check to warn user of missing or differing plugin ver…
serivesmejia Nov 23, 2024
f87ad9a
Revamp the EOCV-Sim icon
serivesmejia Nov 23, 2024
e77947a
Use new icon in taskbar
serivesmejia Nov 23, 2024
c3ce553
Point docs link to deltacv.org
serivesmejia Nov 23, 2024
ed42d0c
macOS: Add application name, use system light/dark mode in titlebar
qwertychouskie Nov 25, 2024
2c66132
macOS: Use standard Settings & About entries in menu
qwertychouskie Nov 26, 2024
e2f7d84
Merge pull request #128 from qwertychouskie/dev
serivesmejia Nov 26, 2024
33f8586
Top menu bar changes
serivesmejia Nov 27, 2024
ff3240a
Merge branch 'dev' of https://github.com/deltacv/EOCV-Sim into dev
serivesmejia Nov 27, 2024
56f82c7
Improve PaperVisionChecker messages
serivesmejia Nov 27, 2024
f7e441f
Fix IAmA dialog size for macos
serivesmejia Nov 27, 2024
dab01c5
Fix NPE on prefersPaperVision
serivesmejia Nov 27, 2024
3c887b1
Only run shadowJar when explicitely called
serivesmejia Nov 27, 2024
57626e1
Fix docs url in README
serivesmejia Nov 27, 2024
d419d33
configureEach in jar
serivesmejia Nov 28, 2024
2318fc0
Add PaperVision info to the README
serivesmejia Nov 28, 2024
cf5b5ea
Update GitHub Actions badges
serivesmejia Nov 28, 2024
4611c8f
Update EOCV-Sim icon in README
serivesmejia Nov 28, 2024
45d1716
Add papervision gif
serivesmejia Nov 28, 2024
7f84006
Add changelog for 4.0.0
serivesmejia Nov 28, 2024
f52c1a3
Merge branch 'main' into dev
serivesmejia Nov 28, 2024
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: 1 addition & 1 deletion .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.JRELEASER_MAVENCENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
run: ./gradlew -Penv=release :Common:publishToMavenCentral :Vision:publishToMavenCentral :EOCV-Sim:publishToMavenCentral -x test :EOCV-Sim:shadowJar
run: ./gradlew -Penv=release :Common:publishToMavenCentral :Vision:publishToMavenCentral :EOCV-Sim:publishToMavenCentral -x test -x :EOCV-Sim:shadowJar
if: ${{ startsWith(github.ref, 'refs/tags/v') }}

- name: Build release shadow jar with Gradle
Expand Down
17 changes: 17 additions & 0 deletions Common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,31 @@
plugins {
id 'kotlin'
id 'signing'
id 'com.github.johnrengelman.shadow'
id "com.vanniktech.maven.publish" version "0.30.0"
}

apply from: '../build.common.gradle'

components.java {
tasks.named("shadowJar").configure {
// only run shadowJar when explicitly specified by the user
// check if user invoked gradle with :shadowJar
enabled = project.gradle.startParameter.taskNames.contains("shadowJar")
}
}

shadowJar {
dependencies {
exclude "nu/pattern/*"
}
}

dependencies {
api "org.openpnp:opencv:$opencv_version"

implementation "com.moandjiezana.toml:toml4j:$toml4j_version"
implementation "info.picocli:picocli:$picocli_version"
implementation "org.slf4j:slf4j-api:$slf4j_version"
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,31 @@

package com.github.serivesmejia.eocvsim.util.extension

import com.github.serivesmejia.eocvsim.util.SysUtil
import java.io.File
import java.security.MessageDigest

val appData: File = File(System.getProperty("user.home") + File.separator)

/**
* Operator function to concatenate a string to a file path
*/
operator fun File.plus(str: String): File {
return File(this.absolutePath, str)
}


fun File.fileHash(algorithm: String = "SHA-256"): String {
val messageDigest = MessageDigest.getInstance(algorithm)
messageDigest.update(readBytes())
return SysUtil.byteArray2Hex(messageDigest.digest())
return byteArrayToHex(messageDigest.digest())
}

private val hex = charArrayOf('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f')

fun byteArrayToHex(bytes: ByteArray): String {
val sb = StringBuilder(bytes.size * 2)
for (b in bytes) {
sb.append(hex[(b.toInt() and 0xF0) shr 4])
sb.append(hex[b.toInt() and 0x0F])
}
return sb.toString()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.serivesmejia.eocvsim.util.extension

import com.github.serivesmejia.eocvsim.util.SysUtil
import java.security.MessageDigest

/**
Expand All @@ -20,5 +19,5 @@ val Any.hashString get() = Integer.toHexString(hashCode())!!
val String.hashString: String get() {
val messageDigest = MessageDigest.getInstance("SHA-256")
val hash = messageDigest.digest(toByteArray())
return SysUtil.byteArray2Hex(hash)
return byteArrayToHex(hash)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.github.serivesmejia.eocvsim.util.io

import com.github.serivesmejia.eocvsim.util.SysUtil
import com.github.serivesmejia.eocvsim.util.extension.appData
import com.github.serivesmejia.eocvsim.util.loggerForThis
import java.io.File

Expand All @@ -10,7 +10,7 @@ import java.io.File
* Also handles locking the folder to prevent multiple instances
* from running at the same time (which could cause issues).
*/
object EOCVSimFolder : File(SysUtil.getAppData().absolutePath + separator + ".eocvsim") {
object EOCVSimFolder : File(appData.absolutePath + separator + ".eocvsim") {

val logger by loggerForThis()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.github.serivesmejia.eocvsim.util.io

import com.github.serivesmejia.eocvsim.util.SysUtil
import com.github.serivesmejia.eocvsim.util.loggerForThis
import java.io.File
import java.io.RandomAccessFile
Expand All @@ -12,14 +11,6 @@ import java.nio.channels.FileLock
*/
class LockFile(pathname: String) : File(pathname) {

companion object {
val POR_UNA_NOCHE = try {
SysUtil.loadResStr("/.lock")
} catch(ex: Exception) {
"lock"
}
}

private var raf = RandomAccessFile(this, "rw")

var lock: FileLock? = null
Expand All @@ -45,7 +36,7 @@ class LockFile(pathname: String) : File(pathname) {
throw IllegalArgumentException("Lock file cannot be a directory")

if(!exists())
SysUtil.saveFileStr(this, POR_UNA_NOCHE)
createNewFile()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ class ParsedVersion(val version: String) {
*/
val patch = splitVersion.getOrNull(2)?.toIntOrNull() ?: 0

constructor(major: Int, minor: Int, patch: Int = 0) : this("$major.$minor.$patch")

/**
* Compare this version to another ParsedVersion
* @param o the other ParsedVersion to compare to
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package io.github.deltacv.eocvsim.plugin

import com.github.serivesmejia.eocvsim.util.extension.plus
import com.github.serivesmejia.eocvsim.util.io.EOCVSimFolder
import java.io.File

val PLUGIN_FOLDER = (EOCVSimFolder + File.separator + "plugins").apply { mkdir() }
val PLUGIN_CACHING_FOLDER = (PLUGIN_FOLDER + File.separator + "caching").apply { mkdir() }
val FILESYSTEMS_FOLDER = (PLUGIN_FOLDER + File.separator + "filesystems").apply { mkdir() }
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,10 @@

package io.github.deltacv.eocvsim.plugin.security

import com.github.serivesmejia.eocvsim.util.SysUtil
import com.github.serivesmejia.eocvsim.util.loggerForThis
import com.github.serivesmejia.eocvsim.util.extension.plus
import com.github.serivesmejia.eocvsim.util.io.LockFile
import com.github.serivesmejia.eocvsim.util.io.lockDirectory
import com.moandjiezana.toml.Toml
import io.github.deltacv.eocvsim.plugin.loader.PluginManager
import com.github.serivesmejia.eocvsim.util.loggerForThis
import io.github.deltacv.eocvsim.plugin.PLUGIN_CACHING_FOLDER
import java.io.File
import java.net.URL
import java.security.KeyFactory
Expand Down Expand Up @@ -59,8 +56,8 @@ object AuthorityFetcher {

const val AUTHORITY_SERVER_URL = "https://raw.githubusercontent.com/deltacv/Authorities/refs/heads/master"

private val AUTHORITIES_FILE = PluginManager.PLUGIN_CACHING_FOLDER + File.separator + "authorities.toml"
private val AUTHORITIES_LOCK_FILE = LockFile(PluginManager.PLUGIN_CACHING_FOLDER + File.separator + "authorities.lock")
private val AUTHORITIES_FILE = PLUGIN_CACHING_FOLDER + File.separator + "authorities.toml"
private val AUTHORITIES_LOCK_FILE = LockFile(PLUGIN_CACHING_FOLDER + File.separator + "authorities.lock")

private val AUTHORITIES_LOCK_FILE_TIMEOUT_MS = TimeUnit.SECONDS.toMillis(3)

Expand All @@ -81,7 +78,7 @@ object AuthorityFetcher {
// Load authorities from file if it exists
if (AUTHORITIES_FILE.exists() && tryLockAuthoritiesFile()) {
try {
val authoritiesToml = Toml().read(AUTHORITIES_FILE)
val authoritiesToml = com.moandjiezana.toml.Toml().read(AUTHORITIES_FILE)
val timestamp = authoritiesToml.getLong("timestamp")

if(System.currentTimeMillis() - timestamp > TTL_DURATION_MS) {
Expand Down Expand Up @@ -138,13 +135,13 @@ object AuthorityFetcher {
val currentTime = System.currentTimeMillis()

if(!AUTHORITIES_FILE.exists()) {
SysUtil.saveFileStr(AUTHORITIES_FILE, "timestamp = $currentTime\n")
AUTHORITIES_FILE.writeText("timestamp = $currentTime\n")
}

val authoritiesToml = Toml().read(AUTHORITIES_FILE)
val authoritiesToml = com.moandjiezana.toml.Toml().read(AUTHORITIES_FILE)
val timestamp = authoritiesToml.getLong("timestamp")

if(currentTime - timestamp > TTL_DURATION_MS) {
if(timestamp != null && currentTime - timestamp > TTL_DURATION_MS) {
AUTHORITIES_FILE.delete()
logger.info("Authorities file has expired, clearing cache")
cache.clear()
Expand Down Expand Up @@ -175,7 +172,7 @@ object AuthorityFetcher {
sb.appendLine("timestamp = ${System.currentTimeMillis()}")

// Write the updated content to the file
SysUtil.saveFileStr(AUTHORITIES_FILE, sb.toString())
AUTHORITIES_FILE.writeText(sb.toString())
} catch (e: Exception) {
logger.error("Failed to save authority to file", e)
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,18 @@ import java.security.KeyPairGenerator
import java.security.PrivateKey
import java.util.Base64

fun main() {
// Generate RSA key pair
val keyPair: KeyPair = generateKeyPair()
object KeyGeneratorTool {
@JvmStatic
fun main(args: Array<String>) {
// Generate RSA key pair
val keyPair: KeyPair = generateKeyPair()

// Save keys to files
saveKeyToFile("private_key.pem", keyPair.private)
saveKeyToFile("public_key.pem", keyPair.public)
// Save keys to files
saveKeyToFile("private_key.pem", keyPair.private)
saveKeyToFile("public_key.pem", keyPair.public)

println("Keys generated and saved to files.")
println("Keys generated and saved to files 'private_key.pem' and 'public_key.pem'")
}
}

fun generateKeyPair(): KeyPair {
Expand Down
Loading