Coder Social home page Coder Social logo

atrifat / nsfw-detector-api Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 21.7 MB

A Simple PoC (Proof of Concept) of NSFW Detector API Server

License: MIT License

JavaScript 95.85% Dockerfile 4.15%
api nodejs nsfw nsfw-detection machine-learning nsfw-recognition tensorflowjs

nsfw-detector-api's People

Contributors

atrifat avatar

Stargazers

 avatar

Watchers

 avatar

nsfw-detector-api's Issues

[BUG] Cannot check image type properly in some image hosting service

Issue

Edge case, some image hosting service doesn't support HEAD method to probe whether image file is exists.
Example:

curl -X HEAD https://void.cat/d/3Kyd4r7uL8fYCNtWF354f1.webp -vv

will give error 404

* using HTTP/2
* h2h3 [:method: HEAD]
* h2h3 [:path: /d/3Kyd4r7uL8fYCNtWF354f1.webp]
* h2h3 [:scheme: https]
* h2h3 [:authority: void.cat]
* h2h3 [user-agent: curl/7.88.1]
* h2h3 [accept: */*]
* Using Stream ID: 1 (easy handle 0x564f82b5dc70)
> HEAD /d/3Kyd4r7uL8fYCNtWF354f1.webp HTTP/2
> Host: void.cat
> user-agent: curl/7.88.1
> accept: */*
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 404

while using GET will provide valid response:

> GET /d/3Kyd4r7uL8fYCNtWF354f1.webp HTTP/2
> Host: void.cat
> user-agent: curl/7.88.1
> accept: */*
> 
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
< HTTP/2 200 
< date: Mon, 18 Sep 2023 00:52:26 GMT
< content-type: image/webp
< accept-ranges: bytes
< cache-control: public,max-age=86400
< x-frame-options: SAMEORIGIN
< content-disposition: inline; filename="The-development-of-coffee-fruits.png"
< strict-transport-security: max-age=15724800; includeSubDomains

Solution

Add an optional environment variable such as ENABLE_CONTENT_TYPE_CHECK=false to control behavior of app whether to probe using HEAD to get content info or not.

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.