2023-02-18 05:09:11 +00:00
|
|
|
package native
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
|
2024-04-19 05:12:56 +00:00
|
|
|
"git.kirsle.net/SketchyMaze/doodle/pkg/plus/dpp"
|
2023-02-18 05:09:11 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
var USER string = os.Getenv("USER")
|
|
|
|
|
|
|
|
/*
|
|
|
|
DefaultAuthor will return the local user's name to be the default Author
|
|
|
|
for levels and doodads they create.
|
|
|
|
|
|
|
|
If they have registered the game, use the name from their license JWT token.
|
|
|
|
|
|
|
|
Otherwise fall back to their native operating system user.
|
|
|
|
*/
|
|
|
|
func DefaultAuthor() string {
|
2024-04-19 05:12:56 +00:00
|
|
|
// Are we registered? TODO: get from registration
|
|
|
|
if dpp.Driver.IsRegistered() {
|
|
|
|
if reg, err := dpp.Driver.GetRegistration(); err == nil {
|
2023-02-18 05:09:11 +00:00
|
|
|
return reg.Name
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return OS username
|
|
|
|
return os.Getenv("USER")
|
|
|
|
}
|