Skip to content

Commit

Permalink
Merge pull request #48 from DerGoogler/update
Browse files Browse the repository at this point in the history
1.9.5
  • Loading branch information
DerGoogler authored Nov 11, 2023
2 parents 762ea00 + ba65c1a commit 57dd47e
Show file tree
Hide file tree
Showing 58 changed files with 1,799 additions and 1,988 deletions.
41 changes: 26 additions & 15 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,40 @@ name: Android CI

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

defaults:
run:
working-directory: Android

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
- uses: actions/checkout@v2
- name: set up JDK 11
uses: actions/setup-java@v2
with:
java-version: "11"
distribution: "adopt"
cache: gradle

- name: Set up Node.js 18
uses: actions/setup-node@v3
with:
node-version: 18

- name: Linking Node.js binaries
run: sudo ln `which node` /usr/bin/node && sudo ln `which npm` /usr/bin/npm

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Installing dependencies
run: ./gradlew app:npmInstall

- name: Build with Gradle
run: ./gradlew build
58 changes: 29 additions & 29 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ name: "CodeQL"

on:
push:
branches: [ master ]
branches: [master]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
branches: [master]
schedule:
- cron: '43 18 * * 2'
- cron: "43 18 * * 2"

jobs:
analyze:
Expand All @@ -32,40 +32,40 @@ jobs:
strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'java' ]
language: ["javascript", "java"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release
#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
32 changes: 14 additions & 18 deletions .github/workflows/webpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Build with Webpack

on:
push:
branches: [ master ]
branches: [master]
pull_request:
branches: [ master ]
branches: [master]

defaults:
run:
Expand All @@ -14,23 +14,19 @@ jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [ 16, 18 ]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2

- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Build Development
run: |
npm install --force
npm run web:dev
- name: Build Development
run: |
npm install --force
npm run web:dev
- name: Build Production
run: |
npm install --force
npm run web:prod
- name: Build Production
run: |
npm install --force
npm run web:prod
2 changes: 0 additions & 2 deletions Android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ dependencies {
implementation "androidx.appcompat:appcompat:1.6.1"
implementation "org.apache.cordova:framework:10.1.1"
implementation "androidx.webkit:webkit:1.8.0"
implementation 'com.jraska:console:1.2.0'
// implementation 'com.google.android.material:material:1.6.0'
}

configurations.implementation.setCanBeResolved(true)
Expand Down
16 changes: 8 additions & 8 deletions Android/app/default/release/output-metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,52 +20,52 @@
"filters": [
{
"filterType": "ABI",
"value": "x86"
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 185,
"versionName": "1.8.5",
"outputFile": "app-default-x86-release.apk"
"outputFile": "app-default-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 185,
"versionName": "1.8.5",
"outputFile": "app-default-x86_64-release.apk"
"outputFile": "app-default-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
"value": "arm64-v8a"
}
],
"attributes": [],
"versionCode": 185,
"versionName": "1.8.5",
"outputFile": "app-default-armeabi-v7a-release.apk"
"outputFile": "app-default-arm64-v8a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "arm64-v8a"
"value": "x86"
}
],
"attributes": [],
"versionCode": 185,
"versionName": "1.8.5",
"outputFile": "app-default-arm64-v8a-release.apk"
"outputFile": "app-default-x86-release.apk"
}
],
"elementType": "File"
Expand Down
6 changes: 4 additions & 2 deletions Android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"
android:maxSdkVersion="32" />

<queries>
<package android:name="com.topjohnwu.magisk" />
Expand Down
11 changes: 10 additions & 1 deletion Android/app/src/main/java/com/dergoogler/core/NativeStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@ public class NativeStorage {
private String localStorageName;

public NativeStorage(@NonNull Context ctx) {
this.localStorage = ctx.getSharedPreferences(localStorageName, Activity.MODE_PRIVATE);
this.localStorage = ctx.getSharedPreferences("localstorage_v2", Activity.MODE_PRIVATE);
}

@JavascriptInterface
public void defineName(String name) {
this.localStorageName = name;
}

@JavascriptInterface
public String getItem(String key, String def) {
try {
return this.localStorage.getString(key, def);
} catch (Exception e) {
return null;
}
}

@JavascriptInterface
public String getItem(String key) {
try {
Expand Down
81 changes: 70 additions & 11 deletions Android/app/src/main/java/com/dergoogler/core/NativeSuFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,11 @@
import com.topjohnwu.superuser.io.SuFileOutputStream;

import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;

import java.nio.charset.StandardCharsets;

public class NativeSuFile {
private final MainActivity ctx;
Expand All @@ -32,6 +23,74 @@ public NativeSuFile(MainActivity ctx) {
this.ctx = ctx;
}

@JavascriptInterface
public Object v2(String path) {
SuFile file = new SuFile(path);
return new Object() {
@JavascriptInterface
public void write(String data) {
try {
OutputStream outputStream = SuFileOutputStream.open(file);
outputStream.write(data.getBytes(StandardCharsets.UTF_8));
outputStream.flush();
}
catch (IOException e) {
e.printStackTrace();
}
}

@JavascriptInterface
public String read() {
try {
try (BufferedReader br = new BufferedReader(new InputStreamReader(SuFileInputStream.open(file)))) {
StringBuilder sb = new StringBuilder();
String line;
while ((line = br.readLine()) != null) {
sb.append(line);
sb.append('\n');
}
return sb.toString();
}
} catch (IOException e) {
e.printStackTrace();
return "";
}
}

@JavascriptInterface
public String list(String delimiter) {
String[] files = file.list();
if(delimiter == null) {
return String.join(",", files);
} else {
return String.join(delimiter, files);
}
}

@JavascriptInterface
public boolean create() {
return file.createNewFile();
}

@JavascriptInterface
public boolean delete() {
return file.delete();
}


@JavascriptInterface
public boolean deleteRecursive() {
return file.deleteRecursive();
}


@JavascriptInterface
public boolean exists() {
return file.exists();
}
};
}

@JavascriptInterface
public String readFile(String path) {
try {
Expand Down
Loading

0 comments on commit 57dd47e

Please sign in to comment.