Giter Club home page Giter Club logo

rebblestore-api's Introduction

Repo archived

Moved to python implementation: https://github.com/pebble-dev/rebble-appstore-api

Rebble Store for pebble Backend/API

The Rebble Store is a Pebble Appstore replacement. If you want to contribute join us on the Pebble Dev Discord server, then head to #appstore.

Requirements

Backend/API layer requires git, go, npm, and apib2swagger.

To make the backend do anything, you also need to download a copy of the Pebble App Store. You can already start downloading it here while you setup the development environment.

Dev Environment Setup

Pull down the project within your $GOPATH's src folder ($GOPATH is an environment variable and is typically set to $HOME/go/ on *nix). This can be done by running (for example) the following set of commands:

# export GOPATH=~/go/ # Optional if your didn't move your ~/go directory
mkdir -p $GOPATH/src/pebble-dev
git clone https://github.com/pebble-dev/rebblestore-api.git $GOPATH/src/pebble-dev/rebblestore-api

Build Process

Backend

  1. If you haven't already, you will need to run go get -v . within the project directory;
  2. Run either make to build everything, or go build -v . to just build the go executable;
  3. You can run the api with ./rebblestore-api, or run the tests with ./rebblestore-api-tests.

Database

Instructions to setup the database:

  1. If you haven't already, download a copy of the Pebble App Store by using this tool. To ease the load on fitbit's servers, you can download it directly here;
  2. Extract the PebbleAppStore folder to the project directory: tar -xzf PebbleAppStore.tar.gz -C $GOPATH/src/pebble-dev/rebblestore-api;
  3. Start ./rebblestore-api and access http://localhost:8080/admin/rebuild/db to rebuild the database.

Contributing

How Do I Help?

Everyone is welcome to help. Efforts are coordinated in the issues tab, and in the Discord Server in the channel #appstore.

If this is your first time contributing to an Open-Source project, you can read this article to familiarize yourself with the process.

Please format your code with go fmt and run go test before committing your changes. Some editor plugins (such as vim-go) should be able to do this automatically before save.

Code Structure

  • The core of the backend is an HTTP server powered by Go's http library as well as the gorilla/mux URL router and dispatcher;
  • URLs are routed in routes.go (each URL gets its custom handler across multiple files);
  • When a valid URL is accessed, the corresponding handler is called. For example, {server}/admin/version is served by AdminVersionHandler in admin.go;
  • admin.go serves the database builder (used the first time you run the backend, or every time you add new columns to the DB that require data from the Pebble App Store archive);
  • application.go defines application structures (namely RebbleApplication), populates them, and handles most requests pertaining to the applications themselves;
  • boot.go handles the mobile application URI bootstrap, as described on the wiki.

rebblestore-api's People

Contributors

avamander avatar frostyfrog avatar henrydelmal avatar j2ko avatar modrzew avatar phpeter avatar sgerli 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rebblestore-api's Issues

Support Rebble-Auth

Make a multi level login system with: developer, moderator/curator, and administrator.

Database engine + schema changes

The project currently uses SQLite as its database engine, however according to Katharine it will likely use Postgres in prod.

This means that we have to change (at the very least) all the data types (as SQLite only uses NULL, INTEGER, REAL, TEXT and BLOB).

We should also consider how to implement schema changes in the future.

Api-Ui Functions Proposal

Rebble Store Api UI Functions Proposal V1.2

This is a proposal for communication between Ui and Api for the Rebble Store.

UI Communication

The Api should have various functions for communicating with the Vue.js UI, I propose this ones:

  • getHome(platform, isApp) (isApp is used to identify if we are talking about the watchface home or app home) this should return this:

    {
      "slider": [
        {
          "imageURL": "http://example.com/image.png",
          "altText": "My Featured",
          "id": 75 // ID is then used to link this banner with the collection
        },
        {
          "imageURL": "http://example.com/image.png",
          "altText": "My Featured",
          "slideId": 75 // ID is then used to link this banner with the collection
        }
      ],
      "appCollections": [
        {
          "headerTitle": "Fresh Picks",
          "id": 76576, // Again used to link with the app collection
          "cards": [ // Should only return 8 cards
            {
              "title": "My App",
              "isApp": true, // This is to decide screenshot/icon size
              "imageUrl": "http://example.com/image.png",
         	  "thumbsUp": 24,
              "id": 32 // To link with the app-detail page, this id is unique for each app
            },
            {
              "title": "My App",
              "isApp": true, // This is to decide screenshot/icon size
              "imageUrl": "http://example.com/image.png",
         	  "thumbsUp": 24,
              "id": 32
            }
          ]
        },
        {
          "headerTitle": "All Apps", // This should always come but it should be the last item
          "id": 765346,
          "cards": [ // Should only return 8 cards
            {
              "title": "My App",
              "isApp": true, // This is to decide screenshot/icon size
              "imageUrl": "http://example.com/image.png",
         	  "thumbsUp": 24,
              "id": 32
            },
            {
              "title": "My App",
              "isApp": true, // This is to decide screenshot/icon size
              "imageUrl": "http://example.com/image.png",
         	  "thumbsUp": 24,
              "id": 32
            }
          ]
        }
      ]
    }

  • getCollection(id, platform, page, popular) (popular is a boolean it only is valid in tags (categories), in any other case it should be ignored used to change order from Popular to New Releases) this should return:

    {
      "cards" :[ // Each page should not contain more than 12 cards
      	{
         "title": "My App",
         "isApp": true, // This is to decide screenshot/icon size
         "imageUrl": "http://example.com/image.png",
         "thumbsUp": 24,
         "id": 32
       },
       {
         "title": "My App",
         "isApp": true, // This is to decide screenshot/icon size
         "imageUrl": "http://example.com/image.png",
         "thumbsUp": 24,
         "id": 32
      }
     ]
    }
  • getTags(n, platform) (n is the number of tags to get (most popular first)) should return:

    {
      "tags": [
        {
          "title": "Games",
          "id": 324 //App Collection ID
        },
        {
          "title": "Daily",
          "id": 324 //App Collection ID
        }
      ]
    }

  • getApp(id, platform) (if platform is blank it will be ignored and basalt will be selected by default) it should return:

