Compare commits

...

6 Commits

Author SHA1 Message Date
Rainer Killinger
e2d5d4f187 docs: update changelogs for release
ci: publish release
2024-10-18 16:52:57 +02:00
Rainer Killinger
496b50d892 fix: update jsonpath-plus depenency 2024-10-18 16:12:29 +02:00
e6c17c860b fix: id cards are wiped/replaced when an error happens in the pipe 2024-10-11 15:33:03 +02:00
Jovan Krunić
bb1f596bfc fix: enable starting the app without backend
Closes #223
2024-09-30 11:03:53 +00:00
0c49fd8c34 refactor: update nix dependencies 2024-09-30 13:00:59 +02:00
Thea Schöbl
ce5016a992 fix: text of the feedback form not fully visible
Closes #227
2024-09-18 09:53:50 +00:00
9 changed files with 207 additions and 106 deletions

View File

@@ -4,22 +4,37 @@
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils"; flake-utils.url = "github:numtide/flake-utils";
}; };
outputs = { outputs =
{
self, self,
nixpkgs, nixpkgs,
flake-utils, flake-utils,
}: let }:
let
aapt2buildToolsVersion = "33.0.2"; aapt2buildToolsVersion = "33.0.2";
in in
flake-utils.lib.eachDefaultSystem (system: let flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs { pkgs = import nixpkgs {
inherit system; inherit system;
overlays = [ overlays = [
(final: prev: rec { (final: prev: rec {
fontMin = prev.python311.withPackages (ps: with ps; [brotli fonttools] ++ (with fonttools.optional-dependencies; [woff])); fontMin = prev.python311.withPackages (
ps:
with ps;
[
brotli
fonttools
]
++ (with fonttools.optional-dependencies; [ woff ])
);
android = prev.androidenv.composeAndroidPackages { android = prev.androidenv.composeAndroidPackages {
buildToolsVersions = ["30.0.3" aapt2buildToolsVersion]; buildToolsVersions = [
platformVersions = ["33"]; "34.0.0"
aapt2buildToolsVersion
];
platformVersions = [ "34" ];
}; };
cypress = prev.cypress.overrideAttrs (cyPrev: rec { cypress = prev.cypress.overrideAttrs (cyPrev: rec {
version = "13.2.0"; version = "13.2.0";
@@ -29,6 +44,7 @@
}; };
}); });
nodejs = prev.nodejs_18; nodejs = prev.nodejs_18;
corepack = prev.corepack_18;
}) })
]; ];
config = { config = {
@@ -46,7 +62,8 @@
export LD_LIBRARY_PATH=/usr/lib:/usr/lib32 export LD_LIBRARY_PATH=/usr/lib:/usr/lib32
''; '';
}; };
in { in
{
devShell = pkgs.mkShell rec { devShell = pkgs.mkShell rec {
nativeBuildInputs = [ androidFhs ]; nativeBuildInputs = [ androidFhs ];
buildInputs = with pkgs; [ buildInputs = with pkgs; [
@@ -67,5 +84,6 @@
CYPRESS_INSTALL_BINARY = "0"; CYPRESS_INSTALL_BINARY = "0";
CYPRESS_RUN_BINARY = "${pkgs.cypress}/bin/Cypress"; CYPRESS_RUN_BINARY = "${pkgs.cypress}/bin/Cypress";
}; };
}); }
);
} }

View File

@@ -1,5 +1,11 @@
# @openstapps/app # @openstapps/app
## 3.3.3
### Patch Changes
- 496b50d8: Bug fixes and Android target sdk version is now 34
## 3.3.2 ## 3.3.2
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@openstapps/app", "name": "@openstapps/app",
"description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.", "description": "The generic app tailored to fulfill needs of German universities, written using Ionic Framework.",
"version": "3.3.2", "version": "3.3.3",
"private": true, "private": true,
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>", "author": "Karl-Philipp Wulfert <krlwlfrt@gmail.com>",
@@ -97,7 +97,7 @@
"form-data": "4.0.0", "form-data": "4.0.0",
"geojson": "0.5.0", "geojson": "0.5.0",
"ionic-appauth": "0.9.0", "ionic-appauth": "0.9.0",
"jsonpath-plus": "6.0.1", "jsonpath-plus": "10.0.6",
"maplibre-gl": "4.0.2", "maplibre-gl": "4.0.2",
"material-symbols": "0.17.1", "material-symbols": "0.17.1",
"moment": "2.30.1", "moment": "2.30.1",

View File

