Giter Site home page Giter Site logo

gd-nodejs-api's Introduction

GD NodeJS API

‌‌ ‌ ‌‌ ‌ ‌‌ ‌ ‌‌ ‌

A NodeJS Geometry Dash API meant to purpose as one of the easiest to extend, update and use APIs in the game.

Features

  • Full endpoint request API.
  • CCLocalLevels.dat save file to level selection.
  • CCLocalLevels.dat save file to json data for a specific level index.
  • A raw CCLocalLevels.dat json translation API.
  • A value translation API.
  • Express web server support.

Express URLs

  • /api/docs/ The API documentation (unfinished).
  • /api/save/level/ The level selection page from a level save.
  • /api/save/level/raw/ The raw translation of a level save.
  • /api/save/level/json/ The full translation of a level save.
  • /api/save/level/{index}/ The selective full translation of a level in the level save.
  • /api/endpoint/ The endpoint API index page.
  • /api/endpoint/{type}/{values}/ The endpoint request API.
  • /api/valueNames/{navigation}/ The list for every GD format value name navigated by the URL.
  • /api/docs/ The base of the new documentations.

How to install the API

  1. Install the project as a zip.
  2. Unzip it on the location you want the project to be hosted from.
  3. Install NodeJS.
  4. Open a Powershell terminal in the folder where the project is located.
  5. Run the command npm i; npm run start.
  6. Check if it sends startup info back. If so it works.

How to configure the API

The values refer to the values in The config file,
The word all refers to everything in that object.

  • settings
    • logging
      • errorLogging: If the application should log errors or not.
    • analytics
      • allowChartInteraction: If the user is allowed to disable chart lines.
      • showBrowserVisits: If the user is allowed to see the browser info from visitors.
    • endpoints
      • all: If the specific endpoint should be enabled and tested.
    • expressWebServer: If the express server should be initialized.
  • values
    • webServer
      • port: On what port the server should run.
    • analytics
      • refreshRateMs: What the analytics endpoint refresh rate should be.
      • chartRoundOn: On what number the chart should round.
      • maxErrorsPer100Visits: How many errors 100 visits on average is allowed to have.
    • endpoints
      • targetServer: What server should be targeted for the endpoint request API.

How to contribute to the API

Follow all the steps in The contribution information.

Credits

  • Miko
    • Decoding gzip.
    • Helping with general NodeJS features.
  • 101arrowz
    • Cleaning up some parts of the code.
  • cos8o
    • General geometry dash info.

Upcoming updates

  • CI/CD.
  • Gherkin tests.
  • Style check.
  • Auto generated API docs.
  • Discord support.
  • More value translations.
  • Translation support for all save files.
  • Documentations for all encryptions/encodings Geometry Dash uses.
  • GD method documentations (cut candidate).

gd-nodejs-api's People

Contributors

nekitdev avatar smjsgaming avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gd-nodejs-api's Issues

App crashes when CCLocalLevels contains an empty level

When going to the /api/save/level/json/ path, if the submitted CCLocalLevels.dat file contains a newly created level the app crashes.

Log:

Error case #1
Time of error: 1584554684215
Section: level-save-select
TypeError: Cannot read property 'startsWith' of undefined
    at EncodedLevelSaveParametersToJson.k4 (C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\api\converters\save\EncodedLevelSaveParametersToJson.js:66:22)
    at EncodedLevelSaveParametersToJson.converter (C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\api\converters\save\EncodedLevelSaveParametersToJson.js:53:51)
    at SelectiveLevelSaveService.service (C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\api\services\save\SelectiveLevelSaveService.js:46:51)
    at C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\api\controllers\LevelSaveController.js:100:75
    at Array.forEach (<anonymous>)
    at C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\api\controllers\LevelSaveController.js:99:30
    at Layer.handle [as handle_request] (C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\node_modules\express\lib\router\layer.js:95:5)
    at next (C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\node_modules\express\lib\router\route.js:137:13)
    at Route.dispatch (C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\node_modules\express\lib\router\route.js:112:3)
    at Layer.handle [as handle_request] (C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\node_modules\express\lib\router\layer.js:95:5)

<--- Last few GCs --->

