Basic storage and process modernization, basic API, basic bot kills, basic Sentry, scripts unit#10
Basic storage and process modernization, basic API, basic bot kills, basic Sentry, scripts unit#10dagoddamnlazysnake wants to merge 15 commits into
Conversation
|
#9 -hez képest több fix bekerült ide, bot toplistához kell az api rework. |
|
|
||
| implementation | ||
|
|
||
| procedure TDynamicArray.init; |
There was a problem hiding this comment.
Ezt még át akarom pakolni privátba, csak elfelejtettem.
| end; | ||
| end; | ||
|
|
||
| { |
There was a problem hiding this comment.
Ezt akár ki is lehetne venni, mert a wikin megvan.
| json, fname: string; | ||
| i: Integer; | ||
| begin | ||
| //open output file |
There was a problem hiding this comment.
Most, hogy van API POST akár már azt is használhatná de nem akartam ebbe a releasebe még azt is beszuszakolni.
| {$R stickman.RES} | ||
| {$DEFINE force16bitindices} //ez hib�s, p�r helyen, ha nincs kipontozva, meg kell majd n�zni | ||
| {$DEFINE undebug} //Remove dot for release, add dot for dev | ||
| {.$DEFINE undebug} //Remove dot for release, add dot for dev |
There was a problem hiding this comment.
Azottmaradt, bár nem is emlékszem, hogy ezt csak RC mellett szoktuk-e kivenni.
There was a problem hiding this comment.
Developon release utan vissza szoktam rakni egy 'Return to dev' commitban. Rossz commitbol inditottad az elso branchet.
| end; | ||
| const | ||
| PROTOCOL = 'https://'; | ||
| BASE_URL = 'localhost/api?mode='; //'stickman.hu/api?mode='; |
There was a problem hiding this comment.
Ezt tesztelés után vissza kell majd írni, mergelni így nem kéne.
| result.data := TQJSON.CreateFromHTTP(url); | ||
| except | ||
| result.success := false; | ||
| result.data := TQJSON.Create; |
There was a problem hiding this comment.
Innen elmaradt a postResponse-ból serializálás.
| kills := VariantUtils.VarRecToStr(args[0]); | ||
|
|
||
| postData := TIdMultiPartFormDataStream.Create; | ||
| postData.AddFormField('form[nev]', KillMeUtils.unhungaryify(multisc.nev)); |
There was a problem hiding this comment.
Ez nem a legjobb, de így lekezeli a speckó karaktereket is és nem kell szerver oldalon encodinggal hülyéskedni.
| begin | ||
| with _metadata do | ||
| begin | ||
| isDev := {$IFDEF undebug} false {$ELSE} true {$ENDIF}; |
There was a problem hiding this comment.
Flags are not global. Should create separete unit for them later.
| {$R stickman.RES} | ||
| {$DEFINE force16bitindices} //ez hib�s, p�r helyen, ha nincs kipontozva, meg kell majd n�zni | ||
| {$DEFINE undebug} //Remove dot for release, add dot for dev | ||
| {.$DEFINE undebug} //Remove dot for release, add dot for dev |
There was a problem hiding this comment.
Developon release utan vissza szoktam rakni egy 'Return to dev' commitban. Rossz commitbol inditottad az elso branchet.
| procedure reportBotKills(const args: array of const); | ||
| begin | ||
| bootkillsendtim := 500; | ||
| if (botkills <= 0) exit; |
There was a problem hiding this comment.
Syntax error! Missing 'then'. Compile (and run) before commit!
| cloud_color:longword; | ||
| mati:TMaterial; | ||
| tmpbol:boolean; | ||
| tmpbol:boolean; |
| value:single; | ||
| r:TSingleArray; | ||
| begin | ||
| // ! a vektor v�ltoz� |
There was a problem hiding this comment.
TODO rewrite old comments in English so less stuff breaks when encoding hits the fan
| i: integer; | ||
| begin | ||
| i := 1; | ||
| CreateQJSONFromString(src, i); |
There was a problem hiding this comment.
Return value not used. Assign to root.
There was a problem hiding this comment.
Also, we should skip if src is empty.
There was a problem hiding this comment.
Also, we should skip if src is empty.
CreateQJSONFromString handles that case, will return QJSON_NULL accurately.
Most of these directives provide conditional compilation for developer-only features. Storing them in memory poses security issues. Even though in this case (Sentry) it does end up in the memory, it is only for convenience and not used to add any critical code, we should not promote indirect usage of directives.
|
TODO: add explicit null return or throw on critical short circuit checks |
| function callback: TIndefiniteProcedure; //ez lesz a thread execute | ||
| end; | ||
|
|
||
| type TCallbackThread = class (TThread) | ||
| private | ||
| _callback: TIndefiniteProcedure; | ||
| protected | ||
| procedure Execute(const args: array of const); overload; | ||
| published | ||
| constructor Create(callback: TIndefiniteProcedure); | ||
| end; | ||
|
|
||
| TCallbackThreadArray = array of TCallbackThread; | ||
|
|
||
| //TODO: proxy layer to takeLeading, takeLatest, etc sagas | ||
| type TThreadHandler = class (TObject) | ||
| private | ||
| _sagas: array of TSaga; | ||
| _threads: TCallbackThreadArray; | ||
| procedure cleanup(hard: boolean = false); | ||
| published | ||
| constructor Create; | ||
| procedure addSaga(saga: TSaga); | ||
| function call(key: string; const args: array of const): THandle; //�jat ind�t, suspend marad ahogy volt | ||
| //TODO: procedure all(keys: array of string; parallel: boolean = false); | ||
| //TODO: procedure race(keys: array of string); | ||
| //TODO: execute(key / keys / null) //csak ha van is suspended, nem ind�t �jat | ||
| //TODO: suspend(key / keys / null) | ||
| //TODO: terminate(key / keys / null) | ||
| //TODO: waitFor(key / keys / null) //az lemegy, t�bbi suspended |
No description provided.