Commit Graph

34 Commits

Author SHA1 Message Date
Lonami Exo
44e3651adf Revert "Add workaround for SQLiteSession needing save after init"
This reverts commit 8190a92aae.
2022-08-30 12:20:20 +02:00
Lonami Exo
0f5eeb29e7 Add missing async keywords in SQLiteSession 2022-05-30 13:39:08 +02:00
Lonami Exo
8190a92aae Add workaround for SQLiteSession needing save after init 2022-05-30 12:59:04 +02:00
Lonami Exo
09b9cd8193 Fix initial session state load 2022-05-16 19:01:05 +02:00
Lonami Exo
0dff21a80f Add missing async in sqlite 2022-05-16 09:36:41 +02:00
Lonami Exo
a5c3df2743 Attempt to load and save MessageBox state 2022-05-13 17:40:03 +02:00
Lonami Exo
f913ea6b75 Mark certain SQLiteSession methods as async
Follow-up to d2de0f3aca.
2022-05-12 11:08:18 +02:00
Lonami Exo
67b87a0ea0 Evict old cached usernames in case of collision 2020-10-01 13:20:29 +02:00
Lonami Exo
9c06f29aaf Don't cache entities with min flag set, bump v1.10.2
Since layer 102, there are two access_hash. One with the min flag,
and one without it. This was causing channel invalid errors.

access_hash with min flag set can only be used to fetch files such
as profile pictures.

access_hash with min flag unset can be used under all circumstances.

Previously, the library did not distinguish between these, so it was
caching the hash that could hardly be used for anything.

With this change, only the "full" access_hash is stored, which will
work for any methods.

See also: https://core.telegram.org/api/min
2019-09-12 19:19:46 +02:00
Lonami
52be689926
Only upgrade database if version < current
Should deal more gracefully when using new
session files in older versions of the library.
2019-05-02 23:20:39 +02:00
Lonami Exo
70b08c4952 Get rid of broken JSON migration support (#1113) 2019-02-24 20:16:53 +01:00
Lonami Exo
47d9de98ed Raise ImportError and not ValueError when sqlite3 is missing
Excepting ValueError when creating the SQLiteSession could hide
other errors (e.g. using a newer session file on an older version
of the library). Instead, the original error is raised, as if
sqlite3 was being imported within its __init__ method.
2019-02-13 08:52:54 +01:00
Dmitry D. Chernov
9a98d41a2c Improve TakeoutClient proxy and takeout functionality (#1106) 2019-02-10 11:10:41 +01:00
Lonami Exo
3c92f6a791 Fix sqlite's conn may be None if never used
This happened when signing up with the library
and getting migrate errors.
2018-09-04 11:28:01 +02:00
Lonami Exo
7a7923b317 Fallback to MemorySession if sqlite3 is not available 2018-08-02 15:17:44 +02:00
Lonami Exo
dc3d281274 Load update state date with explicit timezone (#808) 2018-07-14 00:01:45 +02:00
Lonami Exo
dd0eb7a90e Explicitly open files as 'r' instead of leaving it out 2018-06-29 11:34:57 +02:00
Lonami Exo
551b0044ce Reuse more code using sqlite's cursor 2018-06-25 20:11:48 +02:00
Lonami Exo
313bead615 Close sqlite's cursor after usage 2018-06-25 19:49:33 +02:00
Lonami Exo
d4479a0a4e Save the session file less often 2018-06-24 12:21:58 +02:00
Lonami Exo
1247d050ab Remove unused fields from the Sessions
Most of the stuff didn't actually need to be saved and only
belong to the MTProtoState which is not a separate class from
the sessions.
2018-06-14 17:04:15 +02:00
Lonami Exo
208adc93a6 Stop using without rowid altogether
While something nice to have if supported, it just causes problems
for people trying to use the same session accross systems having
different sqlite versions. See https://t.me/TelethonChat/36771.
2018-05-14 17:41:47 +02:00
Lonami Exo
b71511cd63 Fix saving update state in the SqliteSession 2018-04-27 21:11:13 +02:00
Lonami Exo
2a00bcaa12 Persist updates.State upon disconnection 2018-04-25 13:37:29 +02:00
Lonami Exo
ea404c5477 Add update_state table to persist pts and such 2018-04-23 21:16:09 +02:00
Yifei Kong
03bebfb600 Fix tiny docstring typo (#771) 2018-04-17 13:01:23 +02:00
Lonami Exo
ce0dee63b1 Support getting any entity by just their positive ID 2018-03-08 10:05:40 +01:00
Lonami Exo
0e0e7f1c9e Avoid unnecessary "or 0" in the session classes 2018-03-03 14:59:30 +01:00
Lonami Exo
6060b3430c Fix sqlite session clone causing integrity error
Triggered on migrations, the dc id would be None.
2018-03-03 14:02:48 +01:00
Lonami Exo
a9c83250a1 Small clean-up of the session classes 2018-03-03 12:51:35 +01:00
Tulir Asokan
dc2229fdba Move salt and ID to base session and remove unused imports 2018-03-02 18:39:04 +02:00
Tulir Asokan
118d9b10e8 Add more abstraction 2018-03-02 13:20:11 +02:00
Tulir Asokan
d9a73744a4 Remove old sqlite session variables and clone code 2018-03-02 12:36:39 +02:00
Tulir Asokan
c5e6f7e265 Split Session into three parts and make a module for sessions 2018-03-01 23:40:28 +02:00