Skip to content
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

Merge Armoria API with Armoria UI #6

Open
Azgaar opened this issue Sep 21, 2023 · 9 comments
Open

Merge Armoria API with Armoria UI #6

Azgaar opened this issue Sep 21, 2023 · 9 comments
Assignees

Comments

@Azgaar
Copy link
Owner

Azgaar commented Sep 21, 2023

There is no real need in Armoria API being a separate project. The maintenance has a cost (both time and money), while a separate project doesn't provide any value.

We can create a single SvelkeKit project and move the API there as well as UI. Can deploy for free on Vercel

Issues:

  • it will take time, at least 1-2 weeks
  • url will charge, so need to do a fix in FMG and Watabou's City Generator (and other users if any)
  • Armoria API is currently hosted on Heroku. We would need to add a redirect there for some time, but not long as Heroku is not free

Benefits:

  • Single codebase, easy to manage
  • Close to 0 maintenance for the API
  • Free hosting
  • Same infrastructure and framework as for Deorum
@Azgaar Azgaar self-assigned this Sep 21, 2023
@Azgaar
Copy link
Owner Author

Azgaar commented Sep 21, 2023

@Blipz, what do you think about it?

@Blipz
Copy link
Contributor

Blipz commented Sep 21, 2023

@Blipz, what do you think about it?

Always nice to reduce code duplication! If I understand correctly, renderers for UI and API would still be different, right?

@Azgaar
Copy link
Owner Author

Azgaar commented Sep 21, 2023

Yes, node.js cannot render as browser it doesn't have canvas API. So it will be basically the same

@Blipz
Copy link
Contributor

Blipz commented Jul 19, 2024

Yes, node.js cannot render as browser it doesn't have canvas API. So it will be basically the same

I'd suggest replacing resvg-js by a package using a headless browser, like https://www.npmjs.com/package/convert-svg-to-png. A quick test shows that this would solve all the feature inconsistencies between UI and API.

@Azgaar
Copy link
Owner Author

Azgaar commented Jul 19, 2024

Yes, node.js cannot render as browser it doesn't have canvas API. So it will be basically the same

I'd suggest replacing resvg-js by a package using a headless browser, like https://www.npmjs.com/package/convert-svg-to-png. A quick test shows that this would solve all the feature inconsistencies between UI and API.

Sounds interesting. Did you try it? I have a concern on how fast it can be, it should be pretty fast as it's an API.

@Blipz
Copy link
Contributor

Blipz commented Jul 19, 2024

Sounds interesting. Did you try it? I have a concern on how fast it can be, it should be pretty fast as it's an API.

Here are some metrics on my machine:

  • resvg-js runs in about 30ms
  • convert-svg-to-png runs in about 200ms if the converter instance is kept, or 1s if it is not

@Azgaar
Copy link
Owner Author

Azgaar commented Jul 19, 2024

200ms is acceptable, I believe. Yes, it would be nice to use chromium engine to render SVG, it will allow us to remove the code difference between 2 renderers.

@Blipz
Copy link
Contributor

Blipz commented Jul 19, 2024

It turns out the performance depends quite heavily on the size of the image (previous metrics were for 500x500), so I don't know how viable it will be in the end.

@Azgaar
Copy link
Owner Author

Azgaar commented Jul 19, 2024

500 is a good size. We can set a hard-coded limit to 1000px. If someone needs more, they will have to use SVG and render it manually at any size

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants