Git Product home page Git Product logo

random.dog's Introduction

random.dog

Build Status

The nodejs code behind random.dog

Prerequisites

  • node@^10.1.0
  • yarn@^1.6.0

Setup

Tests

  • yarn test
  • yarn tdd

Security Setup

  • /review requires a cookie named bone
    • The value should be some base64 encoded text that, when hashed with bcrypt, matches the hash stored in a file named secret.json located in the project root folder
    • The json in secret.json should be like this:
      • {"secret": "<put hash here>"}
    • Use bcrypt-cli to hash the password to store in the secret.json
    • Example cookie header:
      • Cookie: bone=cGFzc3dvcmQ=

API

On the GET /woof, GET /woof.json, and GET /doggos endpoints, you may add a query parameter called filter which should have 1 or more file extensions, separated by commas. When hitting any of the above 3 endpoints with the filter param, that endpoint will only return dogs that do not have one of the filtered extensions. There is also an include query param that does the opposite of filter.

Example: GET random.dog/woof?filter=mp4,webm will only return dogs that do not have an extension of mp4 or webm.

Example: GET random.dog/woof?include=mp4,webm will only return dogs that do have an extension of mp4 or webm.

random.dog's People

Contributors

adenflorian avatar hvaara avatar jorivanee 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  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  avatar

random.dog's Issues

Use the API to build an ios app

Hey Can I please use the app api and images to build an IOS version of random dog? it is so cute! I will credit you as co-authors!

Suggestion

Add a next button for people who don't know how to refresh a page

Docker Support

I currently have this in a docker container with traefik running separately as the reverse proxy working perfectly, can I push support for this to the repo?

API down

Looks like your API is down oof

Add an api endpoint to get a list of all the dog image paths

I was thinking something like either

http://random.dog/list.json that displays either something like:

{"list" : ["url1", "url2", "url3", ".etc"]}

or http://random.dog/list that displays just a straight array of values like:

["url1", "url2", "url3", ".etc"]

I am currently looking into itegrating your API into a web app and thought this would be a helpful feature to potentially reduce the number of calls to your API.

Thank you so much for this API. Please keep it around!

inclusive filter support

Most of time we need to specify which extensions we want to get.
I think the following filtering would be more intuitive:

/woof?filter=jpg,jpeg - return only dogs with jpg or jpeg ext.
/woof?exclude=mp4,webm - return dogs that don't have mp4 or webm ext.

but if backward compatibility is important, one solution is to keep current filter logic the same and add include query parameter. E.g:

/woof?filter=mp4,webm - return dogs that don't have mp4 or webm ext.
/woof?include=jpg,jpeg - return only dogs with jpg or jpeg ext.

priorities: if include specified, ignore filter

landscape or portrait

filter to return images by orientation.
sit or laydown -> portrait or landscape.
my less than perfect solution

.dog {
    border: 1px dashed green;
    width: 350px;
    height: 220px;
    object-fit: contain; 
    
    /* object-fit: scale-down; */
}

add an API endpoint to get smaller web-compatible images

As I said in my other issue (#5), I am currently integrating your API into a web app and I would like to suggest this as a feature so that my web app doesn't impact your hosting costs too much.

maybe you could add an API endpoint or something to automatically get a scaled-down version of the image (maybe a URL like https://random.dog/woof?width=200&height=200 to scale all images to 200x200px or something?

just an idea
-DeveloperACE

woof.png

Returns an png of said image.
That's all it does.

401 code

Hello Aden,

I'm a newbie who cloned your project for learning purposes. I'm running your app on my Cloud 9 development environment; the upload page works fine, but I'm not able to reach the root route (/) or the review route due to a 401 error.

Likely this has something to do with the secret.json file which I created with something random. I'm not sure how to comply with the checkhash function, not sure how to input a 'password'.

Please let me know if you could help.

PS: I also tried running it locally on my computer, without success.

Tks!

A way to filter out file types

Hey, I'd love a way to filter out filetypes like ".mp4" as they do not run on services I'd like to use this on. My proposal for this would be random.dog/woof?filter="mp4,png".

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.