Compare commits
1 commit
5406ab49d7
...
2c9ce2bba2
Author | SHA1 | Date | |
---|---|---|---|
![]() |
2c9ce2bba2 |
2 changed files with 1 additions and 61 deletions
|
@ -13,7 +13,6 @@
|
||||||
export let miningPoolMap: Map<string, string>;
|
export let miningPoolMap: Map<string, string>;
|
||||||
|
|
||||||
let validBitaxe = false;
|
let validBitaxe = false;
|
||||||
let validLocalPool = false;
|
|
||||||
const testBitaxe = async () => {
|
const testBitaxe = async () => {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`http://${$settings.bitaxeHostname}/api/system/info`);
|
const response = await fetch(`http://${$settings.bitaxeHostname}/api/system/info`);
|
||||||
|
@ -62,49 +61,6 @@
|
||||||
miningPoolMap.get(pool) || pool,
|
miningPoolMap.get(pool) || pool,
|
||||||
pool
|
pool
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const testLocalPool = async () => {
|
|
||||||
try {
|
|
||||||
const controller = new AbortController();
|
|
||||||
const timeoutId = setTimeout(() => controller.abort(), 1000);
|
|
||||||
|
|
||||||
const response = await fetch(
|
|
||||||
`http://${$settings.localPoolEndpoint}/api/client/${$settings.miningPoolUser}`,
|
|
||||||
{ signal: controller.signal }
|
|
||||||
);
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
|
|
||||||
if (!response.ok) {
|
|
||||||
dispatch('showToast', {
|
|
||||||
color: 'danger',
|
|
||||||
text: `Failed to connect to local pool! status: ${response.status}`
|
|
||||||
});
|
|
||||||
validLocalPool = false;
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
|
|
||||||
const poolInfo = await response.json();
|
|
||||||
dispatch('showToast', {
|
|
||||||
color: 'success',
|
|
||||||
text: `Can connect to local public pool, ${poolInfo.workersCount} workers`
|
|
||||||
});
|
|
||||||
validLocalPool = true;
|
|
||||||
} catch (error) {
|
|
||||||
if (error.name === 'AbortError') {
|
|
||||||
dispatch('showToast', {
|
|
||||||
color: 'danger',
|
|
||||||
text: `Connection to local pool timed out after 1 second`
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
dispatch('showToast', {
|
|
||||||
color: 'danger',
|
|
||||||
text: `Failed to connect to local pool, check the endpoint and make sure you are connected to the same network.`
|
|
||||||
});
|
|
||||||
}
|
|
||||||
console.error('Failed to fetch local pool info:', error);
|
|
||||||
validLocalPool = false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -222,21 +178,6 @@
|
||||||
size={$uiSettings.inputSize}
|
size={$uiSettings.inputSize}
|
||||||
selectClass={$uiSettings.selectClass}
|
selectClass={$uiSettings.selectClass}
|
||||||
/>
|
/>
|
||||||
{#if $settings.miningPoolName === 'local_public_pool'}
|
|
||||||
<SettingsInput
|
|
||||||
id="localPoolEndpoint"
|
|
||||||
label={$_('section.settings.localPoolEndpoint', { default: 'Local Pool Endpoint' })}
|
|
||||||
bind:value={$settings.localPoolEndpoint}
|
|
||||||
placeholder="umbrel.local:2019"
|
|
||||||
required={true}
|
|
||||||
valid={validLocalPool}
|
|
||||||
size={$uiSettings.inputSize}
|
|
||||||
>
|
|
||||||
<Button type="button" color="success" on:click={testLocalPool}>
|
|
||||||
{$_('test', { default: 'Test' })}
|
|
||||||
</Button>
|
|
||||||
</SettingsInput>
|
|
||||||
{/if}
|
|
||||||
<SettingsInput
|
<SettingsInput
|
||||||
id="miningPoolUser"
|
id="miningPoolUser"
|
||||||
label={$_('section.settings.miningPoolUser')}
|
label={$_('section.settings.miningPoolUser')}
|
||||||
|
|
|
@ -30,8 +30,7 @@
|
||||||
['public_pool', 'public-pool.io'],
|
['public_pool', 'public-pool.io'],
|
||||||
['gobrrr_pool', 'Go Brrr pool'],
|
['gobrrr_pool', 'Go Brrr pool'],
|
||||||
['ckpool', 'CKPool'],
|
['ckpool', 'CKPool'],
|
||||||
['eu_ckpool', 'EU CKPool'],
|
['eu_ckpool', 'EU CKPool']
|
||||||
['local_public_pool', 'Public Pool (local)']
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
Loading…
Add table
Reference in a new issue