Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use url params to unlock overclock #729

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<ng-container *ngIf="form != null">
<form [formGroup]="form">

<p-message *ngIf="settingsUnlocked" severity="warn" styleClass="w-full mb-3 py-4 border-round-xl"
text="Custom settings can cause damage & system instability. Only modify these settings if you understand the risks of running outside designed parameters.">
</p-message>

<ng-container *ngIf="!settingsUnlocked && restrictedModels.includes(ASICModel)">
<div class="field grid p-fluid">
<label class="col-12 mb-2 md:col-2 md:mb-0" htmlFor="frequency">Frequency</label>
Expand Down
30 changes: 22 additions & 8 deletions main/http_server/axe-os/src/app/components/edit/edit.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { startWith, Subject, takeUntil } from 'rxjs';
import { LoadingService } from 'src/app/services/loading.service';
import { SystemService } from 'src/app/services/system.service';
import { eASICModel } from 'src/models/enum/eASICModel';
import { ActivatedRoute } from '@angular/router';

@Component({
selector: 'app-edit',
Expand Down Expand Up @@ -124,13 +125,28 @@ export class EditComponent implements OnInit, OnDestroy {
private fb: FormBuilder,
private systemService: SystemService,
private toastr: ToastrService,
private loadingService: LoadingService
private loadingService: LoadingService,
private route: ActivatedRoute,
) {
// Add unlockSettings to window object for console access
(window as any).unlockSettings = () => {
this.settingsUnlocked = true;
console.log('Settings unlocked. You can now set custom frequency and voltage values.');
};
// Check URL parameter for settings unlock
this.route.queryParams.subscribe(params => {
this.settingsUnlocked = params['oc'] !== undefined;
if (this.settingsUnlocked) {
console.log(
'🎉 The ancient seals have been broken!\n' +
'⚡ Unlimited power flows through your miner...\n' +
'🔧 You can now set custom frequency and voltage values.\n' +
'⚠️ Remember: with great power comes great responsibility!'
);
} else {
console.log('🔒 Here be dragons! Advanced settings are locked for your protection. \n' +
'Only the bravest miners dare to venture forth... \n' +
'If you wish to unlock dangerous overclocking powers, add: %c?oc',
'color: #ff4400; text-decoration: underline; cursor: pointer; font-weight: bold;',
'to the current URL'
);
}
});
}

ngOnInit(): void {
Expand Down Expand Up @@ -166,8 +182,6 @@ export class EditComponent implements OnInit, OnDestroy {
}

ngOnDestroy(): void {
// Remove unlockSettings from window object
delete (window as any).unlockSettings;
this.destroy$.next();
this.destroy$.complete();
}
Expand Down
Loading