Skip to content

Commit b5b16ed

Browse files
committed
Revert #202
1 parent 5a6aa9f commit b5b16ed

File tree

3 files changed

+11
-59
lines changed

3 files changed

+11
-59
lines changed

src/lib/bridge/handlers/meta_settings.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/lib/bridge/handlers/prove_trades_token.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/lib/components/trade_history/trade_proof.ts

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ import {CustomElement, InjectAppend, InjectionMode} from '../injectors';
55
import {FloatElement} from '../custom';
66
import {fetchListingTime} from './helpers';
77
import '../common/ui/steam-button';
8-
import {ProveTradesToken} from '../../bridge/handlers/prove_trades_token';
9-
import {ClientSend} from '../../bridge/client';
108

119
@CustomElement()
1210
@InjectAppend('.tradehistoryrow .tradehistory_content', InjectionMode.CONTINUOUS)
1311
export class TradeProof extends FloatElement {
1412
@state()
15-
private message: string | undefined;
13+
private proofNumber: number | undefined;
1614

1715
@state()
1816
private isProcessing = false;
@@ -22,12 +20,12 @@ export class TradeProof extends FloatElement {
2220
}
2321

2422
render() {
25-
return this.message
26-
? html` <span>${this.message}</span> `
23+
return this.proofNumber
24+
? html` <span>Proof: ${this.proofNumber}</span> `
2725
: html`
2826
<csfloat-steam-button
2927
@click="${this.onClick}"
30-
.text="${this.isProcessing ? 'Proving...' : 'Prove Trade on CSFloat'}"
28+
.text="${this.isProcessing ? 'Computing Proof...' : 'CSFloat Proof'}"
3129
>
3230
</csfloat-steam-button>
3331
`;
@@ -36,17 +34,14 @@ export class TradeProof extends FloatElement {
3634
private async onClick() {
3735
this.isProcessing = true;
3836

39-
const token = document
40-
.getElementById('application_config')
41-
?.getAttribute('data-loyalty_webapi_token')
42-
?.replace('"', '')
43-
.replace('"', '');
44-
37+
const index = $J('.tradehistoryrow').index($J(this).parent().parent());
4538
try {
46-
const resp = await ClientSend(ProveTradesToken, {token});
47-
this.message = resp.message;
48-
} catch (e: any) {
49-
alert(e.toString());
39+
this.proofNumber = await fetchListingTime(index);
40+
} catch (e) {
41+
alert(
42+
"Failed to parse time, make sure you're on an english version of the page by appending ?l=english to the url"
43+
);
5044
}
45+
this.isProcessing = false;
5146
}
5247
}

0 commit comments

Comments
 (0)