Code Monkey home page Code Monkey logo

banmanager-webapi's People

Contributors

confuser avatar renovate-bot avatar renovate[bot] avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

legoman99573

banmanager-webapi's Issues

v1 /mute/ip

POST /server/:id/mute/ip

  • Validation
  • Protected by auth
  • Behind ACL

PATCH /server/:id/mute/ip/:muteId

  • See POST

DELETE /server/:id/mute/ip/:muteId

  • Protected by auth
  • Behind ACL

GET /server/:id/mute/ip

  • Paginated
  • Supports filtering

GET /server/:id/mute/ip/:muteId

  • Returns mute

v1 /player

GET /server/:id/player/:uuid

  • Returns name, last seen
  • Depending on ACL, return ip address

GET /player/:uuid

  • Returns name, last seen for each server
  • Depending on ACL, return ip addresses

GET /player/:name

  • Returns name, last seen for each server
  • Depending on ACL, return ip addresses

Impossible to setup WebAPI

Hi!

How to reproduce

I tried to setup BanManager-WebAPI following this guide

I configured everything (MySQL, domain etc) but right after I created Admin user, I got error and configuration don't finalize.

I tried to install it under Debian 9 (server) and Debian 10 (desktop), same error happened.

Environment details

OS: Debian 9 and Debian 10
Node: v10.16.3 and 12.9.1
NPM: v6.9.0 and 6.10.2

Logs

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'setup' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'presetup', 'setup', 'postsetup' ]
5 info lifecycle [email protected]~presetup: [email protected]
6 info lifecycle [email protected]~setup: [email protected]
7 verbose lifecycle [email protected]~setup: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~setup: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/user/Spigot/BanManager-WebAPI/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games
9 verbose lifecycle [email protected]~setup: CWD: /home/user/Spigot/BanManager-WebAPI
10 silly lifecycle [email protected]~setup: Args: [ '-c', 'node bin/bm-cli setup' ]
11 silly lifecycle [email protected]~setup: Returned: code: 1  signal: null
12 info lifecycle [email protected]~setup: Failed to exec setup script
13 verbose stack Error: [email protected] setup: `node bin/bm-cli setup`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
13 verbose stack     at EventEmitter.emit (events.js:209:13)
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:209:13)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/user/Spigot/BanManager-WebAPI
16 verbose Linux 4.19.0-5-amd64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "setup"
18 verbose node v12.9.1
19 verbose npm  v6.10.2
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] setup: `node bin/bm-cli setup`
22 error Exit status 1
23 error Failed at the [email protected] setup script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Setup doesnt work

First of all i'm aware this this is project in development. I wanted to give this feature a little test along with the new web panel.

I've setup a sub domain (api.salyfactory) for the API, running with Plesk.
Enabled nodejs on the machine. The install works well after adding a ".npmrc" file in the root directory of the project. the file contains: "scripts-prepend-node-path=true"

I have to do this to avoid the error "no node binary in the current PATH"
After that install trough plesk i want to execute the setup with "node bin/bm-cli setup"

However i get the following error:

