Spaces:
Paused
Paused
Julian Bilcke
commited on
Commit
·
e5ec20b
1
Parent(s):
bfca303
debugging
Browse files
build/web/flutter_bootstrap.js
CHANGED
|
@@ -39,6 +39,6 @@ _flutter.buildConfig = {"engineRevision":"382be0028d370607f76215a9be322e5514b263
|
|
| 39 |
|
| 40 |
_flutter.loader.load({
|
| 41 |
serviceWorkerSettings: {
|
| 42 |
-
serviceWorkerVersion: "
|
| 43 |
}
|
| 44 |
});
|
|
|
|
| 39 |
|
| 40 |
_flutter.loader.load({
|
| 41 |
serviceWorkerSettings: {
|
| 42 |
+
serviceWorkerVersion: "2193392314"
|
| 43 |
}
|
| 44 |
});
|
build/web/flutter_service_worker.js
CHANGED
|
@@ -3,11 +3,11 @@ const MANIFEST = 'flutter-app-manifest';
|
|
| 3 |
const TEMP = 'flutter-temp-cache';
|
| 4 |
const CACHE_NAME = 'flutter-app-cache';
|
| 5 |
|
| 6 |
-
const RESOURCES = {"flutter_bootstrap.js": "
|
| 7 |
"version.json": "b5eaae4fc120710a3c35125322173615",
|
| 8 |
"index.html": "f34c56fffc6b38f62412a5db2315dec8",
|
| 9 |
"/": "f34c56fffc6b38f62412a5db2315dec8",
|
| 10 |
-
"main.dart.js": "
|
| 11 |
"flutter.js": "83d881c1dbb6d6bcd6b42e274605b69c",
|
| 12 |
"favicon.png": "5dcef449791fa27946b3d35ad8803796",
|
| 13 |
"icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1",
|
|
|
|
| 3 |
const TEMP = 'flutter-temp-cache';
|
| 4 |
const CACHE_NAME = 'flutter-app-cache';
|
| 5 |
|
| 6 |
+
const RESOURCES = {"flutter_bootstrap.js": "f915e2d221c0db2d3ffba348852bcac5",
|
| 7 |
"version.json": "b5eaae4fc120710a3c35125322173615",
|
| 8 |
"index.html": "f34c56fffc6b38f62412a5db2315dec8",
|
| 9 |
"/": "f34c56fffc6b38f62412a5db2315dec8",
|
| 10 |
+
"main.dart.js": "fc451217f225adcf35d6421bcaf1a36e",
|
| 11 |
"flutter.js": "83d881c1dbb6d6bcd6b42e274605b69c",
|
| 12 |
"favicon.png": "5dcef449791fa27946b3d35ad8803796",
|
| 13 |
"icons/Icon-192.png": "ac9a721a12bbc803b44f645561ecb1e1",
|
build/web/main.dart.js
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|
lib/services/websocket_api_service.dart
CHANGED
|
@@ -1,5 +1,7 @@
|
|
| 1 |
import 'dart:async';
|
| 2 |
-
import 'dart:io';
|
|
|
|
|
|
|
| 3 |
import 'package:aitube2/services/settings_service.dart';
|
| 4 |
import 'package:synchronized/synchronized.dart';
|
| 5 |
import 'dart:convert';
|
|
@@ -8,6 +10,7 @@ import 'package:aitube2/models/chat_message.dart';
|
|
| 8 |
import 'package:flutter/foundation.dart';
|
| 9 |
import 'package:uuid/uuid.dart';
|
| 10 |
import 'package:web_socket_channel/web_socket_channel.dart';
|
|
|
|
| 11 |
import '../models/search_state.dart';
|
| 12 |
import '../models/video_result.dart';
|
| 13 |
|
|
@@ -159,19 +162,37 @@ class WebSocketApiService {
|
|
| 159 |
|
| 160 |
// First check if server is in maintenance mode by making an HTTP request to the status endpoint
|
| 161 |
try {
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
|
| 171 |
-
if (
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 175 |
}
|
| 176 |
}
|
| 177 |
} catch (e) {
|
|
|
|
| 1 |
import 'dart:async';
|
| 2 |
+
import 'dart:io' as io;
|
| 3 |
+
// For web platform, conditionally import http instead of HttpClient
|
| 4 |
+
import 'package:http/http.dart' as http;
|
| 5 |
import 'package:aitube2/services/settings_service.dart';
|
| 6 |
import 'package:synchronized/synchronized.dart';
|
| 7 |
import 'dart:convert';
|
|
|
|
| 10 |
import 'package:flutter/foundation.dart';
|
| 11 |
import 'package:uuid/uuid.dart';
|
| 12 |
import 'package:web_socket_channel/web_socket_channel.dart';
|
| 13 |
+
import 'package:http/http.dart' as http;
|
| 14 |
import '../models/search_state.dart';
|
| 15 |
import '../models/video_result.dart';
|
| 16 |
|
|
|
|
| 162 |
|
| 163 |
// First check if server is in maintenance mode by making an HTTP request to the status endpoint
|
| 164 |
try {
|
| 165 |
+
// Use conditional import to handle platform differences
|
| 166 |
+
if (kIsWeb) {
|
| 167 |
+
// For web platform, use http package instead of HttpClient which is only available in dart:io
|
| 168 |
+
final httpUrl = 'http://${baseUrl.authority}/api/status';
|
| 169 |
+
final response = await http.get(Uri.parse(httpUrl));
|
| 170 |
+
|
| 171 |
+
if (response.statusCode == 200) {
|
| 172 |
+
final statusData = jsonDecode(response.body);
|
| 173 |
+
|
| 174 |
+
if (statusData['maintenance_mode'] == true) {
|
| 175 |
+
debugPrint('WebSocketApiService: Server is in maintenance mode');
|
| 176 |
+
_setStatus(ConnectionStatus.maintenance);
|
| 177 |
+
return;
|
| 178 |
+
}
|
| 179 |
+
}
|
| 180 |
+
} else {
|
| 181 |
+
// For non-web platforms, use HttpClient from dart:io
|
| 182 |
+
final httpUrl = 'http://${baseUrl.authority}/api/status';
|
| 183 |
+
final httpClient = io.HttpClient();
|
| 184 |
+
final request = await httpClient.getUrl(Uri.parse(httpUrl));
|
| 185 |
+
final response = await request.close();
|
| 186 |
|
| 187 |
+
if (response.statusCode == 200) {
|
| 188 |
+
final responseBody = await response.transform(utf8.decoder).join();
|
| 189 |
+
final statusData = jsonDecode(responseBody);
|
| 190 |
+
|
| 191 |
+
if (statusData['maintenance_mode'] == true) {
|
| 192 |
+
debugPrint('WebSocketApiService: Server is in maintenance mode');
|
| 193 |
+
_setStatus(ConnectionStatus.maintenance);
|
| 194 |
+
return;
|
| 195 |
+
}
|
| 196 |
}
|
| 197 |
}
|
| 198 |
} catch (e) {
|