File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# rebble-cohorts
2- cohorts.rebble.io: The Rebble cohorts API
2+ cohorts.rebble.io: The Rebble cohorts API. It handles firmware delivery.
3+
4+ For archival, use ` /cohort?select=fw-all ` , which returns a list of all stored firmware.
35
46## Configuration
57
Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ def _latest_firmware(hardware, kind):
3333 )
3434
3535
36+ def _all_firmware ():
37+ return Firmware .query .order_by (Firmware .kind , Firmware .timestamp .desc ()).all ()
38+
39+
3640FW_BEELINE_FIELDS = {
3741 "mobilePlatform" : "user.mobile_platform" ,
3842 "mobileVersion" : "user.mobile_version" ,
@@ -67,6 +71,12 @@ def generate_fw():
6771 return response
6872
6973
74+ def generate_fw_all ():
75+ _add_fw_beeline_context ()
76+ response = [row .to_json (archival = True ) for row in _all_firmware ()]
77+ return response
78+
79+
7080generators = {
7181 "pipeline-api" : lambda : {"host" : "pipeline-api.rebble.io" },
7282 "linked-services" : lambda : {"enabled_providers" : []},
@@ -75,6 +85,7 @@ def generate_fw():
7585 "version" : 11 ,
7686 },
7787 "fw" : generate_fw ,
88+ "fw-all" : generate_fw_all ,
7889}
7990
8091
Original file line number Diff line number Diff line change @@ -16,14 +16,18 @@ class Firmware(db.Model):
1616 timestamp = db .Column (db .Integer , nullable = False )
1717 notes = db .Column (db .Text , nullable = True )
1818
19- def to_json (self ):
20- return {
19+ def to_json (self , archival : bool = False ):
20+ result = {
2121 "url" : self .url ,
2222 "sha-256" : self .sha256 ,
2323 "friendlyVersion" : self .version ,
2424 "timestamp" : self .timestamp ,
2525 "notes" : self .notes if self .notes else self .version ,
2626 }
27+ if archival :
28+ result ["kind" ] = self .kind
29+ result ["hardware" ] = self .hardware
30+ return result
2731
2832
2933db .Index (
You can’t perform that action at this time.
0 commit comments