[27532:000002127841BB60]    59630 ms: Mark-sweep 2056.9 (2078.9) -> 2055.0 (2083.1) MB, 788.1 / 0.0 ms  (average mu = 0.075, 
current mu = 0.041) allocation failure scavenge might not succeed


<--- JS stacktrace --->

==== JS stack trace =========================================

    0: ExitFrame [pc: 00007FF6A521463D]
Security context: 0x00a8d17408a1 <JSObject>
    1: jsonPush [000000B2044798C1] [C:\Users\XGen26\dev\gd\GD-NodeJS-API-master\api\converters\level\LevelDataToJson.js:~133] [pc=0000019AD7482422](this=0x00b204478619 <LevelDataToJson map = 00000027CF80F1B1>,0x02e1779c8e69 <JSArray[49267]>,0x02e1779c8e89 <JSArray[73159]>,0,0x0199a25c06e1 <false>,0x0199a25c04a9 <undefined>)
    2: objects [000000B204479851...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF6A464232F napi_wrap+124543
 2: 00007FF6A45E36A6 v8::base::CPU::has_sse+34502
 3: 00007FF6A45E4366 v8::base::CPU::has_sse+37766
 4: 00007FF6A4DE8C5E v8::Isolate::ReportExternalAllocationLimitReached+94
 5: 00007FF6A4DD0CA1 v8::SharedArrayBuffer::Externalize+833
 6: 00007FF6A4C9E56C v8::internal::Heap::EphemeronKeyWriteBarrierFromCode+1436
 7: 00007FF6A4CA9910 v8::internal::Heap::ProtectUnprotectedMemoryChunks+1312
 8: 00007FF6A4CA6444 v8::internal::Heap::PageFlagsAreConsistent+3204
 9: 00007FF6A4C9BCD3 v8::internal::Heap::CollectGarbage+1283
10: 00007FF6A4C9A4A4 v8::internal::Heap::AddRetainedMap+2356
11: 00007FF6A4CB45AE v8::internal::Factory::AllocateRawFixedArray+94
12: 00007FF6A4CBB944 v8::internal::Factory::NewFixedArrayWithFiller+52
13: 00007FF6A4CBB901 v8::internal::Factory::NewUninitializedFixedArray+65
14: 00007FF6A4B8C4DF v8::internal::FeedbackNexus::ic_state+56319
15: 00007FF6A4B9E155 v8::Object::GetIsolate+13461
16: 00007FF6A4B85BFD v8::internal::FeedbackNexus::ic_state+29469
17: 00007FF6A4B425C7 v8::internal::JSObject::AddDataElement+999
18: 00007FF6A4B003CF v8::internal::PrototypeUsers::Add+1983
19: 00007FF6A4B1B58D v8::internal::Object::SetProperty+237
20: 00007FF6A4A148AF v8::internal::Runtime::SetObjectProperty+303
21: 00007FF6A4A13DC5 v8::internal::Runtime::GetObjectProperty+17637
22: 00007FF6A521463D v8::internal::SetupIsolateDelegate::SetupHeap+567949
23: 0000019AD7482422

level description decompression

when i tried to see my local levels, value for level description field (k3) is base64-compressed. maybe it was intended to have this field uncompressed
IMG

Analytics update (Update 0.3.0)

Planned features

  • Analytics data preview showing for example:
    • Memory usage
    • Storage management
    • Application use
  • Error cases in the console with data like:
    • Case number
    • Timestamp
    • Error log
    • Error section ID
  • Module info on startup containing info like:
    • If a module is up to date
    • Suggested commands for updating the modules

Possible delay causes

  • Getting all data from the application
  • Work next to the project
  • Code cleanups

Color object names tend to use the opacity instead of ID

Describe the bug

A clear and concise description of what the bug is

Steps to reproduce

  1. Go to /api/save/level/
  2. Give a save which has the player color property not set on a color
  3. See error by looking at that color object

Expected behavior

Opacity as object name

Screenshots

preview

Code cleanups will take longer

Improvement list

  • More common functions being pushed to utils
  • A more maintainable code format
  • More efficient data handling

Possible delay causes

  • Errors with the new format

New templates and markdown fixes

Current issues

The following are the main issues.

The templates are complex

The templates right now are too complex to use for people new to markdown.

Not following the standards

Right now the templates do not follow the markdown standards.

Bugs in the templates

Some markdown is incorrect in the current templates.

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.