Skip to content

Commit 88b46d6

Browse files
committed
fix (grass.dockerfile, grass_main.py): improve logging for extension downloads backporting from grass-node code
1 parent 6973d46 commit 88b46d6

File tree

3 files changed

+452
-67
lines changed

3 files changed

+452
-67
lines changed

grass-node_main.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ def download_and_extract_extension(driver, extension_id, crx_download_url):
4444

4545
try:
4646
if crx_download_url.startswith('https://chromewebstore.google.com'):
47+
logging.info('Downloading the extension from the Chrome Web Store...')
4748
crx_file_path = download_from_chrome_webstore(extension_id, extension_dir)
4849
else:
50+
logging.info('Downloading the extension from the provider website...')
4951
crx_file_path = download_from_provider_website(driver, extension_id, crx_download_url, extension_dir)
5052

5153
logging.info(f"Extension extracted to {crx_file_path}")
@@ -70,13 +72,14 @@ def download_from_chrome_webstore(extension_id, extension_dir):
7072
Raises:
7173
subprocess.CalledProcessError: If there is an error during the download process.
7274
"""
73-
GIT_USERNAME = 'warren-bank'
74-
GIT_REPO = 'chrome-extension-downloader'
75+
GIT_USERNAME = 'sryze'
76+
GIT_REPO = 'crx-dl'
7577
logging.info(f'Using {GIT_USERNAME}/{GIT_REPO} to download the extension CRX file from the Chrome Web Store...')
7678
subprocess.run(["git", "clone", f"https://github.com/{GIT_USERNAME}/{GIT_REPO}.git"], check=True)
77-
subprocess.run(["chmod", "+x", f"./{GIT_REPO}/bin/*"], check=True)
79+
subprocess.run(["chmod", "+x", f"./{GIT_REPO}/crx-dl.py"], check=True)
7880
crx_file_path = os.path.join(extension_dir, f"{extension_id}.crx")
79-
subprocess.run([f"./{GIT_REPO}/bin/crxdl", extension_id, crx_file_path], check=True)
81+
os.makedirs(extension_dir, exist_ok=True)
82+
subprocess.run(["python3", f"./{GIT_REPO}/crx-dl.py", f"-o={crx_file_path}", extension_id], check=True)
8083
return crx_file_path
8184

8285

grass.dockerfile

+11
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,20 @@ FROM debian:stable-slim
33
# Set environment variables
44
ENV EXTENSION_ID=ilehaonighjijnmpnagapkhpcdbhclfg
55
ENV EXTENSION_URL='https://app.getgrass.io/'
6+
ENV CRX_DOWNLOAD_URLS='https://chromewebstore.google.com/detail/grass-lite-node/ilehaonighjijnmpnagapkhpcdbhclfg'
67
ENV GIT_USERNAME=sryze
78
ENV GIT_REPO=crx-dl
89

10+
# Comma-separated list of extension IDs (extension chrome webstore id)
11+
ENV EXTENSION_IDS=${EXTENSION_ID}
12+
# Comma-separated list of extension URLs (app dashboard website url)
13+
ENV EXTENSION_URLS=${EXTENSION_URL}
14+
# Comma-separated list of CRX download URLs (either direct URLs or Chrome Web Store URLs)
15+
ENV CRX_DOWNLOAD_URLS=${CRX_DOWNLOAD_URLS}
16+
# In case of error multiply all backoff-timings of this value
17+
ENV MAX_RETRY_MULTIPLIER=3
18+
19+
920
# Install necessary packages then clean up to reduce image size
1021
RUN apt update && \
1122
apt upgrade -y && \

0 commit comments

Comments
 (0)