pushing code


  • SUN

    i've tried updating the grunt screeps task to push my code into the private server.


    I've been able to find that
    1/ we need to use http and not https
    2/ the port to be used is 21025
    but when trying to authenticate using the email i've chosen (in the private server), and no password, i get a 401 error.

    Is this supposed to be working or does it depend on future developments of the standalone server ? 


  • Dev Team

    grunt-screeps doesn't support private servers since private servers have no password authentication.



  • Is http upload supposed to be possible? I use curl to upload to prod, in theory should that work for the standalone server as well? Will the stanalone server support authentication in the future?


  • Dev Team

    Private servers only accept authentication through Steam tickets generated by the native client, so I'm afraid it's not possible. We don't have any plans to add more authentication methods. 


  • SUN

    I Just tried disabling authentication completely, it still returns a 401 error.

    Do private servers have a different kind of authentication ? 

    edit: digging through the source code , i have the feeling this the private server is using some kind of steam based sso-authentication ... is there any chance this is going to work without steam client ?
    I don't know for the other players, but to me, one of main values of the private server is to offer some kind of fast (and, let's dream, debuggable) PTR, and being able to deploy code as on live would be nice



  • @Finndibaen See the readme section on Authentication.

     

    I will say that looking at the code it is possible to implement your own version of this through mods. If you look in the examples there is a /api/test/ endpoint. You might be able to reimplement the official screeps api/user/code by forwarding the auth token? I'm looking into what it would take to implement this mod. 


  • Dev Team

    You can simply deploy code by changing files in your local scripts folder. Click “Open local folder” button in your in-game script editor. You don’t have to set up grunt task if you have the Steam version installed.

    As to custom authentication mechanism using mods, it’s fully doable, see config.backend.expressPreConfig and config.backend.router options. You can even implement your own API keys system using these.



  • Woot! I got a v1 of a mod to do this. Note that there is no authentication for this meaning that anyone can push any code for any player. I'm working on getting auth to work, but for those like me just using private server as a personal PTR, it works.

     

    https://github.com/zininzinin/code-push-sceeps

    Call Example:

    {"email": "test@test.com", "branch":"default","modules":{"main":"require(\"hello\");","hello":"console.log(\"Hello World!\");"}}


  • Culture

    I've got a mod that does this and adds auth
    http://puu.sh/rWZIJ/73da93abf1.png
    https://gist.github.com/ags131/4e2c4298e329846cf3021af690b53fab

    Its published to NPM, but until I release my modloader mod, that version isn't as easily used.

    It allows ANY existng screep API client to connect as long as your client supports setting the server URL, an email, and password



  • Aww poo. You beat me to it. I just finished adding auth to my code push method, but it could use some touch up. Now i just need to pull request for grunt-screeps to be able to hit this.

    {"email": "test@test.com", "password": "pass", "branch":"default","modules":{"main":"require(\"hello\");","hello":"console.log(\"Hello World!\");"}}


  • Culture



  • Nice mods! Is there a place to post private server mods to yet? Also, I've edited the grunt-screeps to allow integration with my private server mod:

    https://github.com/zininzinin/grunt-screeps

    https://github.com/zininzinin/code-push-sceeps


  • Culture

    Not that I know of, we've been sharing links in the slack #servers channel. Also, the API token mod I made only requires clients to support changing URL, the normal /api/user/code endpoint works 😄