Giter Club home page Giter Club logo

Comments (10)

topjor avatar topjor commented on June 16, 2024 1

At first there was no real documentation about connecting to private servers, so i checked versions and the code to find out how to configure that, but I also saw this in the latest version:
(d6411b2#diff-c172382433adc1be8436b11321190519L125 (commit to v1.5.0)
which removes the server url parameter (as part of the api update)

@@ -122,7 +122,7 @@ module.exports = class Multimeter extends EventEmitter {
 
   run() {
     this.api = new ScreepsAPI({
-      serverUrl: this.config.serverUrl,
+      token: this.config.token,
     });
 
     this.screen = blessed.screen({

I will soon have a look and see about making a PR

from screeps-multimeter.

CGamesPlay avatar CGamesPlay commented on June 16, 2024

Hey, thanks for filing an issue! Unfortunately, I haven't been playing Screeps in a while and as such haven't bene doing development on this. I do accept pull requests and will happily push a new release once fixed.

Do you have an error message or stack trace when connecting to private servers?

Also CCing @SystemParadox since he made the API upgrades.

from screeps-multimeter.

SystemParadox avatar SystemParadox commented on June 16, 2024

Yes I removed the serverUrl option because it no longer works in the newer version of screeps-api. However, it has been replaced with protocol, hostname and port, so it should be pretty simple to add it back in.

I don't think private servers have the API enabled by default, although I do remember seeing a mod to enable it.

from screeps-multimeter.

topjor avatar topjor commented on June 16, 2024

I have just created a pr, looked at the screeps-api package for how it handles the connection, I am also thinking about writing a little doc for how it works, is the docs folder okay for the documentation?
I had a little issue myself when testing in that the url needs a / at the end otherwise the url.resolve returns nothing for some reason (has nothing to do with this but the screeps api)
(pr: #10)

from screeps-multimeter.

topjor avatar topjor commented on June 16, 2024

Also yes, for the api to work, you need to generate a api token with ether a steam token (/api/auth/signin), with a password (and screepsmod-auth) or a other mod (none that i know of) that would add static tokens, also the tokens will invalidate after a hour if I'm correct (first 2 methods), so it might be nice to add optional password auth

from screeps-multimeter.

osum4est avatar osum4est commented on June 16, 2024

@topjor How were you able to get an api token for your private server? I get a cannot GET error when trying to access my.server/api/auth/signin. Using an api token from the main server also doesnt work. I am able to create a password using screepsmod-auth, but this doesn't support providing a password.

from screeps-multimeter.

topjor avatar topjor commented on June 16, 2024

@osum4est It's a POST that you need to do with a json body containing i believe a email field with your username or email (if I'm correct it picked both in that field for me), and a password (or steam api token as per default in the official screeps client)

you will get a json body back with your api key (by default it will only be valid for n hours, so you will need to renew it unfortunatly without a mod that adds permanent api keys)

(I am currently at work so I cannot verify but I believe thats how it worked)

from screeps-multimeter.

osum4est avatar osum4est commented on June 16, 2024

I was just about to edit that I was dumb and didn't realize it was a POST instead of GET haha. That worked, however now I'm getting a "Error: getaddrinfo ENOTFOUND socket socket:80". I'm sure that is completely unrelated to this though, so thats a separate issue. I might take a look into that, as well as adding user/pass support to this in the next few days.

from screeps-multimeter.

topjor avatar topjor commented on June 16, 2024

by default screeps does not run on port 80 but 21025, if you get this error in your screeps logs, it cant contact steamapi domain (had that myself because of a wrong default route)

i wanted to try and implement it myself some time back but never came around to do so, so feel free, it would be great to have the option to use both methods

edit: i also have not come around and writing proper documentation for using this on a private servers

from screeps-multimeter.

osum4est avatar osum4est commented on June 16, 2024

Okay! I have improved the support for private servers and even adding setup for them to the start up menu. Submitted a PR!

from screeps-multimeter.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.