Skip to content

Commit

Permalink
Bugfixes to Dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
tombh committed Feb 2, 2018
1 parent afca0dd commit cdab6bd
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 16 deletions.
20 changes: 14 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
FROM bitnami/minideb:stretch
RUN install_packages xvfb libgtk-3-0
RUN useradd user

RUN install_packages xvfb libgtk-3-0 curl ca-certificates bzip2 libdbus-glib-1-2
RUN useradd -m user
RUN su user
WORKDIR /home/user
ADD ./interfacer/contrib/setup_firefox.sh .
ENV HOME=/home/user
WORKDIR $HOME

# These are needed to detect versions
ADD .travis.yml .
ADD ./webext/manifest.json .

# Setup Firefox
ENV PATH="/home/user/bin/firefox:${PATH}"
ADD ./interfacer/contrib/setup_firefox.sh .
RUN ./setup_firefox.sh
RUN rm ./setup_firefox.sh && rm .travis.yml
ENV PATH="/home/user/firefox:${PATH}"
ADD ./webpack/manifest.json .

# Setup Browsh
ADD ./interfacer/contrib/setup_browsh.sh .
RUN ./setup_browsh.sh
RUN rm ./setup_browsh.sh && rm manifest.json
Expand Down
1 change: 1 addition & 0 deletions interfacer/.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ fpm:
release:
# Obviously need to remove this when we release properly. Hopefully very soon!
prerelease: true
draft: true
12 changes: 6 additions & 6 deletions interfacer/contrib/setup_browsh.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
# Browsh in the Dockerfile because that would require signing the webextension
# again, which can't be done as only one canonical release of a webextension is
# allowed by MDN per semantic version. It's actually quite good to not have to
# repeat the build process (after having done so in Travis after successfully
# passing tests). So we simply just download the already built binary :)
# repeat the build process (having done so in Travis after successfully
# passing tests). So we simply just download the already built binary.

PROJECT_ROOT=$(git rev-parse --show-toplevel)
if [ $? -eq 0 ]; then
manifest=$PROJECT_ROOT/webext/manifest.json
if [ ! -f manifest.json ]; then
PROJECT_ROOT=$(git rev-parse --show-toplevel)/webext
else
manifest=./manifest.json
PROJECT_ROOT=.
fi
manifest=$PROJECT_ROOT/manifest.json

line=$(cat $manifest | grep '"version"')
version=$(echo $line | grep -o '".*"' | cut -d " " -f 2 | sed 's/"//g')
Expand Down
7 changes: 6 additions & 1 deletion interfacer/contrib/setup_firefox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

set -ex

PROJECT_ROOT=$(git rev-parse --show-toplevel)
if [ ! -f .travis.yml ]; then
PROJECT_ROOT=$(git rev-parse --show-toplevel)
else
PROJECT_ROOT=.
fi

line=$(cat $PROJECT_ROOT/.travis.yml | grep 'firefox: "')
version=$(echo $line | grep -o '".*"' | cut -d " " -f 1 | sed 's/"//g')

Expand Down
24 changes: 24 additions & 0 deletions webext/contrib/download_xpi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// `npm install -g jsonwebtoken`
var jwt = require('jsonwebtoken');

var key = 'user:13243312:78';
var secret = process.env.MDN_KEY;

var issuedAt = Math.floor(Date.now() / 1000);
var payload = {
iss: key,
jti: Math.random().toString(),
iat: issuedAt,
exp: issuedAt + 60,
};

var token = jwt.sign(payload, secret, {
algorithm: 'HS256', // HMAC-SHA256 signing algorithm
});

var auth = 'JWT ' + token;
var path = '848208/browsh-0.2.3-an+fx.xpi';
var base = 'https://addons.mozilla.org/api/v3/file/';
var uri = base + path;

process.stdout.write('curl -H "Authorization: ' + auth + '" ' + uri);
2 changes: 1 addition & 1 deletion webext/dist/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Browsh",
"version": "0.2.3",
"version": "0.2.4",

"description": "Renders the browser as realtime, interactive, TTY-compatible text",

Expand Down
2 changes: 1 addition & 1 deletion webext/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Browsh",
"version": "0.2.3",
"version": "0.2.4",

"description": "Renders the browser as realtime, interactive, TTY-compatible text",

Expand Down
2 changes: 1 addition & 1 deletion webext/src/background/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export default class extends mixins(HubMixin, TTYCommandsMixin, TabCommandsMixin
this._pollAllTabs((tab) => {
this._ensureTabConnects(tab);
});
}, 100);
}, 1000);
}

_handleTabUpdate(_tab_id, changes, tab) {
Expand Down
1 change: 1 addition & 0 deletions webext/src/dom/frame_builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default class FrameBuilder extends BaseBuilder{
}

_setupInit() {
// TODO: Can we not just boot up as soon as we detect the background script?
document.addEventListener("DOMContentLoaded", () => {
this._init();
}, false);
Expand Down

0 comments on commit cdab6bd

Please sign in to comment.