AnEmortalKid / avocapture

A replay renaming overlay
3 stars 0 forks source link

Allow host to be defined #20

Open AnEmortalKid opened 2 years ago

AnEmortalKid commented 2 years ago

Currently, the obs-websocket-server's address is hardcoded to localhost.

Being able host obs on the dedicated machine, with game in full screen, but a laptop OR a ipad, whatever, could be responsible for the renaming of the file.

This may not work at the moment with the renaming of the file assuming the path is on the host:

AnEmortalKid commented 2 years ago

Might have to store oS name on startup. The obs detector might have to send server name / address configured as part Of the replay data to determine if this is on the same host.

AnEmortalKid commented 2 years ago

Perhaps compare external ips within network:

https://quizdeveloper.com/faq/how-can-i-get-local-ip-address-in-nodedotjs-server-aid1245

const clientIp = Object.values(require("os").networkInterfaces())
        .flat()
        .filter((item) => !item.internal && item.family === "IPv4")
        .find(Boolean).address;
AnEmortalKid commented 2 years ago
> dns.resolve('myHost, 'A', (err,recs) => { console.log(recs) } )
QueryReqWrap {
  bindingName: 'queryA',
  callback: [Function (anonymous)],
  hostname: 'myHost',
  oncomplete: [Function: onresolve],
  ttl: false
}
> [ '192.168.1.322' ]
> const os = require('os')
undefined
> os.hostname()
`myHost'

On the obs side, can flex by checking if we are connecting through a hostname, localhost or an IP

const net = require('net')
> net.isIP('192.168.1.322')
4
> net.isIP('myHostName')

Then decorate the replayData with a hostname or sourceName (ip) from the detector:

 this.detectListener.detected({
            filePath: data.savedReplayPath,
            fileName: fileName,
// NEW 
    sourceHost:  valueFromSettings to the address for the server (whatever the user inputs)
          });

Then in the replay saver setTitle,

we check if the sourceHost is an ip / localhost / name vs where avocapture's running process is on (ipAddress again). If different, we try a remote rename.

AnEmortalKid commented 2 years ago

For windows, might have to give remote access to the filepath for the host that's running avocapture: https://support.microsoft.com/en-us/windows/file-sharing-over-a-network-in-windows-b58704b2-f53a-4b82-7bc1-80f9994725bf#:~:text=To%20share%20a%20file%20or,users%20access%20to%20the%20file.

might have to add settings for the user when renaming remote files to avocapture's settings and not on a per-plugin basis since the rename is part of avocapture and not a specific plugin

AnEmortalKid commented 2 years ago

Can also potentially require using a VendorRequest mechanism to rename on the host directly without file sharing, etc.