Commit 8f1671ed authored by David Seaward's avatar David Seaward
Browse files

Merge branch 'licensing' into 'master'

Licensing for GPL-2.0-or-later added.

See merge request liberty/ldh_client!2
parents 418583b3 e8568e40
File mode changed from 100755 to 100644
# Copying notice
Liberty CLI
<https://source.puri.sm/liberty/ldh_client>
Copyright 2017-2019 Purism SPC
SPDX-License-Identifier: AGPL-3.0-or-later
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/>.
## Notices for included code
All code is covered by and compatible with the "Copying notice" above.
Some code copied from other sources comes with additional notices. These
are listed below, and also appear in the files where that code appears.
---
Network-Manager tunnel setup code includes some code from
Network-Manager Pyhton examples: <br />
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/blob/master/examples/python/gi/vpn-import.py <br />
Copyright 2014 Red Hat, Inc.<br />
SPDX-License-Identifier: GPL-2.0-or-later
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 General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Copyright 2014 Red Hat, Inc.
#!/usr/bin/env python3
# Copyright 2017-2019 Purism SPC
# SPDX-License-Identifier: AGPL-3.0-or-later
# Original file from Network-Manager Python examples
# Copyright 2014 Red Hat, Inc.
# https://gitlab.freedesktop.org/NetworkManager/NetworkManager/blob/master/examples/python/gi/vpn-import.py
# SPDX-License-Identifier: GPL-2.0-or-later
import sys
import os
......@@ -6,12 +13,13 @@ import requests
import gi
from tempfile import mkstemp
from getpass import getpass
from json.decoder import JSONDecodeError
gi.require_version('NM', '1.0')
from gi.repository import NM, GLib
PROTO = 'https://'
HOST = 'librem.one'
PATH = '/tunnel/api/v1/get_user_creds'
PATH = '/api/v1/user/tunnel_account'
CERT_PATH = '/public/certificate.ovpn'
DOMAIN = 'librem.one'
QQN = 'US1'
......@@ -38,7 +46,10 @@ def nm_tunnel_setup():
sys.exit(1)
else:
print('\nSomething went wrong when connecting to', url)
detail = r.json().get('detail', 'No detail available')
try:
detail = r.json().get('detail', 'No detail available')
except JSONDecodeError as e:
detail = r.reason
print('Problem details:', detail)
sys.exit(1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment