Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ seadroid-key
/app/unused.txt
/app/proguardMapping.txt
build_count.txt

.vscode/
.claude/
32 changes: 17 additions & 15 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ plugins {
id 'com.google.gms.google-services'
id 'com.google.firebase.crashlytics'
id 'org.jetbrains.kotlin.android'
id 'org.jetbrains.kotlin.kapt'
}

android {
namespace 'com.seafile.seadroid2'

def releaseKeyPropsFile = project.file("key.properties")
def hasReleaseKeystore = releaseKeyPropsFile.exists()

defaultConfig {

applicationId namespace
Expand Down Expand Up @@ -57,18 +61,16 @@ android {
// keyPassword props.keyAliasPassword
}
release {
// Signing code for manual signing
// storeFile file(System.console().readLine("\n\$ Enter keystore path: "))
// storePassword System.console().readPassword("\n\$ Enter keystore password: ").toString()
// keyAlias System.console().readLine("\n\$ Enter key alias: ")
// keyPassword System.console().readPassword("\n\$ Enter key password: ").toString()

def props = new Properties()
props.load(new FileInputStream(project.file("key.properties")))
storeFile project.file(props.keyStore)
storePassword props.keyStorePassword
keyAlias props.keyAlias
keyPassword props.keyAliasPassword
if (hasReleaseKeystore) {
def props = new Properties()
releaseKeyPropsFile.withInputStream { props.load(it) }
storeFile project.file(props.getProperty("keyStore"))
storePassword props.getProperty("keyStorePassword")
keyAlias props.getProperty("keyAlias")
keyPassword props.getProperty("keyAliasPassword")
} else {
logger.warn("Release signing skipped: app/key.properties not found.")
}
}
}

Expand Down Expand Up @@ -98,7 +100,7 @@ android {
}

release {
signingConfig signingConfigs.release
signingConfig hasReleaseKeystore ? signingConfigs.release : signingConfigs.debug
minifyEnabled true

resValue "string", "authorities", defaultConfig.applicationId + '.cameraupload.provider'
Expand Down Expand Up @@ -237,7 +239,7 @@ android {
def room_version = "2.6.1"
implementation "androidx.room:room-runtime:$room_version"
implementation "androidx.room:room-rxjava2:$room_version"
annotationProcessor "androidx.room:room-compiler:$room_version"
kapt "androidx.room:room-compiler:$room_version"

//https://github.com/KunMinX/UnPeek-LiveData
implementation 'com.kunminx.arch:unpeek-livedata:7.8.0'
Expand Down Expand Up @@ -329,7 +331,7 @@ android {
def glide_version = "4.16.0"
implementation "com.github.bumptech.glide:glide:$glide_version"
implementation "com.github.bumptech.glide:okhttp3-integration:$glide_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
kapt "com.github.bumptech.glide:compiler:$glide_version"


testImplementation 'junit:junit:4.13.2'
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.seafile.seadroid2.framework.model

import androidx.room.Ignore
import com.seafile.seadroid2.config.Constants
import com.seafile.seadroid2.enums.ItemPositionEnum
import com.seafile.seadroid2.framework.db.entities.FileBackupStatusEntity
import com.seafile.seadroid2.ui.data_migrate.DataMigrationActivity

/**
* Controls data versioning for models that participate in migrations.
*
* When [v] == 0 legacy data may be incomplete, see [FileBackupStatusEntity] and [DataMigrationActivity].
* When [v] == 1 the record has been migrated (app version >= 3.0.0). Default is 1.
*/
open class BaseModel {
/**
* Controls data versioning for models that participate in migrations.
*
* When [v] == 0 legacy data may be incomplete, see [FileBackupStatusEntity] and [DataMigrationActivity].
* When [v] == 1 the record has been migrated (app version >= 3.0.0). Default is 1.
*/
@JvmField
var v: Int = 1

/**
* @see com.seafile.seadroid2.config.Constants.DataStatus
*/
@JvmField
var data_status: Int = Constants.DataStatus.NORMAL

@Ignore
@JvmField
var is_checked: Boolean = false

@Ignore
@JvmField
var checkable: Boolean = true

@Ignore
@JvmField
var item_position: ItemPositionEnum? = null
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
package com.seafile.seadroid2.framework.model

import android.util.Log
import java.security.MessageDigest
import java.security.cert.CertificateParsingException
import java.security.cert.X509Certificate
import java.util.Date
import javax.security.auth.x500.X500Principal

/**
* PKIX X.509 v3 certificate wrapper.
*
* Reference cadroid: https://github.com/bitfireAT/cadroid
*/
class CertificateInfo(private val certificate: X509Certificate) {

fun getSubjectName(): String =
certificate.subjectX500Principal.getName(X500Principal.RFC1779)

fun getSubjectAltNames(): Array<String>? {
return try {
val altNames = mutableListOf<String>()
val subjectAltNames = certificate.subjectAlternativeNames
if (subjectAltNames != null) {
for (asn1Name in subjectAltNames) {
val type = (asn1Name[0] as? Int) ?: continue
val value = try {
asn1Name[1] as? String ?: "?"
} catch (e: Exception) {
Log.w(DEBUG_TAG, "Couldn't cast alternative subject name to String", e)
"?"
}
altNames.add("$value [$type]")
}
}
altNames.toTypedArray()
} catch (e: CertificateParsingException) {
Log.w(DEBUG_TAG, "Couldn't parse Subject Alternative Names from certificate", e)
null
}
}

fun getSerialNumber(): String = certificate.serialNumber.toString(16)

fun getSignature(algorithm: String): String {
return try {
val digest = MessageDigest.getInstance(algorithm)
digest.update(certificate.encoded)
val bytes = digest.digest()
buildString(bytes.size * 2) {
for (byte in bytes) {
append(Integer.toHexString(byte.toInt() and 0xFF))
}
}
} catch (e: Exception) {
Log.e(DEBUG_TAG, "Couldn't calculate certificate digest", e)
e.message ?: ""
}
}

fun getNotBefore(): Date = certificate.notBefore

fun getNotAfter(): Date = certificate.notAfter

fun isCurrentlyValid(): Boolean = runCatching { certificate.checkValidity() }.isSuccess

private companion object {
private const val DEBUG_TAG = "CertificateInfo"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.seafile.seadroid2.framework.model

class ContextModel {
@JvmField
var repo_id: String? = null

@JvmField
var repo_name: String? = null

@JvmField
var type: String? = null

/**
* parent_dir + name
*/
@JvmField
var full_path: String? = null

@JvmField
var permission: String? = null

@JvmField
var encrypted: Boolean = false
}
Loading