{
  "title": "Smarty Weather",
  "assets": {
  "screeenshots": [
    	{
      		"imageUrl": "http://example.com/image.png"
    	},
    	{
      		"imageUrl": "http://example.com/image2.png"
    	}
  	],
    "appBanner": "http://example.com/banner.png",
    "appIcon": "http://example.com/icon.png" // Only if it's an app
  },
  "description": "My large description",
  "author" {
  	"name": "Stefano Gerli"
    "id": 65
  }
  "appInfo": {
    "pbwUrl": "http://example.com/app.pbw"
    "rebbleReady": true, // True if the developer has authorized us to distribute his app
    "updated": "Dec 7 2016",
    "version": "4.4",
    "tags": [
    	{
      		"title": "Games",
      		"id": 324 //App Collection ID
    	},
    	{
      		"title": "Daily",
      		"id": 324 //App Collection ID
    	}
  	],
    "supportUrl": "http://support.example.com",
    "authorUrl": "http://example.com"
  }
}
  • getAppVersions(id) this should return:

    {
      "versions": [
        {
          "number": "4.4",
          "releaseDate": "Dec 7, 2016",
          "description": "My changelog 7"
        },
        {
          "number": "4.3",
          "releaseDate": "Dec 4, 2016",
          "description": "My changelog 1"
        }
      ]
    }

  • getSearchResults(searchQuery, platform) this should return:

    {
      "successful": true, // false when no result was found
      "cards" :[ // Each page should not contain more than 12 cards
      	{
         "title": "My App",
         "isApp": true, // This is to decide screenshot/icon size
         "imageUrl": "http://example.com/image.png",
         "thumbsUp": 24,
         "id": 32
       },
       {
         "title": "My App",
         "isApp": true, // This is to decide screenshot/icon size
         "imageUrl": "http://example.com/image.png",
         "thumbsUp": 24,
         "id": 32
      }
     ]
    }
  • Collections (card collection, this name comes from the Vue UI) are groups of apps (Featured, fresh picks, and tags)

  • Tags are our replacement to app categories they have an id that is also a reference to a collection).

  • There are only 3 types of id:

  1. App Collection (for features, tags, banner slides)
  2. App Id
  3. Author Id
  • Platform should be: aplite, basalt, chalk, or diorite.

  • I'm still missing the thumbs up add on and remove one and also a way to fetch them for the app details page.

  • I want to hear what do you think and what can we change to make it better.

Pagination

Adding page numbers and platform to getAuthor (get it on par with getCollections).
Also heck if any other endpoints are missing pagination

Conflicting ports with the front-end

Currently, both projects use localhost:8080 as the default address, which is fine as long as only one is being worked on at a time.

Furthermore, boot.go references https://santoku.adamfourney.com (STORE_URI), which doesn't exist right now.

If one of the projects changed its default port to 8081 or something, it would make it easier to work with both projects, and allow to update STORE_URI to localhost:808(0/1).

Better tests

Right now, the test suite is quite lacking, and we should seriously consider completing it.

Replicate Pebble's API instead of using our own

This would make it much easier to reuse code written for Pebble's app store.

We also need to grab all the per-device variants, because apparently descriptions, header images and whatnot can vary per device.

How best to serve static resources

Right now the PBWs and images are still served from pebble's servers. Is there anything planned to serve static resources? I guess we will want a separate server with caching through AWS or something, but I don't know much about those things.

ping @Katharine

Like system

Implement a like system that allows logged-in users to like and remove their likes from apps and watchfaces.

Desired Backend Features

  • Ability to provide watchfaces page app lists

  • Ability for an anonymous (we have to moderate this to only allow a user to add one and only to remove the one he added) user to add or remove a thumbs up

  • Ability to provide watchfaces slider images/categories

  • Ability to provide apps page lists

  • Ability to provide apps slider images/categories

  • Ability to provide app tags

  • Ability to provide author page

  • Ability to make searches

  • Implement pagination or infinite scroll (with @pebble-dev/frontend )

  • Ability to provide app/watchface details

  • Ability to provide app versions

  • #21 Have an admin/curator login

  • Ability for admin/curator to add slider images

  • Ability for admin/curator to modify lists like featured apps

  • Ability for admin to add or delete apps

  • Ability for developers to make their archive apps Rebble Store Ready

  • Automatically fetch new apps from Pebble's App Store

  • Auto add archive tag to all Pebble App Store apps that are not Rebble Store Ready

  • Implement a DB that makes all of above work

Long term goals:

  • #2 Ability for developers to upload their apps

  • #3 Before a app shows up in the store it has to be approved

  • Add doomsday backup opt-in (boolean should be in the DB from the start)

All of this using an API like this one

App DB format

We need to figure out some form a schema to store app information in.

Curator panel endpoints

Featured and home page curating features. To make this work we first need to implement authentication.

Desired initial feature list:

  • Ability to create new featured collections.

  • Ability to change contents of a featured collection.

  • Ability to change home page slider images for apps and watchfaces.

  • Ability to modify the collections shown on the app and watchface homepages.

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.