Skip to content

Commit

Permalink
Add customization for renderer name on the website (official instance…
Browse files Browse the repository at this point in the history
… only)
  • Loading branch information
MasterIO02 committed Oct 26, 2022
1 parent 357846e commit 5d580c2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ You can find FFmpeg builds [here](https://github.com/BtbN/FFmpeg-Builds/releases
- renderOnInactivityOnly: connect to the o!rdr server once the computer is idle (check every 60 seconds if mouse or keyboard hasn't been touched for 30 seconds). To use this, you need to install the desktop-idle package with "npm install --save desktop-idle". On Windows, it needs Python and VS > 2016 to compile what it needs to work correctly. Check [this](https://github.com/bithavoc/node-desktop-idle) for more informations about this package. Won't work on precompiled builds for the moment.
- customSongsFolderPath: use a custom path to store songs downloaded instead of the default (files/danser/Songs). Can be useful if you want new maps on osu! for example.
- logTimestamps: add a timestamp before every log line.
- customization: (to use with the official o!rdr instance only) with textColor and backgroundType - change the way your renderer name looks on the website! Changes made to this field are hotswappable and changes are effective almost instantly.

Available options for textColor: `salmon`, `azure`, `emerald`, `pear`, `pumpkin`, `red`, `teal-blue`, `cream`, `silver-coin`, `botany`, `calm-gold`, `limestone`, `alpine-morning-blue`, `transluscent-white`, `yellow-orange`, `algae-green`. Empty string for default white.

Available options for backgroundType: from 0 (none) to 6 included.

## Build

Expand Down
15 changes: 14 additions & 1 deletion files/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ exports.startServer = async () => {

console.log("Server started!")

let customization = config.customization

setTimeout(() => {
if (!ioClient.connected) {
console.log("Cannot connect to the o!rdr server. Trying to connect...")
Expand All @@ -42,7 +44,7 @@ exports.startServer = async () => {

ioClient.on("connect", () => {
console.log("Connected to the o!rdr server!")
ioClient.emit("id", config.id, version, config.usingOsuApi, config.motionBlurCapable, config.uhdCapable, isRendering())
ioClient.emit("id", config.id, version, config.usingOsuApi, config.motionBlurCapable, config.uhdCapable, isRendering(), customization)
})

ioClient.on("disconnect", () => {
Expand All @@ -58,6 +60,10 @@ exports.startServer = async () => {
dataProcessor(data)
})

ioClient.on("cool_message", message => {
console.log(`The o!rdr server says: ${message}`)
})

ioClient.on("version_too_old", () => {
console.log("This version of the client is too old! Restart it to apply the update.")
config.needUpdate = true
Expand All @@ -80,6 +86,13 @@ exports.startServer = async () => {
console.log(`Connection error: ${err.message}`)
}
})

fs.watchFile(process.cwd() + "/config.json", { interval: 1000 }, () => {
console.log("Detected change in the config file, telling changes to the server.")
let newConfig = JSON.parse(fs.readFileSync(process.cwd() + "/config.json", { encoding: "utf-8" }))
customization = newConfig.customization
ioClient.emit("customization_change", newConfig.customization)
})
}

exports.sendProgression = data => {
Expand Down
8 changes: 8 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ if (typeof config.discordPresence === "undefined") {
writeConfig()
}

if (typeof config.customization === "undefined") {
config.customization = {
textColor: "",
backgroundType: 0
}
writeConfig()
}

if (config.logTimestamps) {
require("log-timestamp")
}
Expand Down

0 comments on commit 5d580c2

Please sign in to comment.