Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add marquee reader from server #10

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions common/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ type Config struct {
DatabaseName string `xml:"databaseName"`
Address string `xml:"address"`
AssetsPath string `xml:"assetsPath"`
ServerURL string `xml:"serverURL"`
}

func CheckError(err error) {
Expand Down
1 change: 1 addition & 0 deletions config-example.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@

<!-- Everything else -->
<assetsPath>mc-assets</assetsPath>
<serverURL>http://localhost:9011</serverURL>
</Config>
22 changes: 20 additions & 2 deletions first/addition.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ import (
_ "embed"
"encoding/json"
"fmt"
"github.com/WiiLink24/MiiContestChannel/common"
"io"
"math"
"net/http"

"github.com/WiiLink24/MiiContestChannel/common"
)

type Root struct {
Expand Down Expand Up @@ -123,7 +126,22 @@ func (l *Languages) GetLanguageFromJSON(language uint32) *Entry {
}

func MakeAddition() error {
marqueeText := []byte("WiiLink Mii Contest Channel!!!!")
var marqueeText []byte

resp, error := http.Get(common.GetConfig().ServerURL + "/assets/marquee/marquee.txt")
if error != nil {
marqueeText = []byte("WiiLink Mii Contest Channel!!!!")
kouacc marked this conversation as resolved.
Show resolved Hide resolved
} else {
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
if err != nil {
marqueeText = []byte("WiiLink Mii Contest Channel!!!!")
} else {
marqueeText = body
}
}

var actual [1536]byte
copy(actual[:], marqueeText)

Expand Down