167 Commits

Author SHA1 Message Date
Torsten Grote
1174022dca When clearing all data, also reset ETags
otherwise the v1 repos still relying on them would not re-update and thus the DB miss their data. This can cause unintended breakage like apps not having a preferred repo.

(cherry picked from commit 05b9157b27)
2024-10-21 13:52:49 -03:00
Torsten Grote
7a5f133759 Improve error reporting for update checking 2024-10-09 09:45:28 -03:00
Torsten Grote
cfaf9a5ad2 [db] Fix concurrent index updates
If we are used to update the same repo at almost the same time, a race-condition can happen that tries to apply a diff to an already updated DB. We don't download anything while holding a DB transaction, so the download and check for the repo timestamp happens before we enter the transaction. However, we forgot to re-check the timestamp again within the transaction to be sure the DB state is still as expected.
2024-10-08 17:14:24 +00:00
Torsten Grote
632f55eb15 [index] Fix diffing of version features
The structure of the JSON (FeatureV2) and of our internal class AppManifest is different. The latter uses a list of strings instead of objects. The ReflectionDiffer didn't handle this different and was throwing an exception when diffing changing features.

However, the impact of this bug should be small as normally one version has an ID which is its SHA256 hash and thus its features shouldn't change over repo updates. Imaginable is erratic repo creation software though.
2024-10-08 17:14:24 +00:00
Torsten Grote
1b63bc3898 Revert "let all gradle modules use compileSdk 35"
This reverts commit 957bea4655.
2024-10-08 10:28:34 -03:00
Torsten Grote
395393b51e [index] address new nullability info from SDK 35 2024-10-07 15:34:26 -03:00
Torsten Grote
957bea4655 let all gradle modules use compileSdk 35 2024-10-07 13:06:33 -03:00
Torsten Grote
9f637a602c [app] Don't crash on malformed fdroid.link Uri
Fixes acra-crash-reports#740
2024-09-13 08:35:33 +00:00
Tobias_Groza
f927e7c86d Add test for AppMetadataFTS table migration 2024-09-03 19:06:10 +02:00
Tobias_Groza
14ffc7023b Update tests to use new db schema and migrations 2024-09-03 19:06:10 +02:00
Tobias_Groza
1e7324ca3b Fix case insensitive search containing diacritics by changing FTS4 tokenizer
The default `simple` tokenzier config used in Room/SQLite3 FTS4 makes only ASCII characters case insensitive. The SQLite FTS3/4 doc [1] says:

> All uppercase characters within the ASCII range (Unicode codepoints less than 128), are transformed to their lowercase equivalents as part of the tokenization process. Thus, full-text queries are case-insensitive when using the simple tokenizer.

> The remove_diacritics option may be set to "0", "1" or "2". The default value is "1". If it is set to "1" or "2", then diacritics are removed from Latin script characters as described above. However, if it is set to "1", then diacritics are not removed in the fairly uncommon case where a single unicode codepoint is used to represent a character with more that one diacritic. [...] This is technically a bug, but cannot be fixed without creating backwards compatibility problems. If this option is set to "2", then diacritics are correctly removed from all Latin characters.

This change makes use of the intended behaviour by using the `unicode61` tokenizer with the `diacritics="0"` option to keep the behaviour similar to the current one. This replaces the previously used `simple` tokenizer. A migration is necessary to recreate the AppMetadataFts table to make use of the different tokenizer.