@@ -81,7 +81,6 @@ export class AuthHelperService {
user[key as keyof SCUserConfiguration] = JSONPath({ user[key as keyof SCUserConfiguration] = JSONPath({
path: this.userConfigurationMap[key as keyof SCUserConfiguration] as string, path: this.userConfigurationMap[key as keyof SCUserConfiguration] as string,
json: userInfo, json: userInfo,
preventEval: true,
})[0]; })[0];
} }
if (user.givenName && user.givenName.length > 0 && user.familyName && user.familyName.length > 0) { if (user.givenName && user.givenName.length > 0 && user.familyName && user.familyName.length > 0) {

View File

@@ -67,7 +67,8 @@ describe('ConfigProvider', () => {
it('should fetch app configuration', async () => { it('should fetch app configuration', async () => {
spyOn(configProvider.client, 'handshake').and.returnValue(Promise.resolve(sampleIndexResponse)); spyOn(configProvider.client, 'handshake').and.returnValue(Promise.resolve(sampleIndexResponse));
const result = await configProvider.fetch(); await configProvider.fetch();
const result = configProvider.config;
expect(result).toEqual(sampleIndexResponse); expect(result).toEqual(sampleIndexResponse);
}); });
@@ -110,7 +111,7 @@ describe('ConfigProvider', () => {
expect(storageProviderSpy.has).toHaveBeenCalled(); expect(storageProviderSpy.has).toHaveBeenCalled();
expect(storageProviderSpy.get).toHaveBeenCalledTimes(0); expect(storageProviderSpy.get).toHaveBeenCalledTimes(0);
expect(configProvider.client.handshake).toHaveBeenCalled(); expect(configProvider.client.handshake).toHaveBeenCalled();
expect(await configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name); expect(configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
}); });
it('should throw error on failed initialisation', async () => { it('should throw error on failed initialisation', async () => {
@@ -192,4 +193,31 @@ describe('ConfigProvider', () => {
expect(configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name); expect(configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
}); });
it('should fetch new config from remote on init', async () => {
storageProviderSpy.has.and.returnValue(Promise.resolve(true));
storageProviderSpy.get.and.returnValue(Promise.resolve(sampleIndexResponse));
spyOn(configProvider, 'fetch');
await configProvider.init();
expect(configProvider.fetch).toHaveBeenCalled();
});
it('should update the local config with the one from remote', async () => {
storageProviderSpy.has.and.returnValue(Promise.resolve(true));
storageProviderSpy.get.and.returnValue(Promise.resolve(sampleIndexResponse));
const newConfig = structuredClone(sampleIndexResponse);
newConfig.app.name = 'New app name';
spyOn(configProvider.client, 'handshake').and.returnValue(Promise.resolve(newConfig));
await configProvider.init();
// Validate that the initial configuration is loaded
expect(configProvider.getValue('name')).toEqual(sampleIndexResponse.app.name);
// Fetch the new configuration from the remote
await configProvider.fetch();
// Validate that the new configuration is now set
expect(configProvider.getValue('name')).toEqual(newConfig.app.name);
});
}); });

View File

@@ -83,17 +83,20 @@ export class ConfigProvider {
/** /**
* Fetches configuration from backend * Fetches configuration from backend
*/ */
async fetch(): Promise<SCIndexResponse> { async fetch(): Promise<void> {
try { try {
const isOffline = await firstValueFrom(this.internetConnectionService.offline$); const isOffline = await firstValueFrom(this.internetConnectionService.offline$);
if (isOffline) { if (isOffline) {
throw new Error('Device is offline.'); throw new Error('Device is offline.');
} else { } else {
return await this.client.handshake(this.scVersion); const fetchedConfig: SCIndexResponse = await this.client.handshake(this.scVersion);
await this.set(fetchedConfig);
this.logger.log(`Configuration updated from remote`);
} }
} catch (error) { } catch (error) {
const error_ = error instanceof Error ? new ConfigFetchError(error.message) : new ConfigFetchError(); const error_ = error instanceof Error ? new ConfigFetchError(error.message) : new ConfigFetchError();
throw error_; this.logger.warn(`Failed to fetch remote configuration:`, error_);
throw error_; // Rethrow the error to handle it in init()
} }
} }
@@ -121,40 +124,33 @@ export class ConfigProvider {
/** /**
* Initialises the ConfigProvider * Initialises the ConfigProvider
* @throws ConfigInitError if no configuration could be loaded. * @throws ConfigInitError if no configuration could be loaded both locally and remote.
* @throws WrongConfigVersionInStorage if fetch failed and saved config has wrong SCVersion
*/ */
async init(): Promise<void> { async init(): Promise<void> {
let loadError;
let fetchError;
// load saved configuration
try { try {
// Attempt to load the configuration from local storage
this.config = await this.loadLocal(); this.config = await this.loadLocal();
this.firstSession = false; this.firstSession = false;
this.logger.log(`initialised configuration from storage`); this.logger.log(`initialised configuration from storage`);
// Check if the stored configuration has the correct version
if (this.config.backend.SCVersion.split('.')[0] !== this.scVersion.split('.')[0]) { if (this.config.backend.SCVersion.split('.')[0] !== this.scVersion.split('.')[0]) {
loadError = new WrongConfigVersionInStorage(this.scVersion, this.config.backend.SCVersion); throw new WrongConfigVersionInStorage(this.scVersion, this.config.backend.SCVersion);
} }
} catch (error) {
loadError = error; // Fetch the remote configuration in a non-blocking manner
} void this.fetch();
// fetch remote configuration from backend } catch (loadError) {
this.logger.warn(loadError);
try { try {
const fetchedConfig: SCIndexResponse = await this.fetch(); // If local loading fails, immediately try to fetch the configuration from remote
await this.set(fetchedConfig); await this.fetch();
this.logger.log(`initialised configuration from remote`); } catch (fetchError) {
} catch (error) { this.logger.warn(`Failed to fetch remote configuration:`, fetchError);
fetchError = error; // If both local loading and remote fetching fail, throw ConfigInitError
}
// check for occurred errors and throw them
if (loadError !== undefined && fetchError !== undefined) {
throw new ConfigInitError(); throw new ConfigInitError();
} }
if (loadError !== undefined) {
this.logger.warn(loadError);
}
if (fetchError !== undefined) {
this.logger.warn(fetchError);
} }
} }

View File

@@ -80,13 +80,12 @@
</ion-item> </ion-item>
<ion-item> <ion-item>
<ion-checkbox <ion-checkbox
class="ion-text-wrap"
color="primary" color="primary"
label-placement="end" label-placement="end"
justify="start" justify="start"
[(ngModel)]="termsAgree" [(ngModel)]="termsAgree"
name="termsAgree" name="termsAgree"
>{{ 'feedback.form.termsAgree.0' | translate }}</ion-checkbox ><span class="ion-text-wrap">{{ 'feedback.form.termsAgree.0' | translate }}</span></ion-checkbox
> >
</ion-item> </ion-item>
<ion-item lines="none"> <ion-item lines="none">
@@ -104,7 +103,9 @@
justify="start" justify="start"
[(ngModel)]="protocolDataAgree" [(ngModel)]="protocolDataAgree"
name="protocolDataAgree" name="protocolDataAgree"
>{{ 'feedback.form.protocolDataAgree' | translate }}</ion-checkbox ><span class="ion-text-wrap">{{
'feedback.form.protocolDataAgree' | translate
}}</span></ion-checkbox
> >
</ion-item> </ion-item>
<ion-card> <ion-card>

View File

@@ -41,7 +41,7 @@ export class IdCardsProvider {
mergeMap(user => this.fetchFallbackIdCards(user)), mergeMap(user => this.fetchFallbackIdCards(user)),
startWith([]), startWith([]),
) )
: of([]).pipe(tap(() => this.encryptedStorageProvider.delete('id-cards'))), : of([]).pipe(tap({next: () => this.encryptedStorageProvider.delete('id-cards')})),
), ),
); );
} }
@@ -54,7 +54,7 @@ export class IdCardsProvider {
}, },
responseType: 'json', responseType: 'json',
}) })
.pipe(tap(idCards => this.encryptedStorageProvider.set('id-cards', idCards))); .pipe(tap({next: idCards => this.encryptedStorageProvider.set('id-cards', idCards)}));
} }
private fetchFallbackIdCards(user: SCUserConfiguration): Observable<SCIdCard[]> { private fetchFallbackIdCards(user: SCUserConfiguration): Observable<SCIdCard[]> {

65
pnpm-lock.yaml generated
View File

@@ -837,8 +837,8 @@ importers:
specifier: 0.9.0 specifier: 0.9.0
version: 0.9.0(rxjs@7.8.1) version: 0.9.0(rxjs@7.8.1)
jsonpath-plus: jsonpath-plus:
specifier: 6.0.1 specifier: 10.0.6
version: 6.0.1 version: 10.0.6
maplibre-gl: maplibre-gl:
specifier: 4.0.2 specifier: 4.0.2
version: 4.0.2 version: 4.0.2
@@ -5522,7 +5522,7 @@ packages:
object-assign: 4.1.1 object-assign: 4.1.1
open: 8.4.0 open: 8.4.0
proxy-middleware: 0.15.0 proxy-middleware: 0.15.0
send: 0.18.0 send: 1.1.0
serve-index: 1.9.1 serve-index: 1.9.1
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
@@ -6971,6 +6971,24 @@ packages:
'@jridgewell/resolve-uri': 3.1.1 '@jridgewell/resolve-uri': 3.1.1
'@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/sourcemap-codec': 1.4.15
/@jsep-plugin/assignment@1.2.1(jsep@1.3.9):
resolution: {integrity: sha512-gaHqbubTi29aZpVbBlECRpmdia+L5/lh2BwtIJTmtxdbecEyyX/ejAOg7eQDGNvGOUmPY7Z2Yxdy9ioyH/VJeA==}
engines: {node: '>= 10.16.0'}
peerDependencies:
jsep: ^0.4.0||^1.0.0
dependencies:
jsep: 1.3.9
dev: false
/@jsep-plugin/regex@1.0.3(jsep@1.3.9):
resolution: {integrity: sha512-XfZgry4DwEZvSFtS/6Y+R48D7qJYJK6R9/yJFyUFHCIUMEEHuJ4X95TDgJp5QkmzfLYvapMPzskV5HpIDrREug==}
engines: {node: '>= 10.16.0'}
peerDependencies:
jsep: ^0.4.0||^1.0.0
dependencies:
jsep: 1.3.9
dev: false
/@leichtgewicht/ip-codec@2.0.5: /@leichtgewicht/ip-codec@2.0.5:
resolution: {integrity: sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==} resolution: {integrity: sha512-Vo+PSpZG2/fmgmiNzYK9qWRh8h/CHrwD0mo1h1DzL4yzHNSfWYujGTYsWGreD000gcgmZ7K4Ys6Tx9TxtsKdDw==}
dev: true dev: true
@@ -11966,6 +11984,11 @@ packages:
resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==} resolution: {integrity: sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==}
engines: {node: '>= 0.8'} engines: {node: '>= 0.8'}
/encodeurl@2.0.0:
resolution: {integrity: sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==}
engines: {node: '>= 0.8'}
dev: true
/encoding@0.1.13: /encoding@0.1.13:
resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==} resolution: {integrity: sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==}
requiresBuild: true requiresBuild: true
@@ -14920,6 +14943,11 @@ packages:
resolution: {integrity: sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==} resolution: {integrity: sha512-YtOli5Cmzy3q4dP26GraSOeAhqecewG04hoO8DY56CH4KJ9Fvv5qKWUCCo3HZob7esJQHCv6/+bnTy72xZZaVQ==}
engines: {node: '>=12.0.0'} engines: {node: '>=12.0.0'}
/jsep@1.3.9:
resolution: {integrity: sha512-i1rBX5N7VPl0eYb6+mHNp52sEuaS2Wi8CDYx1X5sn9naevL78+265XJqy1qENEk7mRKwS06NHpUqiBwR7qeodw==}
engines: {node: '>= 10.16.0'}
dev: false
/jsesc@0.5.0: /jsesc@0.5.0:
resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==} resolution: {integrity: sha512-uZz5UnB7u4T9LvwmFqXii7pZSouaRPorGs5who1Ip7VO0wxanFvBL7GkM6dTHlgX+jhBApRetaWpnDabOeTcnA==}
hasBin: true hasBin: true
@@ -15011,9 +15039,14 @@ packages:
engines: {'0': node >= 0.2.0} engines: {'0': node >= 0.2.0}
dev: true dev: true
/jsonpath-plus@6.0.1: /jsonpath-plus@10.0.6:
resolution: {integrity: sha512-EvGovdvau6FyLexFH2OeXfIITlgIbgZoAZe3usiySeaIDm5QS+A10DKNpaPBBqqRSZr2HN6HVNXxtwUAr2apEw==} resolution: {integrity: sha512-Q0KCash90S0WQnPnE/W0uVXQSww4NkO34COfs+gbq0fk+Kv03FYpZ+uU2I7soLLaS4d/ywsm9PxplZsTMmfBmg==}
engines: {node: '>=10.0.0'} engines: {node: '>=18.0.0'}
hasBin: true
dependencies:
'@jsep-plugin/assignment': 1.2.1(jsep@1.3.9)
'@jsep-plugin/regex': 1.0.3(jsep@1.3.9)
jsep: 1.3.9
dev: false dev: false
/jsonpointer@5.0.1: /jsonpointer@5.0.1:
@@ -18928,6 +18961,26 @@ packages:
transitivePeerDependencies: transitivePeerDependencies:
- supports-color - supports-color
/send@1.1.0:
resolution: {integrity: sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==}
engines: {node: '>= 18'}
dependencies:
debug: 4.3.6(supports-color@8.1.1)
destroy: 1.2.0
encodeurl: 2.0.0
escape-html: 1.0.3
etag: 1.8.1
fresh: 0.5.2
http-errors: 2.0.0
mime-types: 2.1.35
ms: 2.1.3
on-finished: 2.4.1
range-parser: 1.2.1
statuses: 2.0.1
transitivePeerDependencies:
- supports-color
dev: true
/serialize-javascript@6.0.0: /serialize-javascript@6.0.0:
resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==} resolution: {integrity: sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==}
dependencies: dependencies: