Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
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
42 changes: 42 additions & 0 deletions .github/workflows/android-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Android Build

on:
pull_request:
branches: [ "**" ]

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'

- name: Create local.properties
run: |
echo "MIXPANEL_KEY=${{ secrets.MIXPANEL_KEY }}" >> local.properties
echo "STOREFILE=${{ secrets.STOREFILE }}" >> local.properties
echo "STOREPASSWORD=${{ secrets.STOREPASSWORD }}" >> local.properties
echo "KEYALIAS=${{ secrets.KEYALIAS }}" >> local.properties
echo "KEYPASSWORD=${{ secrets.KEYPASSWORD }}" >> local.properties

- name: Setup Android SDK
uses: android-actions/setup-android@v3

- name: Build and Test
uses: gradle/gradle-build-action@v3
with:
arguments: |
assembleDebug
assembleRelease
lintDebug
lintRelease
test
cache-read-only: false
1 change: 1 addition & 0 deletions .github/workflows/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:

jobs:
detekt:
concurrency: detekt-${{ github.ref }}
name: Static Code Analysis with Detekt
runs-on: ubuntu-latest

Expand Down
40 changes: 25 additions & 15 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,29 @@ android {
compose = true
}

signingConfigs {
create("release") {
val props = loadLocalProperties()
storeFile = file(props["STOREFILE"] as? String ?: "")
storePassword = props["STOREPASSWORD"] as? String ?: ""
keyAlias = props["KEYALIAS"] as? String ?: ""
keyPassword = props["KEYPASSWORD"] as? String ?: ""
}

getByName("debug") {
val props = loadLocalProperties()
storeFile = file(props["STOREFILE"] as? String ?: "")
storeFile = props["STOREFILE"]?.let { file(it) }
storePassword = props["STOREPASSWORD"] as? String ?: ""
keyAlias = props["KEYALIAS"] as? String ?: ""
keyPassword = props["KEYPASSWORD"] as? String ?: ""
}
}

