Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/deeplinks #155

Merged
merged 3 commits into from
Sep 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ansible/minio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,18 @@
- s3
- play
tags: mc-config

# This play has to run after minio is installed and buckets are configured
- hosts: minio
any_errors_fatal: true
become: true
gather_facts: true
tags: static-files
roles:
- role: minio-static-files
# Override these variables!
# FUTUREWORK: parse them from a configuration file shared with helm
# (as the domain needs to be known in helm override values.yaml)
prefix: "example-"
domain: "example.com"
deeplink_title: "example.com environment"
24 changes: 24 additions & 0 deletions ansible/roles/minio-static-files/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Deeplink configuration defaults
#
# This role requires the following variables to be set:
#
#prefix: example-
#domain: example.com
#deeplink_title: Example Environment

assetsURL: "https://{{ prefix }}s3.{{ domain }}"
deeplink_config_json: "{{ assetsURL }}/public/deeplink.json"
backendURL: "https://{{ prefix }}https.{{ domain }}"
backendWSURL: "https://{{ prefix }}ssl.{{ domain }}"
teamsURL: "https://{{ prefix }}team.{{ domain }}"
accountsURL: "https://{{ prefix }}account.{{ domain }}"

# FUTUREWORK:
# Note the website, for Wire, points to https://wire.com
# There is currently no equivalent for custom backends
# So all URLs in the mobile app that point to a url on the wire website will
# not work, as the default of 'www' points nowhere.
websiteURL: "https://{{ prefix }}www.{{ domain }}"

# This currently assumes android clients only
blackListURL: "{{ assetsURL }}/public/blacklist/android.json"
Copy link
Contributor

@tiago-loureiro tiago-loureiro Sep 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not just use {{ assetsURL }}/public/blacklist and let clients add the suffix?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I briefly looked into the code of android, and they seem to have "blacklistHost": "https://clientblacklist.wire.com/prod/android", i.e. the full path. If that changes, we can adapt this to be only a prefix.

4 changes: 4 additions & 0 deletions ansible/roles/minio-static-files/files/android.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"oldestAccepted": 322,
"blacklisted": [ 0, 108 ]
}
4 changes: 4 additions & 0 deletions ansible/roles/minio-static-files/files/ios.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"min_version": "1",
"exclude": ["1896", "1921", "1963", "1992", "2006", "2032", "2093", "2135", "2161", "2173", "2191", "2222", "2252", "2301", "2319", "2365", "2377", "2395", "2406", "2424", "2472", "2484", "2516", "2521", "2531", "2538", "2549", "2565", "2584", "2585", "2592", "2620", "2629", "2635", "2650", "2669", "2670", "2675", "2681", "2702", "2713", "2720", "2731", "2735", "2742", "2752", "2766", "2772", "2780", "2787", "2795", "2811"]
}
35 changes: 35 additions & 0 deletions ansible/roles/minio-static-files/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- name: "create deeplink template files"
template:
src: "{{ item }}.j2"
dest: "/tmp/{{ item }}"
run_once: true
with_items:
- deeplink.html
- deeplink.json
tags: deeplink

- name: "Add deeplink files to minio"
shell: "mc cp /tmp/{{ item }} local/public/{{ item }}"
run_once: true
with_items:
- deeplink.html
- deeplink.json
tags: deeplink

- name: "copy blacklist files"
copy:
src: "{{ item }}"
dest: "/tmp/{{ item }}"
run_once: true
with_items:
- android.json
- ios.json
tags: blacklist

- name: "Add blacklist files to minio"
shell: "mc cp /tmp/{{ item }} local/public/blacklist/{{ item }}"
run_once: true
with_items:
- android.json
- ios.json
tags: blacklist
12 changes: 12 additions & 0 deletions ansible/roles/minio-static-files/templates/deeplink.html.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>

<body>
<h1 align="left" style="font-family: Verdana, Geneva, sans-serif">
<a href="wire://access/?config={{ deeplink_config_json }}">CLICK ME TO CONFIGURE</a></h1>
<p> Clicking the above link will use the following json configuration file:
<code>wire://access/?config={{ deeplink_config_json }}</code></p>
</body>

</html>

11 changes: 11 additions & 0 deletions ansible/roles/minio-static-files/templates/deeplink.json.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"endpoints": {
"backendURL": "{{ backendURL }}",
"backendWSURL": "{{ backendWSURL }}",
"blackListURL": "{{ blackListURL }}",
"teamsURL": "{{ teamsURL }}",
"accountsURL": "{{ accountsURL }}",
"websiteURL": "{{ websiteURL }}"
},
"title": "{{ deeplink_title }}"
}