Skip to content

Commit ed8509c

Browse files
committed
Change mime type for wasm
mime type forcing for wasm files
1 parent 7ae1eee commit ed8509c

File tree

9 files changed

+74
-57
lines changed

9 files changed

+74
-57
lines changed

frontend/httpd.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ LogLevel warn
498498
#
499499
AddType application/x-compress .Z
500500
AddType application/x-gzip .gz .tgz
501+
AddType application/wasm .wasm
501502

502503
#
503504
# AddHandler allows you to map certain file extensions to "handlers":

frontend/src/app/features/block-production/won-slots/block-production-won-slots.effects.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Injectable } from '@angular/core';
22
import { MinaState, selectMinaState } from '@app/app.setup';
33
import { Actions, createEffect, ofType } from '@ngrx/effects';
4-
import { Effect } from '@openmina/shared';
4+
import { Effect, isDesktop } from '@openmina/shared';
55
import { EMPTY, map, switchMap } from 'rxjs';
66
import { catchErrorAndRepeat2 } from '@shared/constants/store-functions';
77
import { MinaErrorType } from '@shared/types/error-preview/mina-error-type.enum';
@@ -47,7 +47,8 @@ export class BlockProductionWonSlotsEffects extends BaseEffect {
4747
? EMPTY
4848
: this.wonSlotsService.getSlots().pipe(
4949
switchMap(({ slots, epoch }) => {
50-
const activeSlotRoute = state.blockProduction[BLOCK_PRODUCTION_WON_SLOTS_KEY].activeSlotRoute;
50+
const bpState = state.blockProduction[BLOCK_PRODUCTION_WON_SLOTS_KEY];
51+
const activeSlotRoute = bpState.activeSlotRoute;
5152
let newActiveSlot = slots.find(s => s.globalSlot.toString() === activeSlotRoute);
5253
if (!activeSlotRoute || (activeSlotRoute && !newActiveSlot)) {
5354
newActiveSlot = slots.find(s => s.active)
@@ -56,7 +57,7 @@ export class BlockProductionWonSlotsEffects extends BaseEffect {
5657
?? null;
5758
}
5859
const routes: string[] = [Routes.BLOCK_PRODUCTION, Routes.WON_SLOTS];
59-
if (newActiveSlot) {
60+
if (newActiveSlot && isDesktop() || (activeSlotRoute && !bpState.activeSlot) || (activeSlotRoute && bpState.openSidePanel)) {
6061
routes.push(newActiveSlot.globalSlot.toString());
6162
}
6263
return fromPromise(this.router.navigate(routes, { queryParamsHandling: 'merge' })).pipe(map(() => ({

frontend/src/app/features/block-production/won-slots/block-production-won-slots.reducer.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { createReducer, on } from '@ngrx/store';
22
import { BlockProductionWonSlotsState } from '@block-production/won-slots/block-production-won-slots.state';
3-
import { isMobile, sort, SortDirection, TableSort } from '@openmina/shared';
3+
import { isDesktop, isMobile, sort, SortDirection, TableSort } from '@openmina/shared';
44
import { BlockProductionWonSlotsActions } from '@block-production/won-slots/block-production-won-slots.actions';
55
import {
66
BlockProductionWonSlotsSlot,
@@ -38,7 +38,7 @@ export const blockProductionWonSlotsReducer = createReducer(
3838
epoch,
3939
filteredSlots: filterSlots(sortSlots(slots, state.sort), state.filters),
4040
activeSlot,
41-
openSidePanel: !!activeSlot,
41+
openSidePanel: state.activeSlot ? state.openSidePanel : isDesktop(),
4242
})),
4343
on(BlockProductionWonSlotsActions.setActiveSlot, (state, { slot }) => ({
4444
...state,
@@ -56,7 +56,12 @@ export const blockProductionWonSlotsReducer = createReducer(
5656
filters,
5757
filteredSlots: filterSlots(sortSlots(state.slots, state.sort), filters),
5858
})),
59-
on(BlockProductionWonSlotsActions.toggleSidePanel, state => ({ ...state, openSidePanel: !state.openSidePanel })),
59+
on(BlockProductionWonSlotsActions.toggleSidePanel, state => ({
60+
...state,
61+
openSidePanel: !state.openSidePanel,
62+
activeSlot: !state.openSidePanel ? state.activeSlot : undefined,
63+
activeSlotRoute: !state.openSidePanel ? state.activeSlotRoute : undefined,
64+
})),
6065
on(BlockProductionWonSlotsActions.close, () => initialState),
6166
);
6267

frontend/src/app/features/block-production/won-slots/side-panel/block-production-won-slots-side-panel.component.ts

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
import {
2-
ChangeDetectionStrategy,
3-
Component,
4-
OnDestroy,
5-
OnInit,
6-
TemplateRef,
7-
ViewChild,
8-
ViewContainerRef,
9-
} from '@angular/core';
1+
import { ChangeDetectionStrategy, Component, OnDestroy, OnInit, TemplateRef, ViewChild, ViewContainerRef } from '@angular/core';
102
import { StoreDispatcher } from '@shared/base-classes/store-dispatcher.class';
113
import { BlockProductionWonSlotsSelectors } from '@block-production/won-slots/block-production-won-slots.state';
124
import {
@@ -15,19 +7,13 @@ import {
157
BlockProductionWonSlotTimes,
168
} from '@shared/types/block-production/won-slots/block-production-won-slots-slot.type';
179
import { getTimeDiff } from '@shared/helpers/date.helper';
18-
import {
19-
any,
20-
hasValue,
21-
isMobile,
22-
noMillisFormat,
23-
ONE_THOUSAND, safelyExecuteInBrowser,
24-
SecDurationConfig,
25-
toReadableDate,
26-
} from '@openmina/shared';
10+
import { any, hasValue, isMobile, noMillisFormat, ONE_THOUSAND, safelyExecuteInBrowser, SecDurationConfig, toReadableDate } from '@openmina/shared';
2711
import { filter } from 'rxjs';
2812
import { BlockProductionWonSlotsActions } from '@block-production/won-slots/block-production-won-slots.actions';
2913
import { AppSelectors } from '@app/app.state';
3014
import { AppNodeDetails } from '@shared/types/app/app-node-details.type';
15+
import { Router } from '@angular/router';
16+
import { Routes } from '@shared/enums/routes.enum';
3117

3218
@Component({
3319
selector: 'mina-block-production-won-slots-side-panel',
@@ -70,6 +56,8 @@ export class BlockProductionWonSlotsSidePanelComponent extends StoreDispatcher i
7056

7157
@ViewChild('discarded') private discardedTemplate: TemplateRef<void>;
7258

59+
constructor(private router: Router) {super();}
60+
7361
ngOnInit(): void {
7462
this.listenToActiveSlot();
7563
this.parseRemainingTime();
@@ -198,6 +186,7 @@ export class BlockProductionWonSlotsSidePanelComponent extends StoreDispatcher i
198186
}
199187

200188
closeSidePanel(): void {
189+
this.router.navigate([Routes.BLOCK_PRODUCTION, Routes.WON_SLOTS]);
201190
this.dispatch2(BlockProductionWonSlotsActions.toggleSidePanel());
202191
}
203192

frontend/src/app/features/webnode/web-node-not-supported/web-node-not-supported.component.html

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,16 @@
22
<img class="mina-svg" src="assets/images/logo/text-logo-text.svg" height="40" width="346"/>
33
</div>
44
@if (isPhone) {
5-
<div class="phone-content flex-column flex-around text-center">
6-
<div class="w-100 fx-col-vert-cent">
7-
<div class="headline">Your device isn't supported</div>
5+
<div class="phone-content flex-column align-center flex-center">
6+
<div class="ios fx-col-full-cent bg-warn-container f-400 warn-primary" (click)="addDevKey2()">iOS</div>
7+
<div class="ios-box w-100 fx-col-vert-cent text-center">
8+
<div class="headline">Your iOS {{ iOSVersion ?? '' }} isn't supported</div>
89
<div class="sub-headline tertiary">
9-
Unfortunately, iOS devices are not currently supported.
10-
</div>
11-
</div>
12-
13-
<div class="w-100 fx-col-vert-cent sub-headline">
14-
<div>Switch to one of the following platforms</div>
15-
<div class="img-wrapper flex-row align-center w-100 flex-center">
16-
<div class="fx-col-full-cent tertiary">
17-
<img src="assets/images/web-node-demo/windows.svg" alt="" class="mb-8" (click)="addDevKey(1)">
18-
Windows
19-
</div>
20-
<div class="fx-col-full-cent tertiary">
21-
<img src="assets/images/web-node-demo/android.svg" alt="" class="mb-8" (click)="addDevKey(2)">
22-
Android
23-
</div>
24-
<div class="fx-col-full-cent tertiary">
25-
<img src="assets/images/web-node-demo/macos.svg" alt="" class="mb-8" (click)="addDevKey(3)">
26-
MacOS
27-
</div>
10+
To use the Web Node please update your device to the latest iOS version.
2811
</div>
2912
</div>
3013

31-
<div class="w-100 fx-col-vert-cent sub-headline">And use Chrome, Edge, Safari or Brave</div>
14+
<button class="learn-btn w-100 f-600 f-14 h-xl fx-col-full-cent" (click)="howToUpdate()">Learn how to update</button>
3215
</div>
3316
} @else {
3417
<div class="browser-content flex-column flex-center text-center">

frontend/src/app/features/webnode/web-node-not-supported/web-node-not-supported.component.scss

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import 'openmina';
2+
13
.header {
24
height: 56px;
35

@@ -10,6 +12,27 @@
1012
.browser-content {
1113
height: calc(100% - 56px);
1214

15+
.ios {
16+
width: 96px;
17+
height: 96px;
18+
font-size: 30px;
19+
border-radius: 100px;
20+
}
21+
22+
.ios-box {
23+
margin-top: 40px;
24+
margin-bottom: 40px;
25+
padding: 0 32px;
26+
}
27+
28+
.learn-btn {
29+
background-color: $base-background;
30+
color: $base-primary;
31+
max-width: 330px;
32+
margin: 0 12px;
33+
filter: invert(1);
34+
}
35+
1336
.headline {
1437
font-size: 20px;
1538
line-height: 30px;

frontend/src/app/features/webnode/web-node-not-supported/web-node-not-supported.component.ts

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
22
import { Platform } from '@angular/cdk/platform';
3-
import { sendSentryEvent } from '@shared/helpers/webnode.helper';
3+
import { iOSversion, sendSentryEvent } from '@shared/helpers/webnode.helper';
4+
import { safelyExecuteInBrowser } from '@openmina/shared';
45

56
const code = [1, 2, 3, 2];
67

@@ -19,13 +20,23 @@ export class WebNodeNotSupportedComponent {
1920

2021
@Output() bypassUnsupportedDevice = new EventEmitter<void>();
2122

23+
iOSVersion: string = iOSversion().join('.');
2224
devMode: boolean = false;
2325
private codeVerifier: number[] = [];
2426

2527
constructor(private platform: Platform) {}
2628

29+
addDevKey2(): void {
30+
this.codeVerifier.push(code[this.codeVerifier.length]);
31+
this.checkCode();
32+
}
33+
2734
addDevKey(key: number): void {
2835
this.codeVerifier.push(key);
36+
this.checkCode();
37+
}
38+
39+
private checkCode(): void {
2940
if (this.codeVerifier.length === code.length) {
3041
if (this.codeVerifier.every((v, i) => v === code[i])) {
3142
this.devMode = true;
@@ -41,13 +52,8 @@ export class WebNodeNotSupportedComponent {
4152
this.bypassUnsupportedDevice.emit();
4253
}
4354
}
44-
}
4555

46-
function iOSversion(): number {
47-
if (/iP(hone|od|ad)/.test(navigator.platform)) {
48-
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
49-
const v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
50-
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || '0', 10)][0];
56+
howToUpdate(): void {
57+
safelyExecuteInBrowser(() => window.open('https://support.apple.com/en-us/118575', '_blank'));
5158
}
52-
return 0;
5359
}

frontend/src/app/features/webnode/webnode.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { StoreDispatcher } from '@shared/base-classes/store-dispatcher.class';
66
import { getMergedRoute, MergedRoute } from '@openmina/shared';
77
import { filter } from 'rxjs';
88
import { WebNodeService } from '@core/services/web-node.service';
9+
import { iOSversion } from '@shared/helpers/webnode.helper';
910

1011
@Component({
1112
selector: 'mina-webnode',
@@ -50,9 +51,8 @@ export class WebnodeComponent extends StoreDispatcher implements OnInit {
5051
}
5152

5253
private checkIfDeviceIsSupported(): void {
53-
5454
if (this.platform.IOS) {
55-
this.supported = false;
55+
this.supported = iOSversion()[0] >= 18;
5656
this.isPhone = true;
5757
return;
5858
}

frontend/src/app/shared/helpers/webnode.helper.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,12 @@ import { SeverityLevel } from '@sentry/angular';
44
export function sendSentryEvent(message: string, level: SeverityLevel = 'error'): void {
55
Sentry.captureEvent({ message: message, level, tags: { type: 'webnode' } });
66
}
7+
8+
export function iOSversion(): number[] {
9+
if (/iP(hone|od|ad)/.test(navigator.platform)) {
10+
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
11+
const v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
12+
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || '0', 10)];
13+
}
14+
return [0];
15+
}

0 commit comments

Comments
 (0)