mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Old python scripts and config files removed. Transifex config updated with the new directory structure.
This commit is contained in:
parent
742370b5fa
commit
96fd11ee6f
16
.gitignore
vendored
16
.gitignore
vendored
@ -7,22 +7,12 @@ gen/
|
||||
.idea/
|
||||
*.iml
|
||||
out
|
||||
tests
|
||||
local.properties
|
||||
ant.properties
|
||||
.DS_Store
|
||||
build.log
|
||||
build-log.xml
|
||||
.gradle
|
||||
build
|
||||
local.properties
|
||||
.DS_Store
|
||||
.gradle
|
||||
signing.properties
|
||||
library/lib/
|
||||
library/obj/
|
||||
ffpr
|
||||
test/androidTestEspresso/res/values/arrays.xml
|
||||
obj/
|
||||
jni/libspeex/.deps/
|
||||
*.sh
|
||||
pkcs11.password
|
||||
fabric.properties
|
||||
play
|
||||
|
@ -3,8 +3,8 @@ host = https://www.transifex.com
|
||||
lang_map = da_DK:da-rDK,he:iw,id:in,kn_IN:kn-rIN,pt_BR:pt-rBR,pt_PT:pt,qu_EC:qu-rEC,sv_SE:sv-rSE,zh_CN:zh-rCN,zh_HK:zh-rHK,zh_TW:zh-rTW
|
||||
|
||||
[signal-android.master]
|
||||
file_filter = res/values-<lang>/strings.xml
|
||||
source_file = res/values/strings.xml
|
||||
file_filter = app/src/main/res/values-<lang>/strings.xml
|
||||
source_file = app/src/main/res/values/strings.xml
|
||||
source_lang = en
|
||||
type = ANDROID
|
||||
|
||||
|
@ -1,79 +0,0 @@
|
||||
#! /usr/bin/env python3
|
||||
|
||||
import sys
|
||||
from zipfile import ZipFile
|
||||
|
||||
class ApkDiff:
|
||||
# resources.arsc is ignored due to https://issuetracker.google.com/issues/110237303
|
||||
# May be fixed in Android Gradle Plugin 3.4
|
||||
IGNORE_FILES = ["META-INF/MANIFEST.MF", "META-INF/SIGNAL_S.RSA", "META-INF/SIGNAL_S.SF", "resources.arsc"]
|
||||
|
||||
def compare(self, sourceApk, destinationApk):
|
||||
sourceZip = ZipFile(sourceApk, 'r')
|
||||
destinationZip = ZipFile(destinationApk, 'r')
|
||||
|
||||
if self.compareManifests(sourceZip, destinationZip) and self.compareEntries(sourceZip, destinationZip) == True:
|
||||
print("APKs match!")
|
||||
else:
|
||||
print("APKs don't match!")
|
||||
|
||||
def compareManifests(self, sourceZip, destinationZip):
|
||||
sourceEntrySortedList = sorted(sourceZip.namelist())
|
||||
destinationEntrySortedList = sorted(destinationZip.namelist())
|
||||
|
||||
for ignoreFile in self.IGNORE_FILES:
|
||||
while ignoreFile in sourceEntrySortedList: sourceEntrySortedList.remove(ignoreFile)
|
||||
while ignoreFile in destinationEntrySortedList: destinationEntrySortedList.remove(ignoreFile)
|
||||
|
||||
if len(sourceEntrySortedList) != len(destinationEntrySortedList):
|
||||
print("Manifest lengths differ!")
|
||||
|
||||
for (sourceEntryName, destinationEntryName) in zip(sourceEntrySortedList, destinationEntrySortedList):
|
||||
if sourceEntryName != destinationEntryName:
|
||||
print("Sorted manifests don't match, %s vs %s" % (sourceEntryName, destinationEntryName))
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def compareEntries(self, sourceZip, destinationZip):
|
||||
sourceInfoList = list(filter(lambda sourceInfo: sourceInfo.filename not in self.IGNORE_FILES, sourceZip.infolist()))
|
||||
destinationInfoList = list(filter(lambda destinationInfo: destinationInfo.filename not in self.IGNORE_FILES, destinationZip.infolist()))
|
||||
|
||||
if len(sourceInfoList) != len(destinationInfoList):
|
||||
print("APK info lists of different length!")
|
||||
return False
|
||||
|
||||
for sourceEntryInfo in sourceInfoList:
|
||||
for destinationEntryInfo in list(destinationInfoList):
|
||||
if sourceEntryInfo.filename == destinationEntryInfo.filename:
|
||||
sourceEntry = sourceZip.open(sourceEntryInfo, 'r')
|
||||
destinationEntry = destinationZip.open(destinationEntryInfo, 'r')
|
||||
|
||||
if self.compareFiles(sourceEntry, destinationEntry) != True:
|
||||
print("APK entry %s does not match %s!" % (sourceEntryInfo.filename, destinationEntryInfo.filename))
|
||||
return False
|
||||
|
||||
destinationInfoList.remove(destinationEntryInfo)
|
||||
break
|
||||
|
||||
return True
|
||||
|
||||
def compareFiles(self, sourceFile, destinationFile):
|
||||
sourceChunk = sourceFile.read(1024)
|
||||
destinationChunk = destinationFile.read(1024)
|
||||
|
||||
while sourceChunk != b"" or destinationChunk != b"":
|
||||
if sourceChunk != destinationChunk:
|
||||
return False
|
||||
|
||||
sourceChunk = sourceFile.read(1024)
|
||||
destinationChunk = destinationFile.read(1024)
|
||||
|
||||
return True
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 3:
|
||||
print("Usage: apkdiff <pathToFirstApk> <pathToSecondApk>")
|
||||
sys.exit(1)
|
||||
|
||||
ApkDiff().compare(sys.argv[1], sys.argv[2])
|
2
apntool/.gitignore
vendored
2
apntool/.gitignore
vendored
@ -1,2 +0,0 @@
|
||||
*.db
|
||||
*.db.gz
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,106 +0,0 @@
|
||||
import sys
|
||||
import re
|
||||
import argparse
|
||||
import sqlite3
|
||||
import gzip
|
||||
from progressbar import ProgressBar, Counter, Timer
|
||||
from lxml import etree
|
||||
|
||||
parser = argparse.ArgumentParser(prog='apntool', description="""Process Android's apn xml files and drop them into an
|
||||
easily queryable SQLite db. Tested up to version 9 of
|
||||
their APN file.""")
|
||||
parser.add_argument('-v', '--version', action='version', version='%(prog)s v1.1')
|
||||
parser.add_argument('-i', '--input', help='the xml file to parse', default='apns.xml', required=False)
|
||||
parser.add_argument('-o', '--output', help='the sqlite db output file', default='apns.db', required=False)
|
||||
parser.add_argument('--quiet', help='do not show progress or verbose instructions', action='store_true', required=False)
|
||||
parser.add_argument('--no-gzip', help="do not gzip after creation", action='store_true', required=False)
|
||||
args = parser.parse_args()
|
||||
|
||||
|
||||
def normalized(target):
|
||||
o2_typo = re.compile(r"02\.co\.uk")
|
||||
port_typo = re.compile(r"(\d+\.\d+\.\d+\.\d+)\.(\d+)")
|
||||
leading_zeros = re.compile(r"(/|\.|^)0+(\d+)")
|
||||
subbed = o2_typo.sub(r'o2.co.uk', target)
|
||||
subbed = port_typo.sub(r'\1:\2', subbed)
|
||||
subbed = leading_zeros.sub(r'\1\2', subbed)
|
||||
return subbed
|
||||
|
||||
try:
|
||||
connection = sqlite3.connect(args.output)
|
||||
cursor = connection.cursor()
|
||||
cursor.execute('SELECT SQLITE_VERSION()')
|
||||
version = cursor.fetchone()
|
||||
if not args.quiet:
|
||||
print("SQLite version: %s" % version)
|
||||
print("Opening %s" % args.input)
|
||||
|
||||
cursor.execute("PRAGMA legacy_file_format=ON")
|
||||
cursor.execute("PRAGMA journal_mode=DELETE")
|
||||
cursor.execute("PRAGMA page_size=32768")
|
||||
cursor.execute("VACUUM")
|
||||
cursor.execute("DROP TABLE IF EXISTS apns")
|
||||
cursor.execute("""CREATE TABLE apns(_id INTEGER PRIMARY KEY, mccmnc TEXT, mcc TEXT, mnc TEXT, carrier TEXT,
|
||||
apn TEXT, mmsc TEXT, port INTEGER, type TEXT, protocol TEXT, bearer TEXT, roaming_protocol TEXT,
|
||||
carrier_enabled INTEGER, mmsproxy TEXT, mmsport INTEGER, proxy TEXT, mvno_match_data TEXT,
|
||||
mvno_type TEXT, authtype INTEGER, user TEXT, password TEXT, server TEXT)""")
|
||||
|
||||
apns = etree.parse(args.input)
|
||||
root = apns.getroot()
|
||||
pbar = None
|
||||
if not args.quiet:
|
||||
pbar = ProgressBar(widgets=['Processed: ', Counter(), ' apns (', Timer(), ')'], maxval=len(list(root))).start()
|
||||
|
||||
count = 0
|
||||
for apn in root.iter("apn"):
|
||||
if apn.get("mmsc") is None:
|
||||
continue
|
||||
sqlvars = ["?" for x in apn.attrib.keys()] + ["?"]
|
||||
mccmnc = "%s%s" % (apn.get("mcc"), apn.get("mnc"))
|
||||
normalized_mmsc = normalized(apn.get("mmsc"))
|
||||
if normalized_mmsc != apn.get("mmsc"):
|
||||
print("normalize MMSC: %s => %s" % (apn.get("mmsc"), normalized_mmsc))
|
||||
apn.set("mmsc", normalized_mmsc)
|
||||
|
||||
if not apn.get("mmsproxy") is None:
|
||||
normalized_mmsproxy = normalized(apn.get("mmsproxy"))
|
||||
if normalized_mmsproxy != apn.get("mmsproxy"):
|
||||
print("normalize proxy: %s => %s" % (apn.get("mmsproxy"), normalized_mmsproxy))
|
||||
apn.set("mmsproxy", normalized_mmsproxy)
|
||||
|
||||
values = [apn.get(attrib) for attrib in apn.attrib.keys()] + [mccmnc]
|
||||
keys = apn.attrib.keys() + ["mccmnc"]
|
||||
|
||||
cursor.execute("SELECT 1 FROM apns WHERE mccmnc = ? AND apn = ?", [mccmnc, apn.get("apn")])
|
||||
if cursor.fetchone() is None:
|
||||
statement = "INSERT INTO apns (%s) VALUES (%s)" % (", ".join(keys), ", ".join(sqlvars))
|
||||
cursor.execute(statement, values)
|
||||
|
||||
count += 1
|
||||
if not args.quiet:
|
||||
pbar.update(count)
|
||||
|
||||
if not args.quiet:
|
||||
pbar.finish()
|
||||
connection.commit()
|
||||
print("Successfully written to %s" % args.output)
|
||||
|
||||
if not args.no_gzip:
|
||||
gzipped_file = "%s.gz" % (args.output,)
|
||||
with open(args.output, 'rb') as orig:
|
||||
with gzip.open(gzipped_file, 'wb') as gzipped:
|
||||
gzipped.writelines(orig)
|
||||
print("Successfully gzipped to %s" % gzipped_file)
|
||||
|
||||
if not args.quiet:
|
||||
print("\nTo include this in the distribution, copy it to the project's assets/databases/ directory.")
|
||||
print("If you support API 10 or lower, you must use the gzipped version to avoid corruption.")
|
||||
|
||||
except sqlite3.Error, e:
|
||||
if connection:
|
||||
connection.rollback()
|
||||
print("Error: %s" % e.args[0])
|
||||
sys.exit(1)
|
||||
finally:
|
||||
if connection:
|
||||
connection.close()
|
@ -1,3 +0,0 @@
|
||||
argparse>=1.2.1
|
||||
lxml>=3.3.3
|
||||
progressbar-latest>=2.4
|
@ -1,5 +0,0 @@
|
||||
name = OpenSC-PKCS11
|
||||
description = SunPKCS11 via OpenSC
|
||||
library = /usr/lib/x86_64-linux-gnu/opensc-pkcs11.so
|
||||
slotListIndex = 0
|
||||
|
@ -1,5 +1,5 @@
|
||||
include ':libsignal'
|
||||
include ':libsession'
|
||||
rootProject.name = "session-android"
|
||||
|
||||
include ':app'
|
||||
include ':app'
|
||||
include ':libsession'
|
||||
include ':libsignal'
|
Loading…
Reference in New Issue
Block a user