-sh-4.2$ node bin/bm-cli setup
/var/www/vhosts/salyfactory.com/api.salyfactory.com/cli/commands/encrypt.js:11
exports.handler = async function () {
                        ^^^^^^^^
SyntaxError: Unexpected token function
    at createScript (vm.js:56:10)
    at Object.runInThisContext (vm.js:97:10)
    at Module._compile (module.js:549:28)
    at Object.Module._extensions..js (module.js:586:10)
    at Module.load (module.js:494:32)
    at tryModuleLoad (module.js:453:12)
    at Function.Module._load (module.js:445:3)
    at Module.require (module.js:504:17)
    at Object.require (internal/module.js:20:19)
    at /var/www/vhosts/salyfactory.com/api.salyfactory.com/node_modules/require-directory/index.js:76:17

I tried to run this as the domain user. Or root. Both come up with the same error.

When i run the "setup" script trough the plesk app it somewhat works. but i cant fill anything in there. i get the following output:


[email protected] setup /var/www/vhosts/salyfactory.com/api.salyfactory.com
node bin/bm-cli setup

Starting setup
If unsure, use default
? BanManager UI Site Hostname (http://localhost:3000)

I'm out of ideas on how to continue setting the api up.

Versions:
Node.js: 12.4.0

Thanks in advance!
love your work dude!

v1 /note

POST /server/:id/note/player

  • Validation
  • Protected by auth
  • Behind ACL

PATCH /server/:id/note/player/:noteId

  • See POST

DELETE /server/:id/note/player/:noteId

  • Protected by auth
  • Behind ACL

GET /server/:id/note/player

  • Paginated
  • Supports filtering
  • Protected by auth
  • Behind ACL

GET /server/:id/note/player/:noteId

  • Returns note

v1 /warn/player

POST /server/:id/warn/player

  • Validation
  • Only allows warning of existing players
  • Protected by auth
  • Behind ACL

PATCH /server/:id/warn/player/:warnId

  • See POST

DELETE /server/:id/warn/player/:warnId

  • Protected by auth
  • Behind ACL

GET /server/:id/warn/player

  • Paginated
  • Supports filtering

GET /server/:id/warn/player/:warnId

  • Returns warn

Cleanup

Lots of trial/errors to do with JSON API. Clean up the code, reduce duplication etc.

Tests

Many of the initial tests are broken. Fix and have better overall coverage.

v1 /appeal

POST /appeal/player

  • Validation
  • Only allows appealing of existing ban/mute
  • Protected by auth
  • Behind ACL

PATCH /appeal/player/:appealId

  • See POST

DELETE /appeal/player/:appealId

  • Protected by auth
  • Behind ACL

GET /appeal/player

  • Paginated
  • Supports filtering

GET /appeal/player/:uuid

  • Paginated
  • Supports filtering

GET /appeal/player/:appealId

  • Returns appeal

POST /appeal/comment

  • Validation
  • Only allows commenting on existing appealments
  • Protected by auth
  • Behind ACL

PATCH /appeal/comment

  • See POST

DELETE /appeal/comment/:commentId

  • Protected by auth
  • Behind ACL

Delete punishments should create record

Currently deletes from table, but does not create an entry in *_records. This should be optional with a boolean parameter which itself is behind a permission.

As an aside, this mutation should be replaced with punishment specific mutations, i.e. deletePlayerBan, deletePlayerMute etc

v1 /ban/ip

POST /server/:id/ban/ip

  • Validation
  • Protected by auth
  • Behind ACL

PATCH /server/:id/ban/ip/:banId

  • See POST

DELETE /server/:id/ban/ip/:banId

  • Protected by auth
  • Behind ACL

GET /server/:id/ban/ip

  • Paginated
  • Supports filtering

GET /server/:id/ban/ip/:banId

  • Returns ban

v1 /server

POST /server

  • Validation
  • Encrypt database password
  • Generate unique token/slug as an identifier
  • Protected by auth
  • Behind ACL

PATCH /server

  • See POST
  • Protected by auth
  • Behind ACL

DELETE /server/:id

  • Deletes server
  • Protected by auth
  • Behind ACL

GET /server

  • Returns all servers
  • Does not leak sensitive data such as connection/tables

GET /server/:id

  • Does not leak sensitive data such as connection/tables

Issue with WebAPI on install

Trying to install WebAPI on ubuntu 18.04 using

  • node v8.12.0
  • npm v6.13.4

Error Log

1 verbose cli [ '/root/.nvm/versions/node/v8.12.0/bin/node',
1 verbose cli   '/root/.nvm/versions/node/v8.12.0/bin/npm',
1 verbose cli   'run',
1 verbose cli   'setup' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'presetup', 'setup', 'postsetup' ]
5 info lifecycle [email protected]~presetup: [email protected]
6 info lifecycle [email protected]~setup: [email protected]
7 verbose lifecycle [email protected]~setup: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~setup: PATH: /root/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/banmanager/BanManager-WebAPI/node_modules/.bin:/root/.nv$
9 verbose lifecycle [email protected]~setup: CWD: /home/banmanager/BanManager-WebAPI
10 silly lifecycle [email protected]~setup: Args: [ '-c', 'node bin/bm-cli setup' ]
11 silly lifecycle [email protected]~setup: Returned: code: 1  signal: null
12 info lifecycle [email protected]~setup: Failed to exec setup script
13 verbose stack Error: [email protected] setup: `node bin/bm-cli setup`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at EventEmitter.emit (events.js:214:7)
13 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at emitTwo (events.js:126:13)
13 verbose stack     at ChildProcess.emit (events.js:214:7)
13 verbose stack     at maybeClose (internal/child_process.js:915:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/banmanager/BanManager-WebAPI
16 verbose Linux 4.15.0-74-generic
17 verbose argv "/root/.nvm/versions/node/v8.12.0/bin/node" "/root/.nvm/versions/node/v8.12.0/bin/npm" "run" "setup"
18 verbose node v8.12.0
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] setup: `node bin/bm-cli setup`
22 error Exit status 1
23 error Failed at the [email protected] setup script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]```

v1 /mute/player

POST /server/:id/mute/player

  • Validation
  • Only allows muteing of existing players
  • Protected by auth
  • Behind ACL

PATCH /server/:id/mute/player/:muteId

  • See POST

DELETE /server/:id/mute/player/:muteId

  • Protected by auth
  • Behind ACL

GET /server/:id/mute/player

  • Paginated
  • Supports filtering

GET /server/:id/mute/player/:muteId

  • Returns mute

v1 /report

POST /server/:id/report/player

  • Validation
  • Only allows reporting of existing players
  • Protected by auth
  • Behind ACL

PATCH /server/:id/report/player/:reportId

  • See POST

DELETE /server/:id/report/player/:reportId

  • Protected by auth
  • Behind ACL

GET /server/:id/report/player

  • Paginated
  • Supports filtering

GET /server/:id/report/player/:reportId

  • Returns report

POST /server/:id/report/player/comment

  • Validation
  • Only allows commenting on existing reports
  • Protected by auth
  • Behind ACL

PATCH /server/:id/report/player/comment

  • See POST

DELETE /server/:id/report/player/comment/:commentId

  • Protected by auth
  • Behind ACL

v1 /kick

PATCH /server/:id/kick/player/:kickId

  • See POST

DELETE /server/:id/kick/player/:kickId

  • Protected by auth
  • Behind ACL

GET /server/:id/kick/player

  • Paginated
  • Supports filtering
  • Protected by auth
  • Behind ACL

GET /server/:id/kick/player/:kickId

  • Returns kick

v1 /ban/player

POST /server/:id/ban/player

  • Validation
  • Only allows banning of existing players
  • Protected by auth
  • Behind ACL

PATCH /server/:id/ban/player/:banId

  • See POST

DELETE /server/:id/ban/player/:banId

  • Protected by auth
  • Behind ACL

GET /server/:id/ban/player

  • Paginated
  • Supports filtering

GET /server/:id/ban/player/:banId

  • Returns ban

Enable linting

Migrate to standard, and enable linting checks as part of testing

Can't paste config.yml

Hey, me again,

Managed to fix the node.js issue.
however when i go trough the setup it asked me to paste the config.yml.
I do so but i throws me an error that it isnt a valid config.
See here:

https://paste.ubuntu.com/p/JK87sQByyZ/

Ive tried the config with and without comments. or only the database info none worked.
So here is the config: (pretty standard I believe)
https://paste.ubuntu.com/p/nZht5PxY5w/

And maybe its easy to have a quick convo on discord or something, (shorter lines innit)
arriej#9130

Thanks in advance

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.