@@ -30,16 +30,25 @@ type eiData struct {
3030var (
3131 // Contracts is a map of contracts and is saved to disk
3232 eiDatas map [string ]* eiData
33+
34+ // CoopStatusFixEnabled is a callback set from outside the ei package (to avoid import
35+ // cycles) that returns true when the alternate coop_status endpoint and eeid override
36+ // should be used. It is wired up in main.
37+ CoopStatusFixEnabled func () bool
3338)
3439
3540func init () {
3641 eiDatas = make (map [string ]* eiData )
3742}
3843
3944// GetCoopStatus retrieves the coop status for a given contract and coop
40- func GetCoopStatus (contractID string , coopID string ) (* ContractCoopStatusResponse , time.Time , string , error ) {
45+ func GetCoopStatus (contractID string , coopID string , eeidOverride string ) (* ContractCoopStatusResponse , time.Time , string , error ) {
4146 eggIncID := config .EIUserIDBasic
4247 reqURL := "https://www.auxbrain.com/ei/coop_status_bot"
48+ if eeidOverride != "" && CoopStatusFixEnabled != nil && CoopStatusFixEnabled () {
49+ eggIncID = DecryptEID (eeidOverride )
50+ reqURL = "https://www.auxbrain.com/ei/coop_status"
51+ }
4352 enc := base64 .StdEncoding
4453 timestamp := time .Now ()
4554
@@ -205,9 +214,13 @@ func ClearCoopStatusCachedData() {
205214
206215// GetCoopStatusForCompletedContracts retrieves the coop status for a given contract and coop, but is intended for completed contracts
207216// This saves the data in compressed form without a timestamp in the filename
208- func GetCoopStatusForCompletedContracts (contractID string , coopID string ) (* ContractCoopStatusResponse , time.Time , string , error ) {
217+ func GetCoopStatusForCompletedContracts (contractID string , coopID string , eeidOverride string ) (* ContractCoopStatusResponse , time.Time , string , error ) {
209218 eggIncID := config .EIUserIDBasic
210219 reqURL := "https://www.auxbrain.com/ei/coop_status_bot"
220+ if eeidOverride != "" && CoopStatusFixEnabled != nil && CoopStatusFixEnabled () {
221+ eggIncID = DecryptEID (eeidOverride )
222+ reqURL = "https://www.auxbrain.com/ei/coop_status"
223+ }
211224 enc := base64 .StdEncoding
212225 timestamp := time .Now ()
213226
0 commit comments