Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
possible fix against data truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
7nik committed Sep 23, 2023
1 parent 24329ba commit 764f9a3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
20 changes: 12 additions & 8 deletions app/enhancements/addTradeEnhancementsSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type Scope = angular.IScope & {
updateVideoMuting: () => void,
replaceCheckmarkWithNumber: boolean,
updateCheckmarkReplacing: () => void,
serializedSettings: string,
serializedSettings: (ev: Event) => void,
loadSettings: (elem: HTMLInputElement) => void,
}

Expand Down Expand Up @@ -37,12 +37,15 @@ if (window.location.pathname.startsWith("/account/")) {
saveValue("replaceCheckmark", $scope.replaceCheckmarkWithNumber);
};

$scope.serializedSettings = "data:application/json,".concat(JSON.stringify({
openPromo: !$scope.disableAutoOpeningPromo,
muteVideo: $scope.muteVideo,
replaceCheckmark: $scope.replaceCheckmarkWithNumber,
filterSets: loadValue("filterSets", []),
}));
$scope.serializedSettings = (ev) => {
(ev.currentTarget as HTMLAnchorElement)
.href = URL.createObjectURL(new Blob([JSON.stringify({
openPromo: !$scope.disableAutoOpeningPromo,
muteVideo: $scope.muteVideo,
replaceCheckmark: $scope.replaceCheckmarkWithNumber,
filterSets: loadValue("filterSets", []),
})], { type: "application/json" }));
};
$scope.loadSettings = async (elem) => {
const [file] = elem.files ?? [];
if (!file) return;
Expand Down Expand Up @@ -136,8 +139,9 @@ if (window.location.pathname.startsWith("/account/")) {
Import/export NMTE settings
</h3>
<div style="display:flex;gap:10px;">
<a href={{serializedSettings}}
<a href=#
download="NMTE-settings.json"
ng-click=serializedSettings($event)
style="flex:1"
>
<button class="btn subdued" style="width:100%">Export settings</button>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "neonmob-trade-enhancements",
"version": "3.4.0",
"version": "3.4.1",
"private": true,
"description": "Adds enhancements to improve trading and usage experience",
"scripts": {
Expand Down

0 comments on commit 764f9a3

Please sign in to comment.