mirror of
https://wiilab.wiimart.org/wiimart/WiiSOAP
synced 2025-09-05 21:11:02 +02:00
Implement GetECConfig
This commit is contained in:
parent
e0f676f1f5
commit
7558aeed43
@ -1,6 +1,13 @@
|
|||||||
<Config>
|
<Config>
|
||||||
|
<!-- Web information -->
|
||||||
<Address>127.0.0.1:8080</Address>
|
<Address>127.0.0.1:8080</Address>
|
||||||
|
<!-- Used to configure various relative URLs.
|
||||||
|
For example, given a Base URL of example.com,
|
||||||
|
ias.example.com, ecs.example.com, etc. will be
|
||||||
|
returned as a part of configuration. -->
|
||||||
|
<BaseURL>example.com</BaseURL>
|
||||||
|
|
||||||
|
<!-- Database configuration -->
|
||||||
<SQLAddress>127.0.0.1:3306</SQLAddress>
|
<SQLAddress>127.0.0.1:3306</SQLAddress>
|
||||||
<SQLUser>username</SQLUser>
|
<SQLUser>username</SQLUser>
|
||||||
<SQLPass>password</SQLPass>
|
<SQLPass>password</SQLPass>
|
||||||
|
26
ecs.go
26
ecs.go
@ -36,7 +36,6 @@ func ecsInitialize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func checkDeviceStatus(e *Envelope) {
|
func checkDeviceStatus(e *Envelope) {
|
||||||
// You need to POST some SOAP from WSC if you wanna get some, honey. ;3
|
|
||||||
e.AddCustomType(Balance{
|
e.AddCustomType(Balance{
|
||||||
Amount: 2018,
|
Amount: 2018,
|
||||||
Currency: "POINTS",
|
Currency: "POINTS",
|
||||||
@ -47,11 +46,10 @@ func checkDeviceStatus(e *Envelope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func notifyETicketsSynced(e *Envelope) {
|
func notifyETicketsSynced(e *Envelope) {
|
||||||
// This is a disgusting request, but 20 dollars is 20 dollars. ;3
|
// TODO: Implement handling of synchronization timing
|
||||||
}
|
}
|
||||||
|
|
||||||
func listETickets(e *Envelope) {
|
func listETickets(e *Envelope) {
|
||||||
fmt.Println("The request is valid! Responding...")
|
|
||||||
rows, err := ownedTitles.Query(e.AccountId())
|
rows, err := ownedTitles.Query(e.AccountId())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
e.Error(2, "that's all you've got for me? ;3", err)
|
e.Error(2, "that's all you've got for me? ;3", err)
|
||||||
@ -89,14 +87,12 @@ func listETickets(e *Envelope) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getETickets(e *Envelope) {
|
func getETickets(e *Envelope) {
|
||||||
fmt.Println("The request is valid! Responding...")
|
|
||||||
e.AddKVNode("ForceSyncTime", "0")
|
e.AddKVNode("ForceSyncTime", "0")
|
||||||
e.AddKVNode("ExtTicketTime", e.Timestamp())
|
e.AddKVNode("ExtTicketTime", e.Timestamp())
|
||||||
e.AddKVNode("SyncTime", e.Timestamp())
|
e.AddKVNode("SyncTime", e.Timestamp())
|
||||||
}
|
}
|
||||||
|
|
||||||
func purchaseTitle(e *Envelope) {
|
func purchaseTitle(e *Envelope) {
|
||||||
// If you wanna fun time, it's gonna cost ya extra sweetie... ;3
|
|
||||||
e.AddCustomType(Balance{
|
e.AddCustomType(Balance{
|
||||||
Amount: 2018,
|
Amount: 2018,
|
||||||
Currency: "POINTS",
|
Currency: "POINTS",
|
||||||
@ -111,3 +107,23 @@ func purchaseTitle(e *Envelope) {
|
|||||||
e.AddKVNode("TitleId", "00000000")
|
e.AddKVNode("TitleId", "00000000")
|
||||||
e.AddKVNode("ETickets", "00000000")
|
e.AddKVNode("ETickets", "00000000")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// genServiceUrl returns a URL with the given service against a configured URL.
|
||||||
|
// Given a baseUrl of example.com and genServiceUrl("ias", "IdentityAuthenticationSOAP"),
|
||||||
|
// it would return http://ias.example.com/ias/services/ias/IdentityAuthenticationSOAP.
|
||||||
|
func genServiceUrl(service string, path string) string {
|
||||||
|
return fmt.Sprintf("http://%s.%s/%s/services/%s", service, baseUrl, service, path)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getECConfig(e *Envelope) {
|
||||||
|
contentUrl := fmt.Sprintf("http://ccs.%s/ccs/download", baseUrl)
|
||||||
|
e.AddKVNode("ContentPrefixURL", contentUrl)
|
||||||
|
e.AddKVNode("UncachedContentPrefixURL", contentUrl)
|
||||||
|
e.AddKVNode("SystemContentPrefixURL", contentUrl)
|
||||||
|
e.AddKVNode("SystemUncachedContentPrefixURL", contentUrl)
|
||||||
|
|
||||||
|
e.AddKVNode("EcsURL", genServiceUrl("ecs", "ECommerceSOAP"))
|
||||||
|
e.AddKVNode("IasURL", genServiceUrl("ias", "IdentityAuthenticationSOAP"))
|
||||||
|
e.AddKVNode("CasURL", genServiceUrl("cas", "CatalogingSOAP"))
|
||||||
|
e.AddKVNode("NusURL", genServiceUrl("nus", "NetUpdateSOAP"))
|
||||||
|
}
|
||||||
|
1
ias.go
1
ias.go
@ -57,7 +57,6 @@ func getChallenge(e *Envelope) {
|
|||||||
// It then uses another hard-coded value in place of this returned value entirely in any situation.
|
// It then uses another hard-coded value in place of this returned value entirely in any situation.
|
||||||
// For this reason, we consider it irrelevant.
|
// For this reason, we consider it irrelevant.
|
||||||
e.AddKVNode("Challenge", SharedChallenge)
|
e.AddKVNode("Challenge", SharedChallenge)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func getRegistrationInfo(e *Envelope) {
|
func getRegistrationInfo(e *Envelope) {
|
||||||
|
5
main.go
5
main.go
@ -35,6 +35,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var db *sql.DB
|
var db *sql.DB
|
||||||
|
var baseUrl string
|
||||||
|
|
||||||
// checkError makes error handling not as ugly and inefficient.
|
// checkError makes error handling not as ugly and inefficient.
|
||||||
func checkError(err error) {
|
func checkError(err error) {
|
||||||
@ -68,6 +69,8 @@ func main() {
|
|||||||
db.SetMaxOpenConns(10)
|
db.SetMaxOpenConns(10)
|
||||||
db.SetMaxIdleConns(10)
|
db.SetMaxIdleConns(10)
|
||||||
|
|
||||||
|
baseUrl = CON.BaseURL
|
||||||
|
|
||||||
// Initialize handlers.
|
// Initialize handlers.
|
||||||
ecsInitialize()
|
ecsInitialize()
|
||||||
iasInitialize()
|
iasInitialize()
|
||||||
@ -84,7 +87,7 @@ func main() {
|
|||||||
ecs.Authenticated("ListETickets", listETickets)
|
ecs.Authenticated("ListETickets", listETickets)
|
||||||
ecs.Authenticated("GetETickets", getETickets)
|
ecs.Authenticated("GetETickets", getETickets)
|
||||||
ecs.Authenticated("PurchaseTitle", purchaseTitle)
|
ecs.Authenticated("PurchaseTitle", purchaseTitle)
|
||||||
|
ecs.Unauthenticated("GetECConfig", getECConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
ias := r.HandleGroup("ias")
|
ias := r.HandleGroup("ias")
|
||||||
|
@ -32,6 +32,7 @@ type Config struct {
|
|||||||
XMLName xml.Name `xml:"Config"`
|
XMLName xml.Name `xml:"Config"`
|
||||||
|
|
||||||
Address string `xml:"Address"`
|
Address string `xml:"Address"`
|
||||||
|
BaseURL string `xml:"BaseURL"`
|
||||||
|
|
||||||
SQLAddress string `xml:"SQLAddress"`
|
SQLAddress string `xml:"SQLAddress"`
|
||||||
SQLUser string `xml:"SQLUser"`
|
SQLUser string `xml:"SQLUser"`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user