[1] https://www.sqlite.org/fts3.html#tokenizer
2024-09-03 19:06:10 +02:00
Torsten Grote
510a6c07f3 [db] return the repoId of the archive when adding/enabling it 2024-07-12 09:31:37 -03:00
Torsten Grote
fb041c4450 [db] Fix bug where disabled repos were considered for preferred repo calculation
If an update was available from a disabled repo with a higher priority, the update from an enabled repo with a lower priority would not be offered as an update (i.e. returned by DbUpdateChecker#getUpdatableApps()).
2024-07-09 16:02:37 +00:00
Ray c
190d06e109 Improve locales list ordering of less common languages 2024-06-14 14:27:22 +00:00
Thore Goebel
06fa581d3f Clarify FetchResult computation 2024-05-27 15:24:45 +02:00
Thore Goebel
a26d5fe727 Remove unused Repository.canAdd and Repository.isMirror functions 2024-05-27 15:24:45 +02:00
Thore Goebel
199f9b6c52 Rename Fetching.repo to Fetching.receivedRepo
To make it clear that this is the repo as we received it,
not the repo as we may have already stored it in the database.
2024-05-27 15:24:45 +02:00
Thore Goebel
d3ac70276d fix: Use existingRepoId instead of receivedRepoId to launch existing details 2024-05-27 15:24:45 +02:00
Thore Goebel
e963aeaece Make ktlint happy
For the record: I strongly find the trailing && and ||
less readable than the leading version.
But if that's what the Kotlin folks want 🤷.
2024-05-27 15:24:45 +02:00
Thore Goebel
f173b1b6dc Distinguish IsNewRepoAndNewMirror in UI 2024-05-27 15:24:45 +02:00
Thore Goebel
ee8dadf577 Explain what is being tested 2024-05-27 15:24:45 +02:00
Thore Goebel
ca2c97a8cf Distinguish IsExistingRepository from IsExistingMirror 2024-05-27 15:24:45 +02:00
Thore Goebel
bae2a06693 Refactor: Move fetchUrl up from FetchResult into Fetching
The fetchUrl is independent of the result, it better belongs into Fetching.
2024-05-27 15:24:45 +02:00
Torsten Grote
fa65084e60 [db] make repo certs non-null and remove repos without cert
historically, repos were added to the DB without much information and could stay in a broken state until manually removed. If a repo is updating, it should have a cert. So only repos that never did a single index update don't have a cert. Nowadays, this can not happen anymore as we get the repo and its cert before adding it to the DB. So whenever we update a repo, we know its certificate and fingerprint. Thus, this includes a DB migration removing all broken repos and making the certificate for repos in the DB non-null.
2024-05-22 09:58:05 +00:00
Torsten Grote
5cf22c5e06 [index] stop passing certificates around 2024-05-22 09:58:05 +00:00
Torsten Grote
ad6b1d6ad5 [index] remove some warnings on CompatibilityChecker 2024-05-22 09:57:17 +00:00
Torsten Grote
c639d7b445 [index] adapt minInstallableTargetSdk for Android 15 2024-05-22 09:57:17 +00:00
Hans-Christoph Steiner
e5f54ab712 documented the edge case and the 100% correct sort order 2024-05-08 10:20:29 +02:00
Torsten Grote
51eadcc1b2 [db] sort versions with same version code by native code (CPU arch) as well
Some repos (like SimpleX Chat) publish several versions with the same version code only different in native code. Previously, the sorting of those versions was non-deterministic, now we at least make them deterministic by sorting by native code as well in lexicographic ascending order, so arm64 is shown before armeabi-v7a.
2024-05-08 08:02:37 +00:00
Torsten Grote
4c366403fa [db] Maintain legacy repo priority ordering when migrating 2024-04-30 10:54:55 -03:00
Torsten Grote
4a4d9f808c [download] disable tests using howsmyssl.com on Android 7 and older
because of letsencrypt not working anymore on those devices
2024-04-25 17:30:19 -03:00
Torsten Grote
ef4e72e6d4 [db] handle broken repos without certificate
On versions before 1.18.0, adding a repo would add it as "empty" to the DB without a certificate right away and if there was an issue with it (e.g. typo in URL), it would stay in the DB until manually removed.
Our migration code did not consider such repos.
2024-04-05 21:32:16 +00:00
Hans-Christoph Steiner
69f44d47bd run checkSessionResumeShort only on Build.VERSION.SDK_INT >= 26
Let's Encrypt no longer works on Android older than SDK 26 #2102

https://letsencrypt.org/2020/11/06/own-two-feet.html
2024-04-05 12:39:38 +02:00
Torsten Grote
268560bf45 Don't fail session resumption test if session doesn't get resumed 2024-03-12 19:40:45 +01:00
Torsten Grote
f6caceb63c [index] treat empty string like null when deserializing FileV2 objects
we've seen serialized FileV2 objects becoming an empty string after parcelizing them,
so we need to account for null *and* empty string here.

Fixes acra-crash-reports#617
2024-03-12 15:12:19 +00:00
Torsten Grote
6ffb3fe7e3 Update dependencies 2024-03-05 14:43:28 +00:00
Torsten Grote
f8d70b2c54 no more namespaces in manifests 2024-03-05 14:43:28 +00:00
Torsten Grote
52e5509878 Fix lint errors after compileSdk upgrade to 34 2024-03-05 14:43:28 +00:00
Torsten Grote
35affc09db Upgrade to Gradle 8 and SDK 34
This commit tries to limit the changes required to what is needed to make the project compile again. This includes the Kotlin and Room update.
2024-03-05 14:43:28 +00:00
Torsten Grote
3c2ebe6f49 Don't crash on non-hierarchical URIs in RepoUriGetter 2024-02-27 10:39:24 -03:00
Torsten Grote
47a921e45a [download] test that session gets only resumed for a short time (10s)
see https://svs.informatik.uni-hamburg.de/publications/2018/2018-12-06-Sy-ACSAC-Tracking_Users_across_the_Web_via_TLS_Session_Resumption.pdf
2024-02-20 15:30:26 +00:00
Torsten Grote
dec7c4d260 [db] return error when trying to add archive repo 2024-02-20 09:42:42 -03:00
Torsten Grote
e47ef72f75 [db] add archive repo adding to RepoAdder 2024-02-20 09:42:41 -03:00
Torsten Grote
0b292f3383 [db] Add convenience method for setting preferred repo via RepoManager 2024-02-20 09:42:40 -03:00
Torsten Grote
108105596d [db] allow re-ordering repo list and thus priorities 2024-02-20 09:42:40 -03:00
Torsten Grote
51a4bcec58 [db] don't allow initial repos from fixtures to provide weight
The client was already auto-incrementing their weight anyway. But it leaked our internal weight handling into the library consumer which can cause issues like when me are making changes to how we handles repo weights as we are doing now.
2024-02-20 09:42:40 -03:00
Torsten Grote
b993da8db8 [db] New repos now get lower weight than older ones
so they do not override the information from older repos anymore. This is especially an issue for the official repo which historically had the lowest priority while it should have the highest.
2024-02-20 09:42:39 -03:00
Torsten Grote
d9ea1e154b [db] Migrate repo weights and test migration 2024-02-20 09:42:39 -03:00
Torsten Grote
4a01b02fa6 [db] Add DB query for getting repos an app is in 2024-02-20 09:42:39 -03:00
Torsten Grote
b28d2ecd5b [app] Only request updates and suggested versions from preferred repositories
Before, we would install compatible updates from any repository
2024-02-20 09:42:39 -03:00