feature flag

This commit is contained in:
mertalev
2026-05-08 15:20:16 -04:00
parent ed7e3c8933
commit 9341037b0a
6 changed files with 21 additions and 2 deletions
+10 -1
View File
@@ -23,6 +23,7 @@ class ServerFeaturesDto {
required this.oauthAutoLaunch, required this.oauthAutoLaunch,
required this.ocr, required this.ocr,
required this.passwordLogin, required this.passwordLogin,
required this.realtimeTranscoding,
required this.reverseGeocoding, required this.reverseGeocoding,
required this.search, required this.search,
required this.sidecar, required this.sidecar,
@@ -60,6 +61,9 @@ class ServerFeaturesDto {
/// Whether password login is enabled /// Whether password login is enabled
bool passwordLogin; bool passwordLogin;
/// Whether real-time transcoding is enabled
bool realtimeTranscoding;
/// Whether reverse geocoding is enabled /// Whether reverse geocoding is enabled
bool reverseGeocoding; bool reverseGeocoding;
@@ -87,6 +91,7 @@ class ServerFeaturesDto {
other.oauthAutoLaunch == oauthAutoLaunch && other.oauthAutoLaunch == oauthAutoLaunch &&
other.ocr == ocr && other.ocr == ocr &&
other.passwordLogin == passwordLogin && other.passwordLogin == passwordLogin &&
other.realtimeTranscoding == realtimeTranscoding &&
other.reverseGeocoding == reverseGeocoding && other.reverseGeocoding == reverseGeocoding &&
other.search == search && other.search == search &&
other.sidecar == sidecar && other.sidecar == sidecar &&
@@ -106,6 +111,7 @@ class ServerFeaturesDto {
(oauthAutoLaunch.hashCode) + (oauthAutoLaunch.hashCode) +
(ocr.hashCode) + (ocr.hashCode) +
(passwordLogin.hashCode) + (passwordLogin.hashCode) +
(realtimeTranscoding.hashCode) +
(reverseGeocoding.hashCode) + (reverseGeocoding.hashCode) +
(search.hashCode) + (search.hashCode) +
(sidecar.hashCode) + (sidecar.hashCode) +
@@ -113,7 +119,7 @@ class ServerFeaturesDto {
(trash.hashCode); (trash.hashCode);
@override @override
String toString() => 'ServerFeaturesDto[configFile=$configFile, duplicateDetection=$duplicateDetection, email=$email, facialRecognition=$facialRecognition, importFaces=$importFaces, map=$map, oauth=$oauth, oauthAutoLaunch=$oauthAutoLaunch, ocr=$ocr, passwordLogin=$passwordLogin, reverseGeocoding=$reverseGeocoding, search=$search, sidecar=$sidecar, smartSearch=$smartSearch, trash=$trash]'; String toString() => 'ServerFeaturesDto[configFile=$configFile, duplicateDetection=$duplicateDetection, email=$email, facialRecognition=$facialRecognition, importFaces=$importFaces, map=$map, oauth=$oauth, oauthAutoLaunch=$oauthAutoLaunch, ocr=$ocr, passwordLogin=$passwordLogin, realtimeTranscoding=$realtimeTranscoding, reverseGeocoding=$reverseGeocoding, search=$search, sidecar=$sidecar, smartSearch=$smartSearch, trash=$trash]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@@ -127,6 +133,7 @@ class ServerFeaturesDto {
json[r'oauthAutoLaunch'] = this.oauthAutoLaunch; json[r'oauthAutoLaunch'] = this.oauthAutoLaunch;
json[r'ocr'] = this.ocr; json[r'ocr'] = this.ocr;
json[r'passwordLogin'] = this.passwordLogin; json[r'passwordLogin'] = this.passwordLogin;
json[r'realtimeTranscoding'] = this.realtimeTranscoding;
json[r'reverseGeocoding'] = this.reverseGeocoding; json[r'reverseGeocoding'] = this.reverseGeocoding;
json[r'search'] = this.search; json[r'search'] = this.search;
json[r'sidecar'] = this.sidecar; json[r'sidecar'] = this.sidecar;
@@ -154,6 +161,7 @@ class ServerFeaturesDto {
oauthAutoLaunch: mapValueOfType<bool>(json, r'oauthAutoLaunch')!, oauthAutoLaunch: mapValueOfType<bool>(json, r'oauthAutoLaunch')!,
ocr: mapValueOfType<bool>(json, r'ocr')!, ocr: mapValueOfType<bool>(json, r'ocr')!,
passwordLogin: mapValueOfType<bool>(json, r'passwordLogin')!, passwordLogin: mapValueOfType<bool>(json, r'passwordLogin')!,
realtimeTranscoding: mapValueOfType<bool>(json, r'realtimeTranscoding')!,
reverseGeocoding: mapValueOfType<bool>(json, r'reverseGeocoding')!, reverseGeocoding: mapValueOfType<bool>(json, r'reverseGeocoding')!,
search: mapValueOfType<bool>(json, r'search')!, search: mapValueOfType<bool>(json, r'search')!,
sidecar: mapValueOfType<bool>(json, r'sidecar')!, sidecar: mapValueOfType<bool>(json, r'sidecar')!,
@@ -216,6 +224,7 @@ class ServerFeaturesDto {
'oauthAutoLaunch', 'oauthAutoLaunch',
'ocr', 'ocr',
'passwordLogin', 'passwordLogin',
'realtimeTranscoding',
'reverseGeocoding', 'reverseGeocoding',
'search', 'search',
'sidecar', 'sidecar',
+5
View File
@@ -21567,6 +21567,10 @@
"description": "Whether password login is enabled", "description": "Whether password login is enabled",
"type": "boolean" "type": "boolean"
}, },
"realtimeTranscoding": {
"description": "Whether real-time transcoding is enabled",
"type": "boolean"
},
"reverseGeocoding": { "reverseGeocoding": {
"description": "Whether reverse geocoding is enabled", "description": "Whether reverse geocoding is enabled",
"type": "boolean" "type": "boolean"
@@ -21599,6 +21603,7 @@
"oauthAutoLaunch", "oauthAutoLaunch",
"ocr", "ocr",
"passwordLogin", "passwordLogin",
"realtimeTranscoding",
"reverseGeocoding", "reverseGeocoding",
"search", "search",
"sidecar", "sidecar",
@@ -2049,6 +2049,8 @@ export type ServerFeaturesDto = {
ocr: boolean; ocr: boolean;
/** Whether password login is enabled */ /** Whether password login is enabled */
passwordLogin: boolean; passwordLogin: boolean;
/** Whether real-time transcoding is enabled */
realtimeTranscoding: boolean;
/** Whether reverse geocoding is enabled */ /** Whether reverse geocoding is enabled */
reverseGeocoding: boolean; reverseGeocoding: boolean;
/** Whether search is enabled */ /** Whether search is enabled */
+1
View File
@@ -137,6 +137,7 @@ const ServerFeaturesSchema = z
search: z.boolean().describe('Whether search is enabled'), search: z.boolean().describe('Whether search is enabled'),
email: z.boolean().describe('Whether email notifications are enabled'), email: z.boolean().describe('Whether email notifications are enabled'),
ocr: z.boolean().describe('Whether OCR is enabled'), ocr: z.boolean().describe('Whether OCR is enabled'),
realtimeTranscoding: z.boolean().describe('Whether real-time transcoding is enabled'),
}) })
.meta({ id: 'ServerFeaturesDto' }); .meta({ id: 'ServerFeaturesDto' });
@@ -148,6 +148,7 @@ describe(ServerService.name, () => {
configFile: false, configFile: false,
trash: true, trash: true,
email: false, email: false,
realtimeTranscoding: false,
}); });
expect(mocks.systemMetadata.get).toHaveBeenCalled(); expect(mocks.systemMetadata.get).toHaveBeenCalled();
}); });
+2 -1
View File
@@ -86,7 +86,7 @@ export class ServerService extends BaseService {
} }
async getFeatures(): Promise<ServerFeaturesDto> { async getFeatures(): Promise<ServerFeaturesDto> {
const { reverseGeocoding, metadata, map, machineLearning, trash, oauth, passwordLogin, notifications } = const { reverseGeocoding, metadata, map, machineLearning, trash, oauth, passwordLogin, notifications, ffmpeg } =
await this.getConfig({ withCache: false }); await this.getConfig({ withCache: false });
const { configFile } = this.configRepository.getEnv(); const { configFile } = this.configRepository.getEnv();
@@ -106,6 +106,7 @@ export class ServerService extends BaseService {
passwordLogin: passwordLogin.enabled, passwordLogin: passwordLogin.enabled,
configFile: !!configFile, configFile: !!configFile,
email: notifications.smtp.enabled, email: notifications.smtp.enabled,
realtimeTranscoding: ffmpeg.realtime.enabled,
}; };
} }