parent
c4877046ab
commit
e78d014ed1
@ -1,4 +1,4 @@
|
|||||||
[run]
|
[run]
|
||||||
omit =
|
omit =
|
||||||
fittrackee_api/venv/*
|
fittrackee_api/.venv/*
|
||||||
fittrackee_api/fittrackee_api/tests/*
|
fittrackee_api/fittrackee_api/tests/*
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)
|
export REACT_APP_API_URL = http://$(HOST):$(API_PORT)
|
||||||
export REACT_APP_THUNDERFOREST_API_KEY=
|
export REACT_APP_THUNDERFOREST_API_KEY=
|
||||||
export WEATHER_API=
|
export WEATHER_API=
|
||||||
|
export REACT_APP_GPX_LIMIT_IMPORT=10
|
||||||
|
|
||||||
# for dev env
|
# for dev env
|
||||||
export CODACY_PROJECT_TOKEN=
|
export CODACY_PROJECT_TOKEN=
|
||||||
|
@ -6,7 +6,7 @@ from datetime import datetime, timedelta
|
|||||||
|
|
||||||
import gpxpy.gpx
|
import gpxpy.gpx
|
||||||
import pytz
|
import pytz
|
||||||
from fittrackee_api import db
|
from fittrackee_api import appLog, db
|
||||||
from flask import current_app
|
from flask import current_app
|
||||||
from sqlalchemy import exc
|
from sqlalchemy import exc
|
||||||
from staticmap import Line, StaticMap
|
from staticmap import Line, StaticMap
|
||||||
@ -368,10 +368,19 @@ def process_zip_archive(common_params, extract_dir):
|
|||||||
zip_ref.extractall(extract_dir)
|
zip_ref.extractall(extract_dir)
|
||||||
|
|
||||||
new_activities = []
|
new_activities = []
|
||||||
|
if os.getenv('REACT_APP_GPX_LIMIT_IMPORT').isdigit():
|
||||||
|
gpx_files_limit = int(os.getenv('REACT_APP_GPX_LIMIT_IMPORT'))
|
||||||
|
else:
|
||||||
|
gpx_files_limit = 10
|
||||||
|
appLog.error('GPX limit not configured, set to 10.')
|
||||||
|
gpx_files_ok = 0
|
||||||
|
|
||||||
for gpx_file in os.listdir(extract_dir):
|
for gpx_file in os.listdir(extract_dir):
|
||||||
if ('.' in gpx_file and gpx_file.rsplit('.', 1)[1].lower()
|
if ('.' in gpx_file and gpx_file.rsplit('.', 1)[1].lower()
|
||||||
in current_app.config.get('ACTIVITY_ALLOWED_EXTENSIONS')):
|
in current_app.config.get('ACTIVITY_ALLOWED_EXTENSIONS')):
|
||||||
|
gpx_files_ok += 1
|
||||||
|
if gpx_files_ok > gpx_files_limit:
|
||||||
|
break
|
||||||
file_path = os.path.join(extract_dir, gpx_file)
|
file_path = os.path.join(extract_dir, gpx_file)
|
||||||
params = common_params
|
params = common_params
|
||||||
params['file_path'] = file_path
|
params['file_path'] = file_path
|
||||||
|
@ -4,6 +4,7 @@ import { connect } from 'react-redux'
|
|||||||
import { setLoading } from '../../../actions/index'
|
import { setLoading } from '../../../actions/index'
|
||||||
import { addActivity, editActivity } from '../../../actions/activities'
|
import { addActivity, editActivity } from '../../../actions/activities'
|
||||||
import { history } from '../../../index'
|
import { history } from '../../../index'
|
||||||
|
import { gpxLimit } from '../../../utils'
|
||||||
|
|
||||||
|
|
||||||
function FormWithGpx (props) {
|
function FormWithGpx (props) {
|
||||||
@ -52,7 +53,8 @@ function FormWithGpx (props) {
|
|||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
<label>
|
<label>
|
||||||
<strong>gpx</strong> file or <strong>zip</strong>{' '}
|
<strong>gpx</strong> file or <strong>zip</strong>{' '}
|
||||||
file containing <strong>gpx</strong> (no folder inside):
|
file containing <strong>gpx</strong> (no folder inside, {
|
||||||
|
gpxLimit} files max):
|
||||||
<input
|
<input
|
||||||
accept=".gpx, .zip"
|
accept=".gpx, .zip"
|
||||||
className="form-control input-lg"
|
className="form-control input-lg"
|
||||||
|
@ -6,6 +6,7 @@ export const apiUrl = `${process.env.REACT_APP_API_URL}/api/`
|
|||||||
export const thunderforestApiKey = `${
|
export const thunderforestApiKey = `${
|
||||||
process.env.REACT_APP_THUNDERFOREST_API_KEY
|
process.env.REACT_APP_THUNDERFOREST_API_KEY
|
||||||
}`
|
}`
|
||||||
|
export const gpxLimit = `${process.env.REACT_APP_GPX_LIMIT_IMPORT}`
|
||||||
export const activityColors = [
|
export const activityColors = [
|
||||||
'#55a8a3',
|
'#55a8a3',
|
||||||
'#98C3A9',
|
'#98C3A9',
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
[pytest]
|
[pytest]
|
||||||
norecursedirs = fittrackee_api/venv
|
norecursedirs = fittrackee_api/.venv
|
||||||
|
Loading…
Reference in New Issue
Block a user