Merge pull request #332 from eReuse/feature/3683-wb-page2
add external mirror for download the workbench isos
This commit is contained in:
commit
45323cd932
|
@ -44,19 +44,17 @@
|
|||
|
||||
<div class="pt-6 pb-2">
|
||||
<h5 class="card-title text-center pb-0 fs-4">Workbench 2022</h5>
|
||||
{% if iso %}
|
||||
<div class="row pt-3">
|
||||
<div class="col-5">
|
||||
<a href="/static/iso/demo/{{ iso }}" class="btn btn-primary">{{ iso }}</a>
|
||||
<a href="{{ iso.demo.url }}/{{ iso.demo.iso }}" class="btn btn-primary">{{ iso.demo.iso }}</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="small">
|
||||
Download Checksum: <a class="help" href="/static/iso/demo/SHA512SUMS">SHA512SUMS</a> |
|
||||
Download Checksum: <a class="help" href="{{ iso.demo.url }}/SHA512SUMS">SHA512SUMS</a> |
|
||||
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a></p>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -115,14 +113,14 @@
|
|||
<br />
|
||||
<div class="row">
|
||||
<div class="col-5">
|
||||
<a href="/static/iso/{{ d }}/{{ v }}" class="btn btn-primary" style="width: 200px;">Get ISO file</a>
|
||||
<a href="{{ v.url }}/{{ v.iso }}" class="btn btn-primary" style="width: 200px;">Get ISO file</a>
|
||||
</div>
|
||||
<div class="col">
|
||||
<p class="small">
|
||||
{{ v }}
|
||||
{{ v.iso }}
|
||||
</p>
|
||||
<p class="small">
|
||||
Download Checksum: <a class="help" href="/static/iso/{{ d }}/SHA512SUMS">SHA512SUMS</a> |
|
||||
Download Checksum: <a class="help" href="{{ v.url }}/SHA512SUMS">SHA512SUMS</a> |
|
||||
<a href="https://help.usody.com/es/setup/setup-pendrive/" target="_blank" class="help">Help</a></p>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
isos = {
|
||||
"demo": {
|
||||
'iso': "USODY_2022.5.2-beta.iso",
|
||||
'url': 'http://releases.usody.com/demo/',
|
||||
},
|
||||
"2022": {
|
||||
'iso': "USODY_2022.5.2-beta.iso",
|
||||
'url': 'http://releases.usody.com//2022/',
|
||||
},
|
||||
"v14": {'iso': "USODY_14.0.0.iso", 'url': 'http://releases.usody.com/v14/'},
|
||||
}
|
|
@ -1,6 +1,4 @@
|
|||
import os
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import flask
|
||||
from flask import Blueprint
|
||||
|
@ -13,6 +11,7 @@ from ereuse_devicehub.db import db
|
|||
from ereuse_devicehub.resources.enums import SessionType
|
||||
from ereuse_devicehub.resources.user.models import Session
|
||||
from ereuse_devicehub.views import GenericMixin
|
||||
from ereuse_devicehub.workbench import isos
|
||||
|
||||
workbench = Blueprint('workbench', __name__, url_prefix='/workbench')
|
||||
|
||||
|
@ -28,9 +27,9 @@ class SettingsView(GenericMixin):
|
|||
{
|
||||
'page_title': self.page_title,
|
||||
'demo': g.user.email == app.config['EMAIL_DEMO'],
|
||||
'iso': isos,
|
||||
}
|
||||
)
|
||||
self.get_iso()
|
||||
|
||||
self.opt = request.values.get('opt')
|
||||
if self.opt in ['register', 'erease_basic', 'erease_sectors']:
|
||||
|
@ -38,30 +37,6 @@ class SettingsView(GenericMixin):
|
|||
|
||||
return flask.render_template(self.template_name, **self.context)
|
||||
|
||||
def get_iso(self):
|
||||
path = Path(__file__).parent.parent
|
||||
uri = f'{path}/static/iso/'
|
||||
if self.context.get('demo'):
|
||||
uri = f'{path}/static/iso/demo/'
|
||||
|
||||
self.context['iso'] = {}
|
||||
|
||||
if not os.path.exists(uri):
|
||||
return
|
||||
|
||||
versions = os.listdir(f'{path}/static/iso/')
|
||||
versions.sort()
|
||||
|
||||
for d in versions:
|
||||
dir_iso = f'{uri}/{d}'
|
||||
if not os.path.isdir(dir_iso):
|
||||
continue
|
||||
|
||||
files = [f for f in os.listdir(dir_iso) if f[-3:].lower() == 'iso']
|
||||
|
||||
if files:
|
||||
self.context['iso'][f'{d}'] = files[0]
|
||||
|
||||
def download(self):
|
||||
url = "https://{}/api/inventory/".format(app.config['HOST'])
|
||||
self.wbContext = {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import csv
|
||||
import datetime
|
||||
import json
|
||||
from io import BytesIO
|
||||
|
|
Reference in New Issue