Code Monkey home page Code Monkey logo

math-api's People

Contributors

carlotm avatar crossi36 avatar edoardocavazza avatar fquffio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

math-api's Issues

Getting "Unexpected token u in JSON at position 0" when ran POST request in POSTMAN

I get the following error when I execute the sample POST request provided, in POSTMAN:

{ "message": "Unexpected token u in JSON at position 0" }

Request:

POST /render HTTP/1.1
Host: localhost:3000
Accept: image/svg+xml
Content-Type: application/json
User-Agent: PostmanRuntime/7.15.0
Cache-Control: no-cache
Postman-Token: 2971d956-b4a9-43df-90d6-1d690b16c83f,d6ca15e5-1546-48c6-a7ec-04662a8d0286
Host: localhost:3000
accept-encoding: gzip, deflate
content-length: 60
Connection: keep-alive
cache-control: no-cache

{
"input": "latex",
"output": "svg",
"source": "x^2"
}

I searched around and it seems that the 'u' in because 'undefined' is being returned. Can I print the entire debug message to see what's going wrong?

Adjustable text color

Feature Request

I'm suggesting to add a parameter for changing the output text color (default: black). Maybe forcing a background color (instead of transparency) for png outputs could also be a useful option.

Reasoning

I mainly use a self-hosted math-api instance for quickly typing out formulas in chats that don't have native LaTeX rendering or a bot that can do that. Most online chat platforms render links to images directly as inline images in chat.

The discord mobile app offers a "super dark" oled theme with an all-black background. For users of the app, transparent PNGs with black text will just appear as an endless void.

Screenshots

Gallery

original image:
render
(I realize that using the github dark theme, you can barely see it)

"regular" (desktop) dark theme:
image
oled theme:
image

Getting region error when executing Cloudformation stack

I get this error from AWS:

Error occurred while GetObject. S3 Error Code: PermanentRedirect. S3 Error Message: The bucket is in this region: eu-west-1. Please use this region to retry the request (Service: AWSLambdaInternal; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 98fee368-384d-4ea6-8e39-e32cac3e5803)

I'm trying to create the stack in the us-east-1 region.

@fquffio any thoughts?

Migrate from Travis CI to GitHub actions

As GitHub Actions have become available more than a year ago, we would rather migrate our CI/CD workflow here and dismiss Travis CI.

  • Add workflow to run unit tests on push (see #19)
  • Add workflow to package CloudFormation template and upload artifacts to S3

We should probably also consider uploading the artifacts to more AWS regions… 🤔

Lambda runtimes from nodejs10.x onwards break PNG conversion

using as runtime node from version 10 (since nodejs8.10 cannot be used anymore) trying converting to PNG produces the following error:

{
    "errorType": "Error",
    "errorMessage": "write EPIPE",
    "code": "EPIPE",
    "errno": "EPIPE",
    "syscall": "write",
    "stack": [
        "Error: write EPIPE",
        "    at afterWriteDispatched (internal/stream_base_commons.js:156:25)",
        "    at writevGeneric (internal/stream_base_commons.js:139:3)",
        "    at Socket._writeGeneric (net.js:785:11)",
        "    at Socket._writev (net.js:794:8)",
        "    at doWrite (_stream_writable.js:401:12)",
        "    at clearBuffer (_stream_writable.js:519:5)",
        "    at Socket.Writable.uncork (_stream_writable.js:338:7)",
        "    at Socket.Writable.end (_stream_writable.js:590:10)",
        "    at Socket.end (net.js:591:31)",
        "    at writeBufferInChunks (/opt/nodejs/node_modules/svg2png/lib/svg2png.js:54:20)"
    ]
}

This seems to be a problem linked with PhantomJS (dependency of svg2png ), which can no longer be used directly in the Lambda environment as some system dependencies have been removed from the newer runtimes (eg. fontconfig)

In order to fix the problem an extra layer could be created to add the missing libs ( https://github.com/naeemshaikh27/phantom-lambda-fontconfig-pack ) or maybe the function body could be defined as container image

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.