22using System . Globalization ;
33using JL . Core . Frontend ;
44using JL . Core . Statistics ;
5+ using JL . Core . Utilities ;
56using JL . Core . Utilities . Database ;
67using Microsoft . Data . Sqlite ;
78
@@ -31,6 +32,7 @@ UPDATE setting
3132 """ ;
3233
3334 private const string InsertedNewProfilesOnceV4SettingName = "InsertedNewProfilesOnceV4" ;
35+ private const string ChangedDefaultValueOfTsukikageOnceV4SettingName = "ChangedDefaultValueOfTsukikageOnceV4" ;
3436
3537 private static readonly string s_configsPath = Path . Join ( AppInfo . ConfigPath , "Configs.sqlite" ) ;
3638
@@ -117,6 +119,7 @@ FOREIGN KEY (profile_id) REFERENCES profile (id) ON DELETE CASCADE
117119 InsertTsukikageProfile ( connection ) ;
118120
119121 InsertSetting ( connection , InsertedNewProfilesOnceV4SettingName , bool . TrueString , ProfileUtils . GlobalProfileId ) ;
122+ InsertSetting ( connection , ChangedDefaultValueOfTsukikageOnceV4SettingName , bool . TrueString , ProfileUtils . GlobalProfileId ) ;
120123 }
121124 else
122125 {
@@ -131,10 +134,23 @@ FOREIGN KEY (profile_id) REFERENCES profile (id) ON DELETE CASCADE
131134 if ( ! ProfileDBUtils . ProfileExists ( connection , ProfileUtils . TsukikageProfileName ) )
132135 {
133136 InsertTsukikageProfile ( connection ) ;
137+ InsertSetting ( connection , ChangedDefaultValueOfTsukikageOnceV4SettingName , bool . TrueString , ProfileUtils . GlobalProfileId ) ;
134138 }
135139
136140 InsertSetting ( connection , InsertedNewProfilesOnceV4SettingName , bool . TrueString , ProfileUtils . GlobalProfileId ) ;
137141 }
142+
143+ bool changedDefaultValueOfTsukikageOnceV4 = GetValueFromConfigWithoutUpsert ( connection , false , ChangedDefaultValueOfTsukikageOnceV4SettingName , ProfileUtils . GlobalProfileId ) ;
144+ if ( ! changedDefaultValueOfTsukikageOnceV4 )
145+ {
146+ ReadOnlySpan < int > profileIds = ProfileDBUtils . GetProfileIds ( connection ) . AsReadOnlySpan ( ) ;
147+ foreach ( int profileId in profileIds )
148+ {
149+ UpdateSetting ( connection , nameof ( CoreConfigManager . TsukikageWebSocketUri ) , CoreConfigManager . Instance . TsukikageWebSocketUri . OriginalString , profileId ) ;
150+ }
151+
152+ InsertSetting ( connection , ChangedDefaultValueOfTsukikageOnceV4SettingName , bool . TrueString , ProfileUtils . GlobalProfileId ) ;
153+ }
138154 }
139155 }
140156
0 commit comments