-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EG] Update the EG updater to allow sideloading (#4428)
Add h5vcc API options to skip checking if package signature matches our key and to set a custom URL to check for package updates. Implement the above features into the updater for non-gold builds only. Add a stub server for serving packages. b/325626249 Original change was reviewed here: #3938
- Loading branch information
Showing
11 changed files
with
289 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# server.py | ||
|
||
from flask import Flask, jsonify, send_file | ||
from hashlib import file_digest | ||
from os import path | ||
|
||
app = Flask(__name__) | ||
file_location = '/usr/local/google/home/<path_to_crx>/cobalt.crx' | ||
self_endpoint = 'http://127.0.0.1:5000' | ||
|
||
@app.route('/omaha/stub/health', methods=['GET']) | ||
def get_health(): | ||
return jsonify({'status': 'healthy'}) | ||
|
||
@app.route('/omaha/stub/update', methods=['POST']) | ||
def post_updates(): | ||
# Get SHA256 hash of the file being served. | ||
with open(file_location, 'rb') as f: | ||
digest = file_digest(f, 'sha256').hexdigest() | ||
filename = path.basename(f.name) | ||
|
||
# Populate the JSON response with required fields. | ||
update = {'response':{'protocol':'3.1','app':[{'appid':'{A9557415-DDCD-4948-8113-C643EFCF710C}','updatecheck':{'status':'ok','urls':{'url':[{'codebase': self_endpoint + '/omaha/stub/file/'}]},'manifest':{'version':'99.99.1030','packages':{'package':[{'hash_sha256':digest,'name':filename}]}}}}]}} | ||
|
||
# Add a prefix to the response data. | ||
response = jsonify(update) | ||
data = response.get_data(as_text=True) | ||
data = ")]}'" + data | ||
response.set_data(data) | ||
|
||
return response | ||
|
||
@app.route('/omaha/stub/file/cobalt.crx', methods=['GET']) | ||
def get_file(): | ||
return send_file(file_location) | ||
|
||
if __name__ == '__main__': | ||
app.run(debug=True) |