API & Client - get application version from API

This commit is contained in:
Sam 2021-11-01 10:33:34 +01:00
parent 7f6f33a6aa
commit 9380034d37
14 changed files with 36 additions and 13 deletions

View File

@ -11,6 +11,7 @@ from flask_sqlalchemy import SQLAlchemy
from fittrackee.emails.email import Email
VERSION = __version__ = '0.4.9'
db = SQLAlchemy()
bcrypt = Bcrypt()
migrate = Migrate()

View File

@ -44,6 +44,7 @@ def get_application_config() -> Union[Dict, HttpResponse]:
"max_zip_file_size": 10485760,
"max_users": 0,
"map_attribution": "&copy; <a href=http://www.openstreetmap.org/copyright>OpenStreetMap</a> contributors"
"version": "0.4.9"
},
"status": "success"
}

View File

@ -7,7 +7,7 @@ from sqlalchemy.ext.declarative import DeclarativeMeta
from sqlalchemy.orm.mapper import Mapper
from sqlalchemy.orm.session import Session
from fittrackee import db
from fittrackee import VERSION, db
from fittrackee.users.models import User
BaseModel: DeclarativeMeta = db.Model
@ -40,6 +40,7 @@ class AppConfig(BaseModel):
'max_zip_file_size': self.max_zip_file_size,
'max_users': self.max_users,
'map_attribution': self.map_attribution,
'version': VERSION,
}

View File

@ -64,7 +64,7 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/img/workouts/mountains.svg"
},
{
"revision": "45170abcbb428b727d6c19c2ad2b035e",
"revision": "1bdce419e10d1064c38aceeaeb2222fd",
"url": "/index.html"
},
{
@ -80,8 +80,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/css/admin.c784857e.css"
},
{
"revision": "08e51982ad17cd69b5d3",
"url": "/static/css/app.6f17ce7a.css"
"revision": "7d41f2082ed42273f277",
"url": "/static/css/app.fc944b83.css"
},
{
"revision": "82c1118c918377daaa71a320ab8eea42",
@ -196,8 +196,8 @@ self.__precacheManifest = (self.__precacheManifest || []).concat([
"url": "/static/js/admin.b2c267a7.js"
},
{
"revision": "08e51982ad17cd69b5d3",
"url": "/static/js/app.cbc2c869.js"
"revision": "7d41f2082ed42273f277",
"url": "/static/js/app.f769a5c1.js"
},
{
"revision": "bd7d183c9f68e5f4027d",

View File

@ -14,7 +14,7 @@
importScripts("https://storage.googleapis.com/workbox-cdn/releases/4.3.1/workbox-sw.js");
importScripts(
"/precache-manifest.2384a8066007a7b5a9dea87ccb53b3f8.js"
"/precache-manifest.33b1081ef2ad6d2cfdbc250d48cb556e.js"
);
workbox.core.setCacheNameDetails({prefix: "fittrackee_client"});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,7 @@ import json
from flask import Flask
import fittrackee
from fittrackee.users.models import User
from ..api_test_case import ApiTestCaseMixin
@ -31,6 +32,7 @@ class TestGetConfig(ApiTestCaseMixin):
'target="_blank" rel="noopener noreferrer">OpenStreetMap</a> '
'contributors'
)
assert data['data']['version'] == fittrackee.__version__
def test_it_returns_error_if_application_has_no_config(
self, app_no_config: Flask, user_1_admin: User

View File

@ -19,7 +19,7 @@
<i class="fa fa-chevron-up" aria-hidden="true"></i>
</div>
</div>
<Footer />
<Footer v-if="appConfig" :version="appConfig ? appConfig.version : ''" />
</template>
<script lang="ts">

View File

@ -1,7 +1,10 @@
<template>
<div id="footer">
<div class="footer-items">
<div class="footer-item"><strong>FitTrackee</strong> vx.xx</div>
<div class="footer-item">
<strong>FitTrackee</strong>
v{{ version }}
</div>
<div class="footer-item bullet"></div>
<div class="footer-item">
<a
@ -34,6 +37,20 @@
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue'
export default defineComponent({
name: 'Footer',
props: {
version: {
type: String,
required: true,
},
},
})
</script>
<style scoped lang="scss">
@import '~@/scss/base';

View File

@ -14,6 +14,7 @@ export type TAppConfig = {
max_single_file_size: number
max_users: number
max_zip_file_size: number
version: string
}
export interface IApplication {