11import { FileCache } from './cache'
22import { ModInstallDialogs } from './gui/install-dialogs'
3+ import { modDatabasesToInputFields , repoChangeEvent , repoIsValid } from './repo-add'
34import { Lang } from './lang-manager'
45import { LocalMods } from './local-mods'
56import { InstallQueue } from './mod-installer'
@@ -21,33 +22,6 @@ export function registerOpts() {
2122 type : 'CHECKBOX' ,
2223 init : true ,
2324 } ,
24- repositoriesButton : {
25- type : 'BUTTON' ,
26- onPress ( ) {
27- modmanager . gui . menu . openRepositoriesPopup ( )
28- } ,
29- } ,
30- resetRepositoriesButton : {
31- type : 'BUTTON' ,
32- onPress ( ) {
33- Opts . repositories = Opts . flatOpts . repositories . init
34- sc . Dialogs . showInfoDialog ( Lang . opts . resetRepositoriesButton . onclickPopup )
35- } ,
36- } ,
37-
38- repositories : {
39- type : 'JSON_DATA' ,
40- init : [ '@CCDirectLink/CCModDB/stable' , '@CCDirectLink/CCModDB/testing' ] as string [ ] ,
41- changeEvent ( ) {
42- if ( ! ig . game ) return
43-
44- ModDB . loadDatabases ( true )
45-
46- ModDB . loadAllMods ( false ) . then ( ( ) => {
47- LocalMods . refreshOrigin ( )
48- } )
49- } ,
50- } ,
5125 testingOptInMods : {
5226 type : 'JSON_DATA' ,
5327 init : [ ] as string [ ] ,
@@ -127,6 +101,52 @@ export function registerOpts() {
127101 } ,
128102 } ,
129103 } ,
104+ repositories : {
105+ settings : {
106+ tabIcon : 'interface' ,
107+ title : 'Repositories' ,
108+ } ,
109+ headers : {
110+ repositories : {
111+ resetRepositoriesButton : {
112+ type : 'BUTTON' ,
113+ onPress ( ) {
114+ Opts . repositories = Opts . flatOpts . repositories . init
115+ modDatabasesToInputFields ( )
116+
117+ if ( sc . menu ?. currentMenu == sc . MENU_SUBMENU ?. MOD_OPTIONS ) {
118+ modmanager . gui . optionsMenu . reopenMenu ( )
119+ }
120+ sc . Dialogs . showInfoDialog ( Lang . opts . resetRepositoriesButton . onclickPopup )
121+ } ,
122+ } ,
123+
124+ repositories : {
125+ type : 'JSON_DATA' ,
126+ init : [ '@CCDirectLink/CCModDB/stable' , '@CCDirectLink/CCModDB/testing' ] as string [ ] ,
127+ changeEvent ( ) {
128+ if ( ! ig . game ) return
129+
130+ ModDB . loadDatabases ( true )
131+
132+ ModDB . loadAllMods ( false ) . then ( ( ) => {
133+ LocalMods . refreshOrigin ( )
134+ } )
135+ } ,
136+ } ,
137+ // prettier-ignore
138+ ...{
139+ inputFieldRepo0 : { type : 'INPUT_FIELD' , init : '' , changeEvent : repoChangeEvent , isValid : repoIsValid } ,
140+ inputFieldRepo1 : { type : 'INPUT_FIELD' , init : '' , changeEvent : repoChangeEvent , isValid : repoIsValid } ,
141+ inputFieldRepo2 : { type : 'INPUT_FIELD' , init : '' , changeEvent : repoChangeEvent , isValid : repoIsValid } ,
142+ inputFieldRepo3 : { type : 'INPUT_FIELD' , init : '' , changeEvent : repoChangeEvent , isValid : repoIsValid } ,
143+ inputFieldRepo4 : { type : 'INPUT_FIELD' , init : '' , changeEvent : repoChangeEvent , isValid : repoIsValid } ,
144+ inputFieldRepo5 : { type : 'INPUT_FIELD' , init : '' , changeEvent : repoChangeEvent , isValid : repoIsValid } ,
145+ inputFieldRepo6 : { type : 'INPUT_FIELD' , init : '' , changeEvent : repoChangeEvent , isValid : repoIsValid } ,
146+ } ,
147+ } ,
148+ } ,
149+ } ,
130150 } as const satisfies Options
131151 Opts = modmanager . registerAndGetModOptions (
132152 {
0 commit comments