-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add: first version of bananas-api #3
Conversation
b617cbb
to
f88f910
Compare
50fd242
to
10cd299
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
too much code to review in depth :p
} | ||
|
||
EXT_CTRL_CODES = { | ||
0x01: (0, " "), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar here - why some have a space and some not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some control codes resemble special whitespace or characters, while some resemble formatting (colour, font size).
(b[pos] & 0x07) << 18 | (b[pos + 1] & 0x3F) << 12 | (b[pos + 2] & 0x3F) << 6 | (b[pos + 3] & 0x3F), | ||
) | ||
else: | ||
return (0, None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should error, rather than returning something?
ba5957a
to
7194b72
Compare
52261a9
to
6d8e862
Compare
6d8e862
to
b7f6034
Compare
def validate_dependency(self, data, **kwargs): | ||
if not DEPENDENCY_CHECK: | ||
return | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validate content_type.
- ai, ai-library: only allow ai-library
- base-graphics, base-music, base-sounds: no dependencies allowed
- game-script, game-script-library: only allow game-script-library
- heightmap, newgrf: no dependencies allowed
- scenario: only allow newgrf, ai and game-script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this list is incompletely. Please correct me if I am wrong, but:
ai can also depend on scenario and game-script (for tutorial games)
game-script can also depend on scenario and ai (reverse of above)
newgrf can depend on other newgrfs
At least, that is what is in the current BaNaNaS. So I will implement that for now. If this is not what you expected, we put it on the wishlist to fix. As of course that means we first need to fix existing content :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This turns out to be a non-trivial addition. A version doesn't know what content-type it belongs to. In result, there is not a real way to check this in a consistent matter throughout the code. I need to think some more about this, but as such I am putting it on the wishlist for now, so we don't forget. Not sure it is mandatory for v1. If people abuse it, we can just kick them from the platform or something :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a scenario references a GS or AI, they are activated when loading the scenario.
But when you select a GS, this does not pick a single scenario. So, I think the dependency only makes sense in one direction.
About NewGRF depending on NewGRF, I guess this is along the line of "recommends". Fine to allow that.
81b68b2
to
82a1ed1
Compare
becb998
to
30e27a4
Compare
It serves both the webserver as "tusd", the resumable upload part of the API. This repository in combination with bananas-server allows you to run your own BaNaNaS from scratch.
30e27a4
to
f2ad9d5
Compare
The idea is that when-ever we find anything passing validation where it shouldn't, we add an entry. To make this somewhat sane, a custom regression-language was created where you can target the API in a simple human-readable way. The drawback is that it can be difficult to see what the real calls are that are being made. This is a balance between being able to motivate people to write regressions and being very verbose in case the regression fails.
f2ad9d5
to
1c68c2b
Compare
It serves both the webserver as "tusd", the resumable upload part
of the API.
This repository in combination with bananas-server allows you to
run your own BaNaNaS from scratch.