Giter Site home page Giter Site logo

nielsmaerten / peppermint Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 30.66 MB

Nature's most beautiful wallpapers, right in your Dropbox

Home Page: https://peppermint.pw

Dockerfile 2.72% JavaScript 21.45% TypeScript 64.27% HTML 11.56%
dropbox earthporn nature reddit wallpapers

peppermint's People

Contributors

dependabot[bot] avatar greenkeeper[bot] avatar greenkeeperio-bot avatar nielsmaerten avatar

Watchers

 avatar

peppermint's Issues

Lookup credits of an image

Users should be able to look up who originally uploaded an image to Reddit.
Eg, they should be able to find the original post and author

Memory limit exceeded

Might this be due to JPG files not being deleted from the temp folder? After all, all 'disk' writes are actually stored in memory. So we should clean up after ourselves when a function quits, bc the env may be reused but a new request

Properties of a new image

When a new image is added to the Masterlist, a handler should:

  • Get the width and height of the new image
  • Store this information with the image (?)

Firebase.config() not available

admin.initializeApp(functions.config().firebase)

Config () is not available at this point, when running on Cloud Functions.
Weirdly, it is available in the index.js file at the root of the functions folder...

Can I make it available here? Or do I need to grab the config at function init time, and store it somewhere so it can be used here?

Save image to user's dropbox

When a new image is added to the personal list of a user, it triggers the onNewUserImage function, which should add the image to the dropbox of that user

Create a webpage

Create a webpage explaining what Peppermint does, and where users can connect their dropbox to the service

Database performance code smell

if (!await firebase.getPost(topPosts[i])) {

I don't like this. It's gonna make approx 20 calls to firebase in rapid succession. Even with firebase, that's probably not good. It might be better to fetch the entire list, and compare in memory. But of course, the list gets larger as time goes on... Ideally, only 1 query is fired containing all new IDs, and the response contains those not already in the database. Then search happens entirely in firebase itself.

Run maintenance on a user's dropbox

  • Check when the dropbox was last maintained, if > maintenance interval, continue maintenance
  • Remove all images that no longer meet the user's requirements* from the user's list
  • Remove all images that are no longer in the user's list from their dropbox
  • Update date last maintained

(*) Requirements can include: width, heigth, max-age, max-number-of-files (optional),...

Faster adding of new images from Reddit

Current behavior:

  • Top posts are fetched from Reddit
  • Masterlist is fetched from Firebase
  • Function iterates over the posts, and each post that's not in the Masterlist is added to Firebase

Needless to say, this is not efficient...

Suggested behavior:

  • Posts are fetched from Reddit
  • All posts are sent to Firebase using a batch update call

This would result in a null operation for posts that are already in the Masterlist, it's the same data, so nothing changes.
For posts that are not already in there, this will result in new nodes being created.
Triggering in turn the onNewMasterImage function, which will fill in the remaining details.

Query interested users

After a new image has been added to the Masterlist, we query which users are interested in this 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.