buildTypes {

getByName("release") {
signingConfig = signingConfigs.getByName("debug")
signingConfig = signingConfigs.getByName("release")
isMinifyEnabled = false
isShrinkResources = false
applicationIdSuffix = ".release"
Expand All @@ -78,16 +97,7 @@ android {
signingConfig = signingConfigs.getByName("debug")
applicationIdSuffix = ".debug"
isMinifyEnabled = false
}
}

signingConfigs {
getByName("debug") {
val props = loadLocalProperties()
storeFile = file(props["STOREFILE"] as? String ?: "")
storePassword = props["STOREPASSWORD"] as? String ?: ""
keyAlias = props["KEYALIAS"] as? String ?: ""
keyPassword = props["KEYPASSWORD"] as? String ?: ""
buildConfigField("Boolean", "ENABLE_BUILD_CACHE", "true")
}
}

Expand Down Expand Up @@ -241,9 +251,9 @@ dependencies {
implementation("com.google.api-client:google-api-client-android:1.26.0")
implementation("com.google.apis:google-api-services-drive:v3-rev136-1.25.0")

// Tor Libraries
implementation(libs.tor.android)
implementation(libs.jtorctl)
// Internal Tor Libraries
//implementation(libs.tor.android)
//implementation(libs.jtorctl)

implementation(libs.bitcoinj.core)
implementation("com.eclipsesource.j2v8:j2v8:6.2.1@aar")
Expand Down Expand Up @@ -275,7 +285,7 @@ dependencies {
implementation("com.github.derlio:audio-waveform:v1.0.1")

implementation(libs.clean.insights)
implementation(libs.netcipher)
implementation(fileTree("libs"))

// Mixpanel analytics
implementation(libs.mixpanel)
Expand Down
1 change: 0 additions & 1 deletion app/detekt-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@
<ID>FinalNewline:VideoRequestHandler.kt$net.opendasharchive.openarchive.fragments.VideoRequestHandler.kt</ID>
<ID>FinalNewline:ViewExtension.kt$net.opendasharchive.openarchive.extensions.ViewExtension.kt</ID>
<ID>FinalNewline:WebDAVModel.kt$net.opendasharchive.openarchive.db.WebDAVModel.kt</ID>
<ID>FinalNewline:WebDavActivity.kt$net.opendasharchive.openarchive.services.webdav.WebDavActivity.kt</ID>
<ID>FinalNewline:WebDavConduit.kt$net.opendasharchive.openarchive.services.webdav.WebDavConduit.kt</ID>
<ID>FinalNewline:WebDavFragment.kt$net.opendasharchive.openarchive.services.webdav.WebDavFragment.kt</ID>
<ID>FinalNewline:WebDavSetupLicenseFragment.kt$net.opendasharchive.openarchive.services.webdav.WebDavSetupLicenseFragment.kt</ID>
Expand Down
Binary file added app/libs/netcipher.aar
Binary file not shown.
55 changes: 3 additions & 52 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@
android:name=".features.main.HomeActivity"
android:exported="true"
android:screenOrientation="portrait"
android:theme="@style/SaveAppTheme.NoActionBar">
android:theme="@style/SaveAppTheme.NoActionBar"
tools:ignore="DiscouragedApi">
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->

Expand Down Expand Up @@ -142,44 +143,10 @@
</intent-filter>
</activity>

<activity
android:name=".upload.UploadManagerActivity"
android:exported="false"
android:label="@string/title_activity_upload_manager"
android:taskAffinity=""
android:theme="@style/SaveAppTheme.NoActionBar" />


<activity
android:name=".services.webdav.WebDavActivity"
android:label="@string/title_activity_login"
android:taskAffinity=""
android:theme="@style/SaveAppTheme.NoActionBar"
android:windowSoftInputMode="adjustPan" />

<activity
android:name=".features.internetarchive.presentation.InternetArchiveActivity"
android:label="@string/title_activity_login"
android:taskAffinity=""
android:theme="@style/SaveAppTheme.NoActionBar" />

<activity
android:name=".services.gdrive.GDriveActivity"
android:theme="@style/SaveAppTheme.NoActionBar" />

<activity
android:name=".features.settings.FoldersActivity"
android:exported="false"
android:label="@string/folders"
android:theme="@style/SaveAppTheme.NoActionBar" />

<activity
android:name=".features.settings.GeneralSettingsActivity"
android:exported="false"
android:label="@string/general"
android:taskAffinity=""
android:theme="@style/SaveAppTheme.NoActionBar" />

<activity
android:name=".features.settings.ProofModeSettingsActivity"
android:exported="false"
Expand Down Expand Up @@ -229,22 +196,6 @@
android:taskAffinity=""
android:theme="@style/SaveAppTheme.NoActionBar" />

<!-- <activity-->
<!-- android:name=".features.folders.CreateNewFolderActivity"-->
<!-- android:label="@string/new_folder"-->
<!-- android:taskAffinity=""-->
<!-- android:theme="@style/SaveAppTheme.NoActionBar" />-->

<activity
android:name=".features.folders.AddFolderActivity"
android:taskAffinity=""
android:theme="@style/SaveAppTheme.NoActionBar" />

<activity
android:name=".features.settings.EditFolderActivity"
android:taskAffinity=""
android:theme="@style/SaveAppTheme.NoActionBar" />

<activity
android:name=".features.settings.ConsentActivity"
android:label="@string/health_checks"
Expand Down Expand Up @@ -308,7 +259,7 @@
<service
android:name=".services.snowbird.service.SnowbirdService"
android:exported="false"
android:foregroundServiceType="dataSync"></service>
android:foregroundServiceType="dataSync" />

</application>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/*
* Copyright 2012-2016 Nathan Freitas
* Copyright 2015 str4d
* Portions Copyright (c) 2016 CommonsWare, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package info.guardianproject.netcipher.client;

import android.content.Context;
import android.content.Intent;
import javax.net.ssl.SSLSocketFactory;

import okhttp3.OkHttpClient;
import okhttp3.Request;

/**
* Creates an OkHttpClient using NetCipher configuration. Use
* build() if you have no other OkHttpClient configuration
* that you need to perform. Or, use applyTo() to augment an
* existing OkHttpClient.Builder with NetCipher.
*/
public class StrongOkHttpClientBuilder extends
StrongBuilderBase<StrongOkHttpClientBuilder, OkHttpClient> {
/**
* Creates a StrongOkHttpClientBuilder using the strongest set
* of options for security. Use this if the strongest set of
* options is what you want; otherwise, create a
* builder via the constructor and configure it as you see fit.
*
* @param context any Context will do
* @return a configured StrongOkHttpClientBuilder
* @throws Exception
*/
static public StrongOkHttpClientBuilder forMaxSecurity(Context context)
throws Exception {
return(new StrongOkHttpClientBuilder(context)
.withBestProxy());
}

/**
* Creates a builder instance.
*
* @param context any Context will do; builder will hold onto
* Application context
*/
public StrongOkHttpClientBuilder(Context context) {
super(context);
}

/**
* Copy constructor.
*
* @param original builder to clone
*/
public StrongOkHttpClientBuilder(StrongOkHttpClientBuilder original) {
super(original);
}

/**
* OkHttp3 does not support SOCKS proxies:
* https://github.com/square/okhttp/issues/2315
*
* @return false
*/
@Override
public boolean supportsSocksProxy() {
return(false);
}

/**
* {@inheritDoc}
*/
@Override
public OkHttpClient build(Intent status) {
return(applyTo(new OkHttpClient.Builder(), status).build());
}

/**
* Adds NetCipher configuration to an existing OkHttpClient.Builder,
* in case you have additional configuration that you wish to
* perform.
*
* @param builder a new or partially-configured OkHttpClient.Builder
* @return the same builder
*/
public OkHttpClient.Builder applyTo(OkHttpClient.Builder builder, Intent status) {
SSLSocketFactory factory=buildSocketFactory();

if (factory!=null) {
builder.sslSocketFactory(factory);
}

return(builder
.proxy(buildProxy(status)));
}

@Override
protected String get(Intent status, OkHttpClient connection,
String url) throws Exception {
Request request=new Request.Builder().url(TOR_CHECK_URL).build();

return(connection.newCall(request).execute().body().string());
}
}
15 changes: 9 additions & 6 deletions app/src/main/java/net/opendasharchive/openarchive/SaveApp.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import net.opendasharchive.openarchive.core.logger.AppLogger
import net.opendasharchive.openarchive.features.settings.passcode.PasscodeManager
import net.opendasharchive.openarchive.util.Analytics
import net.opendasharchive.openarchive.util.Prefs
import net.opendasharchive.openarchive.util.Theme
import org.koin.android.ext.koin.androidContext
import org.koin.android.ext.koin.androidLogger
import org.koin.core.context.startKoin
Expand Down Expand Up @@ -69,7 +68,7 @@ class SaveApp : SugarApp(), SingletonImageLoader.Factory {
Prefs.load(this)
applyTheme()

if (Prefs.useTor) initNetCipher()
initNetCipher()

CleanInsightsManager.init(this)

Expand All @@ -78,13 +77,17 @@ class SaveApp : SugarApp(), SingletonImageLoader.Factory {

private fun initNetCipher() {
AppLogger.d("Initializing NetCipher client")
val oh = OrbotHelper.get(this)

if (BuildConfig.DEBUG) {
oh.skipOrbotValidation()
OrbotHelper.get(this).apply {
if (BuildConfig.DEBUG) {
skipOrbotValidation()
}
init()
}

// oh.init()
if (Prefs.useTor) {
OrbotHelper.requestStartTor(this@SaveApp)
}
}

private fun createSnowbirdNotificationChannel() {
Expand Down
Loading
Loading