mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-11-15 20:27:24 +01:00
Merge branch 'master' into soru/emoji-verification
This commit is contained in:
commit
a28e731bc3
@ -27,9 +27,10 @@ build_web:
|
|||||||
- sudo apt update
|
- sudo apt update
|
||||||
- sudo apt install curl -y
|
- sudo apt install curl -y
|
||||||
- rm -r assets/js/package
|
- rm -r assets/js/package
|
||||||
- cd assets/js/ && curl -O 'https://janian.de/index.php/s/ZKpQi4xFkGWPMHQ/download' && cd ../../
|
- cd assets/js/ && curl -L 'https://gitlab.com/famedly/libraries/olm/-/jobs/artifacts/master/download?job=build_js' > olm.zip && cd ../../
|
||||||
- cd assets/js/ && mv download olm.tar.gz && cd ../../
|
- cd assets/js/ && unzip olm.zip && cd ../../
|
||||||
- cd assets/js/ && tar xaf olm.tar.gz && cd ../../
|
- cd assets/js/ && rm olm.zip && cd ../../
|
||||||
|
- cd assets/js/ && mv javascript package && cd ../../
|
||||||
- flutter pub get
|
- flutter pub get
|
||||||
- flutter clean
|
- flutter clean
|
||||||
- flutter build web --release --verbose --dart-define=FLUTTER_WEB_USE_SKIA=true
|
- flutter build web --release --verbose --dart-define=FLUTTER_WEB_USE_SKIA=true
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
// Dummy file
|
// Dummy file :-)
|
||||||
|
|||||||
@ -76,7 +76,7 @@ class MatrixState extends State<Matrix> {
|
|||||||
|
|
||||||
void _initWithStore() async {
|
void _initWithStore() async {
|
||||||
var initLoginState = client.onLoginStateChanged.stream.first;
|
var initLoginState = client.onLoginStateChanged.stream.first;
|
||||||
client.database = await getDatabase(client, store);
|
client.database = await getDatabase(client);
|
||||||
client.connect();
|
client.connect();
|
||||||
if (await initLoginState == LoginState.logged && !kIsWeb) {
|
if (await initLoginState == LoginState.logged && !kIsWeb) {
|
||||||
await FirebaseController.setupFirebase(
|
await FirebaseController.setupFirebase(
|
||||||
|
|||||||
@ -11,25 +11,29 @@ import './database/shared.dart';
|
|||||||
import 'package:olm/olm.dart' as olm; // needed for migration
|
import 'package:olm/olm.dart' as olm; // needed for migration
|
||||||
import 'package:random_string/random_string.dart';
|
import 'package:random_string/random_string.dart';
|
||||||
|
|
||||||
Future<Database> getDatabase(Client client, Store store) async {
|
Future<Database> getDatabase(Client client) async {
|
||||||
|
if (_db != null) return _db;
|
||||||
|
final store = Store();
|
||||||
var password = await store.getItem('database-password');
|
var password = await store.getItem('database-password');
|
||||||
var needMigration = false;
|
var needMigration = false;
|
||||||
if (password == null || password.isEmpty) {
|
if (password == null || password.isEmpty) {
|
||||||
needMigration = true;
|
needMigration = true;
|
||||||
password = randomString(255);
|
password = randomString(255);
|
||||||
}
|
}
|
||||||
final db = constructDb(
|
_db = constructDb(
|
||||||
logStatements: false,
|
logStatements: false,
|
||||||
filename: 'moor.sqlite',
|
filename: 'moor.sqlite',
|
||||||
password: password,
|
password: password,
|
||||||
);
|
);
|
||||||
if (needMigration) {
|
if (needMigration) {
|
||||||
await migrate(client.clientName, db, store);
|
await migrate(client.clientName, _db, store);
|
||||||
await store.setItem('database-password', password);
|
await store.setItem('database-password', password);
|
||||||
}
|
}
|
||||||
return db;
|
return _db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Database _db;
|
||||||
|
|
||||||
Future<void> migrate(String clientName, Database db, Store store) async {
|
Future<void> migrate(String clientName, Database db, Store store) async {
|
||||||
debugPrint('[Store] attempting old migration to moor...');
|
debugPrint('[Store] attempting old migration to moor...');
|
||||||
final oldKeys = await store.getAllItems();
|
final oldKeys = await store.getAllItems();
|
||||||
@ -147,7 +151,13 @@ Future<void> migrate(String clientName, Database db, Store store) async {
|
|||||||
devices = List<String>.from(json.decode(devicesString));
|
devices = List<String>.from(json.decode(devicesString));
|
||||||
}
|
}
|
||||||
await db.storeOutboundGroupSession(
|
await db.storeOutboundGroupSession(
|
||||||
clientId, roomId, pickle, json.encode(devices));
|
clientId,
|
||||||
|
roomId,
|
||||||
|
pickle,
|
||||||
|
json.encode(devices),
|
||||||
|
DateTime.now(),
|
||||||
|
0,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
// session_keys
|
// session_keys
|
||||||
final sessionKeysMatch =
|
final sessionKeysMatch =
|
||||||
|
|||||||
@ -151,8 +151,7 @@ abstract class FirebaseController {
|
|||||||
final platform = kIsWeb ? 'Web' : Platform.operatingSystem;
|
final platform = kIsWeb ? 'Web' : Platform.operatingSystem;
|
||||||
final clientName = 'FluffyChat $platform';
|
final clientName = 'FluffyChat $platform';
|
||||||
client = Client(clientName, debug: false);
|
client = Client(clientName, debug: false);
|
||||||
final store = Store();
|
client.database = await getDatabase(client);
|
||||||
client.database = await getDatabase(client, store);
|
|
||||||
client.connect();
|
client.connect();
|
||||||
await client.onLoginStateChanged.stream
|
await client.onLoginStateChanged.stream
|
||||||
.firstWhere((l) => l == LoginState.logged)
|
.firstWhere((l) => l == LoginState.logged)
|
||||||
|
|||||||
@ -133,8 +133,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: "2b8f4b0d19df91caf002052ce793bd1a28630cc3"
|
ref: "359e03496ad72f125ae275788621ac4f42d99d01"
|
||||||
resolved-ref: "2b8f4b0d19df91caf002052ce793bd1a28630cc3"
|
resolved-ref: "359e03496ad72f125ae275788621ac4f42d99d01"
|
||||||
url: "https://gitlab.com/famedly/famedlysdk.git"
|
url: "https://gitlab.com/famedly/famedlysdk.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
@ -581,7 +581,7 @@ packages:
|
|||||||
name: pub_semver
|
name: pub_semver
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.4"
|
version: "1.4.2"
|
||||||
quiver:
|
quiver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@ -27,7 +27,7 @@ dependencies:
|
|||||||
famedlysdk:
|
famedlysdk:
|
||||||
git:
|
git:
|
||||||
url: https://gitlab.com/famedly/famedlysdk.git
|
url: https://gitlab.com/famedly/famedlysdk.git
|
||||||
ref: 2b8f4b0d19df91caf002052ce793bd1a28630cc3
|
ref: 359e03496ad72f125ae275788621ac4f42d99d01
|
||||||
|
|
||||||
localstorage: ^3.0.1+4
|
localstorage: ^3.0.1+4
|
||||||
bubble: ^1.1.9+1
|
bubble: ^1.1.9+1
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user