Skip to content
Open
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
5 changes: 2 additions & 3 deletions plugins/LastFM/src/LastFM.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Scrobble } from "./types/Scrobble";

import type { AnyRecord } from "@inrixia/helpers";
import { findModuleProperty, ftch } from "@luna/core";
import { clipboardWriteText } from "@luna/lib.native";
import { openExternal } from "@luna/lib.native";
import { storage } from "./Settings";
import { hash } from "./hash.native";

Expand Down Expand Up @@ -79,8 +79,7 @@ export class LastFM {
public static async authenticate() {
const { token } = await LastFM.sendRequest<{ token: string }>("auth.getToken");
const authUrl = `https://www.last.fm/api/auth/?api_key=${this.apiKey}&token=${token}`;
window.open(authUrl, "_blank");
await clipboardWriteText(authUrl);
await openExternal(authUrl);
for (let i = 0; i < 10; i++) {
const session = await this.sendRequest<{ session: LastFmSession }>("auth.getSession", { token }).catch(() => undefined);
if (session !== undefined) return session;
Expand Down