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

MVP Opera support #5432

Merged
merged 7 commits into from
Nov 5, 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
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ app/assets/v2/js/lib/markdown-it.js
app/assets/v2/js/lib/highlight.js
app/assets/v2/js/lib/tooltip.js
app/assets/v2/js/lib/tweenlite.js
app/assets/v2/js/lib/web3.0.20.7.js
app/assets/v2/js/abi.js

app/assets/onepager/js/confetti.js
Expand Down
1 change: 1 addition & 0 deletions app/app/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def preprocess(request):
'raven_js_dsn': settings.SENTRY_JS_DSN,
'release': settings.RELEASE,
'env': settings.ENV,
'INFURA_V3_PROJECT_ID': settings.INFURA_V3_PROJECT_ID,
'email_key': email_key,
'orgs': profile.organizations if profile else [],
'profile_id': profile.id if profile else '',
Expand Down
1 change: 1 addition & 0 deletions app/assets/onepager/js/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ function sendTip(email, github_url, from_name, username, amount, comments_public
indicateMetamaskPopup();
if (isSendingETH) {
web3.eth.sendTransaction({
from: fromAccount,
to: destinationAccount,
value: amountInDenom,
gasPrice: web3.toHex(get_gas_price())
Expand Down
6,597 changes: 6,597 additions & 0 deletions app/assets/v2/js/lib/web3.0.20.7.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions app/assets/v2/js/metamask-approval.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ async function metamaskApproval() {
} catch (error) {
_alert('Permission to connect to metamask rejected. Allow gitcoin to connect to metamask.', 'warning');
}
window.removeEventListener('load', metamaskApproval);
ask_metamask_connection();
}
window.removeEventListener('load', metamaskApproval);
ask_metamask_connection();
}

window.addEventListener('load', metamaskApproval);
Expand Down
8 changes: 4 additions & 4 deletions app/assets/v2/js/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,9 +704,9 @@ var currentNetwork = function(network) {
'<a href="https://metamask.io/?utm_source=gitcoin.co&utm_medium=referral" target="_blank" rel="noopener noreferrer">Metamask</a>';
$('#current-network').text(gettext('Metamask Locked'));
$('#navbar-network-banner').html(info);
} else {
} else if (window.ethereum._metamask) {
info = gettext('Metamask not connected. ') +
'<button id="metamask_connect" onclick="approve_metamask()">Click here to connect to metamask</button>';
'<button id="metamask_connect" onclick="approve_metamask()">Click here to connect to metamask</button>';
$('#current-network').text(gettext('Metamask Not Connected'));
$('#navbar-network-banner').html(info);
}
Expand Down Expand Up @@ -745,9 +745,9 @@ var currentNetwork = function(network) {
'<a href="https://metamask.io/?utm_source=gitcoin.co&utm_medium=referral" target="_blank" rel="noopener noreferrer">Metamask</a>';
$('#current-network').text(gettext('Metamask Locked'));
$('#navbar-network-banner').html(info);
} else {
} else if (window.ethereum._metamask) {
info = gettext('Metamask not connected. ') +
'<button id="metamask_connect" onclick="approve_metamask()">Click here to connect to metamask</button>';
'<button id="metamask_connect" onclick="approve_metamask()">Click here to connect to metamask</button>';
$('#current-network').text(gettext('Metamask Not Connected'));
$('#navbar-network-banner').html(info);
}
Expand Down
2 changes: 1 addition & 1 deletion app/grants/templates/grants/cancel.html
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ <h5 class="font-subheader pb-2">{% trans "Gas Settings" %}</h5>

{% include 'shared/bottom_notification.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer_scripts.html' with ignore_inject_web3=1 %}
{% include 'shared/footer.html' %}
{% include 'grants/shared/shared_scripts.html' %}
</body>
Expand Down
2 changes: 1 addition & 1 deletion app/grants/templates/grants/detail/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
{% include 'shared/current_profile.html' %}
{% include 'shared/bottom_notification.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer_scripts.html' with ignore_inject_web3=1 %}
{% include 'shared/footer.html' %}
{% include 'grants/shared/shared_scripts.html' %}
</body>
Expand Down
2 changes: 1 addition & 1 deletion app/grants/templates/grants/fund.html
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ <h5 class="form__label">{% trans "Gas Settings" %}</h5>

{% include 'shared/bottom_notification.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer_scripts.html' with ignore_inject_web3=1 %}
{% include 'shared/footer.html' %}
{% include 'grants/shared/shared_scripts.html' %}

Expand Down
2 changes: 1 addition & 1 deletion app/grants/templates/grants/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ <h1 class="font-title-lg font-weight-semibold mt-4 mb-2">{% trans "This is not t
</div>
{% include 'shared/bottom_notification.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer_scripts.html' with ignore_inject_web3=1 %}
{% include 'shared/footer.html' %}
{% include 'grants/shared/shared_scripts.html' %}
</body>
Expand Down
2 changes: 1 addition & 1 deletion app/grants/templates/grants/new.html
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ <h5 class="font-subheader pb-2">{% trans "Gas Settings" %}</h5>
{% include 'shared/current_profile.html' %}
{% include 'shared/bottom_notification.html' %}
{% include 'shared/analytics.html' %}
{% include 'shared/footer_scripts.html' %}
{% include 'shared/footer_scripts.html' with ignore_inject_web3=1 %}
{% include 'shared/footer.html' %}
{% include 'grants/shared/shared_scripts.html' %}
</body>
Expand Down
5 changes: 5 additions & 0 deletions app/retail/templates/shared/footer_scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@
{% endif %}
<script src="{% static "cookielaw/js/cl.js" %}"></script>

{% if not ignore_inject_web3 %}
{% include 'shared/shared_scripts.html' %}
{% endif %}


<script>
var host = ("{{ ipfs_config.host }}" == "ipfs" ? "localhost" : "{{ ipfs_config.host }}");
var ipfsConfig = {
Expand Down
24 changes: 24 additions & 0 deletions app/retail/templates/shared/shared_scripts.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

{% comment %}
Copyright (C) 2018 Gitcoin Core

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

{% endcomment %}
{% load static %}

<script src="{% static "v2/js/lib/web3.0.20.7.min.js" %}"></script>
<script>
var web3 = window.web3 ? new Web3(window.web3.currentProvider) : new Web3(new Web3.providers.HttpProvider("https://mainnet.infura.io/v3/{{INFURA_V3_PROJECT_ID}}"));
</script>