Skip to content

Commit

Permalink
Merge branch 'raycast:main' into ext/beeminder
Browse files Browse the repository at this point in the history
  • Loading branch information
mybuddymichael authored Feb 20, 2025
2 parents d7e88f0 + d952187 commit cbc4c8a
Show file tree
Hide file tree
Showing 29 changed files with 420 additions and 34 deletions.
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -1556,7 +1556,7 @@
/extensions/sportssync @daniyalmaster693
/extensions/spotify-beta @mattisssa @peduarte @sxn @dillionverma @andreaselia @stuart @tonka3000 @dancannon
/extensions/spotify-controls @thomaspaulmann @altrdev @ron-myers @sandypockets @Kenan7 @dmacdermott @pernielsentikaer @yansq @amureki
/extensions/spotify-player @mattisssa @peduarte @sxn @dillionverma @andreaselia @stuart @tonka3000 @dancannon @pernielsentikaer @stevensd2m @erics118 @hjoelh @hobhouse @jatindotdev @the-devbear @rfaccio @badta5te @andyburris @thomaslombart @rhesamu @mpatel283 @LitoMore @EnneEmme
/extensions/spotify-player @mattisssa @peduarte @sxn @dillionverma @andreaselia @stuart @tonka3000 @dancannon @pernielsentikaer @stevensd2m @erics118 @hjoelh @hobhouse @jatindotdev @the-devbear @rfaccio @badta5te @andyburris @thomaslombart @rhesamu @mpatel283 @LitoMore @EnneEmme @lineville @tsibog @viethung0823
/extensions/spring-initializr @danvega
/extensions/spryker-docs @DinisEsteves
/extensions/sql-format @tonngw @jfkisafk
Expand Down Expand Up @@ -1692,8 +1692,8 @@
/extensions/tny @stayallive @stayallive
/extensions/to-streamshare @0PandaDEV @bkuzmanoski
/extensions/todo-list @maggie-j-liu @joshkorol @madza91 @bkeys818 @pernielsentikaer @telmen @ridemountainpig
/extensions/todoist @thomaslombart @AnishDe12020 @kud @casassg @Princeyadav05 @jfkisafk @ridemountainpig @kcole93 @RobErskine
/extensions/toggl-track @franzwilhelm @bkeys818 @michaelfaisst @teziovsky @lukebars @tangerine1202
/extensions/todoist @thomaslombart @AnishDe12020 @kud @casassg @Princeyadav05 @jfkisafk @ridemountainpig @kcole93 @RobErskine @jagadeesh-k-2802
/extensions/toggl-track @franzwilhelm @bkeys818 @michaelfaisst @teziovsky @lukebars @tangerine1202 @AlexIsMaking
/extensions/toggle-desktop-visibility @Haojen @VatsalSy
/extensions/toggle-fn @elonwoo @pernielsentikaer
/extensions/toggle-grayscale @zcsabbagh
Expand Down
6 changes: 5 additions & 1 deletion .github/raycast2github.json
Original file line number Diff line number Diff line change
Expand Up @@ -1838,5 +1838,9 @@
"dziad": "tborychowski",
"mattstone": "nandastone",
"britown": "bkuzmanoski",
"joeynotjoe_2": "joeynotjoe"
"joeynotjoe_2": "joeynotjoe",
"lineville": "lineville",
"jagadeesh_k": "jagadeesh-k-2802",
"tsibog": "tsibog",
"viethung0823": "viethung0823"
}
2 changes: 1 addition & 1 deletion docs/.config.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"version": "1.91.2"
"version": "1.92.1"
}
4 changes: 2 additions & 2 deletions docs/examples/doppler.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ function ShareSecretAction() {

await Clipboard.copy((body as any).authenticated_url);

toast.style = Feedback.Toast.Style.Success;
toast.style = Toast.Style.Success;
toast.title = "Shared secret";
toast.message = "Copied link to clipboard";
} catch (error) {
toast.style = Feedback.Toast.Style.Failure;
toast.style = Toast.Style.Failure;
toast.title = "Failed sharing secret";
toast.message = String(error);
}
Expand Down
8 changes: 6 additions & 2 deletions extensions/asana/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Asana Changelog

## [Added Copy Task Formatted URL command] - 2024-03-27
## [Add option to hide the "Start Date" field] - 2025-02-12

- Add a preference to allow the user to hide the `Start Date` field in the `Create Task` command

## [Add "Copy Task Formatted URL" action] - 2024-03-27

- Added a new task command - "Copy Task Formatted URL"

Expand All @@ -18,7 +22,7 @@

- Remove Raycast signature preference from the `Create Task` command

## [Bugfix] - 2022-11-24
## [Fix a bug] - 2022-11-24

Fixed an issue where the Asana extension would timeout when querying for projects in workspaces with a lot of projects.

Expand Down
16 changes: 14 additions & 2 deletions extensions/asana/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,26 @@
],
"owner": "raycast",
"access": "public",
"categories": ["Productivity"],
"categories": [
"Productivity"
],
"license": "MIT",
"commands": [
{
"name": "create-task",
"title": "Create Task",
"description": "Create and assign new tasks.",
"mode": "view"
"mode": "view",
"preferences": [
{
"name": "showStartDate",
"type": "checkbox",
"label": "Show the \"Start Date\" field",
"description": "When enabled, the \"Start Date\" field will be shown in the \"Create Task\" command.",
"required": false,
"default": true
}
]
},
{
"name": "my-tasks",
Expand Down
15 changes: 13 additions & 2 deletions extensions/asana/src/components/CreateTaskForm.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
import { Action, ActionPanel, Clipboard, Form, Icon, useNavigation, Toast, showToast } from "@raycast/api";
import {
Action,
ActionPanel,
Clipboard,
Form,
Icon,
useNavigation,
Toast,
showToast,
getPreferenceValues,
} from "@raycast/api";
import { format } from "date-fns";
import { FormValidation, getAvatarIcon, useCachedState, useForm } from "@raycast/utils";
import { useMemo, useEffect } from "react";
Expand Down Expand Up @@ -122,6 +132,7 @@ export default function CreateTaskForm(props: {

const hasCustomFields = customFields && customFields.length > 0;
const selectedWorkspace = workspaces?.find((workspace) => values.workspace === workspace.gid);
const { showStartDate } = getPreferenceValues<Preferences.CreateTask>();

return (
<Form
Expand Down Expand Up @@ -172,7 +183,7 @@ export default function CreateTaskForm(props: {
);
})}
</Form.Dropdown>
{selectedWorkspace?.is_organization ? (
{selectedWorkspace?.is_organization && showStartDate ? (
<Form.DatePicker title="Start Date" type={Form.DatePicker.Type.Date} {...itemProps.start_date} />
) : null}
<Form.DatePicker title="Due Date" type={Form.DatePicker.Type.Date} {...itemProps.due_date} />
Expand Down
12 changes: 12 additions & 0 deletions extensions/spotify-player/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Spotify Player Changelog

## [Fix Missing Playlists in Add Playing Song to Playlist command] - 2025-02-20

- Fixed an issue where some playlists were not appearing when users attempted to add a currently playing song to a playlist.

## [Add Copy Embed Code Command] - 2025-02-20

- Added a new command to copy the iframe embed code for the currently playing song.

## [Add "Skip 15 Seconds" and "Back 15 Seconds" commands] - 2025-02-18

- Added the ability to skip forward or back 15 seconds in the current episode. This adds two new commands as well as two new menu bar items which only show when an 'episode' is playing.

## [Artist Name Visibility Option] - 2025-02-07

- Added the option to hide the artist's name in the Menu Bar Player.
Expand Down
8 changes: 8 additions & 0 deletions extensions/spotify-player/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ Use this to quickly start playing a song based on your query.

Use this to get a playlist generated by Raycast AI based on a prompt. You can then add this playlist to Spotify or queue all the songs directly.

### Skip 15 Seconds

Use this to skip ahead 15 seconds.

### Back 15 Seconds

Use this to go back 15 seconds.

---

In order to use this extension, you'll need to authenticate with Spotify. This extension requires the following permissions [scopes](https://developer.spotify.com/documentation/web-api/concepts/scopes):
Expand Down
29 changes: 28 additions & 1 deletion extensions/spotify-player/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@
"rhesamu",
"themitpatel",
"litomore",
"enneemme"
"enneemme",
"lineville",
"tsibog",
"viethung0823"
],
"pastContributors": [
"bkeys818"
Expand Down Expand Up @@ -443,6 +446,30 @@
"description": "Start the DJ.",
"mode": "no-view",
"disabledByDefault": true
},
{
"name": "copyEmbed",
"title": "Copy Embed Code",
"subtitle": "Spotify",
"description": "Copy the iframe embed code for the currently playing song or podcast episode.",
"mode": "no-view",
"disabledByDefault": true
},
{
"name": "skip15",
"title": "Skip 15 Seconds",
"subtitle": "Spotify",
"description": "Skip 15 seconds forward in an episode.",
"mode": "no-view",
"disabledByDefault": true
},
{
"name": "back15",
"title": "Back 15 Seconds",
"subtitle": "Spotify",
"description": "Back 15 seconds in an episode.",
"mode": "no-view",
"disabledByDefault": true
}
],
"dependencies": {
Expand Down
20 changes: 17 additions & 3 deletions extensions/spotify-player/src/api/getMyPlaylists.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,27 @@
import { getErrorMessage } from "../helpers/getError";
import { getSpotifyClient } from "../helpers/withSpotifyClient";

type GetMySavedAlbumsProps = { limit?: number };
type GetUserPlaylistsProps = { limit?: number };

export async function getMyPlaylists({ limit = 50 }: GetMySavedAlbumsProps = {}) {
export async function getMyPlaylists({ limit = 50 }: GetUserPlaylistsProps = {}) {
const { spotifyClient } = getSpotifyClient();
let response = null;
let nextUrl = null;

try {
const response = await spotifyClient.getMePlaylists({ limit });
response = await spotifyClient.getMePlaylists({ limit });
nextUrl = response?.next;

while (nextUrl) {
const nextResponse = await spotifyClient.getNext(nextUrl);
response = {
...response,
...nextResponse,
items: [...(response?.items ?? []), ...(nextResponse.items ?? [])],
};
nextUrl = nextResponse?.next;
}

return response;
} catch (err) {
const error = getErrorMessage(err);
Expand Down
25 changes: 25 additions & 0 deletions extensions/spotify-player/src/back15.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { showHUD } from "@raycast/api";
import { setSpotifyClient } from "./helpers/withSpotifyClient";
import { getCurrentlyPlaying } from "./api/getCurrentlyPlaying";
import { safeLaunchCommandInBackground } from "./helpers/safeCommandLauncher";
import { seek } from "./api/seek";

export default async function Command() {
await setSpotifyClient();

const currentlyPlayingData = await getCurrentlyPlaying();
const nothingIsPlaying = !currentlyPlayingData || !currentlyPlayingData.item;

if (nothingIsPlaying) {
return await showHUD("Nothing is currently playing");
}

try {
const currentPositionSeconds = (currentlyPlayingData?.progress_ms || 0) / 1000;
await seek(Math.max(currentPositionSeconds - 15, 0));
await showHUD("Skipped back 15 seconds");
await safeLaunchCommandInBackground("current-track");
} catch (error) {
await showHUD("Nothing is currently playing");
}
}
24 changes: 24 additions & 0 deletions extensions/spotify-player/src/copyEmbed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { Clipboard, showHUD } from "@raycast/api";
import { setSpotifyClient } from "./helpers/withSpotifyClient";
import { getCurrentlyPlaying } from "./api/getCurrentlyPlaying";

export default async function Command() {
await setSpotifyClient();

const currentlyPlayingData = await getCurrentlyPlaying();
const nothingIsPlaying = !currentlyPlayingData || !currentlyPlayingData.item;

if (nothingIsPlaying) {
return await showHUD("Nothing is currently playing");
}

const external_urls = currentlyPlayingData.item.external_urls;
const spotifyUrl = external_urls?.spotify;

const embedUrl = spotifyUrl?.replace("open.spotify.com/", "open.spotify.com/embed/");

const embedCode = `<iframe style="border-radius:12px" src="${embedUrl}?utm_source=generator" width="100%" height="352" frameBorder="0" allowfullscreen="" allow="autoplay; clipboard-write; encrypted-media; fullscreen; picture-in-picture" loading="lazy"></iframe>`;

await Clipboard.copy(embedCode);
return showHUD("Copied embed code to clipboard");
}
38 changes: 38 additions & 0 deletions extensions/spotify-player/src/helpers/spotify.api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5082,3 +5082,41 @@ export function getMeTopTracks(
),
);
}
/**
* Get next page
*
*/
export function getNext(
nextUrl: string,
opts?: Oazapfts.RequestOpts,
) {
const url = nextUrl.replace(servers.server1, "");
return oazapfts.ok(
oazapfts.fetchJson<
| {
status: 200;
data: PagingPlaylistObject;
}
| {
status: 401;
data: {
error: ErrorObject;
};
}
| {
status: 403;
data: {
error: ErrorObject;
};
}
| {
status: 429;
data: {
error: ErrorObject;
};
}
>(url, {
...opts,
}),
);
}
34 changes: 34 additions & 0 deletions extensions/spotify-player/src/nowPlayingMenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import { formatTitle } from "./helpers/formatTitle";
import { getErrorMessage } from "./helpers/getError";

import { useSpotifyAppData } from "./hooks/useSpotifyAppData";
import { seek } from "./api/seek";

function NowPlayingMenuBarCommand({ launchType }: LaunchProps) {
const { hideArtistName, maxTextLength, iconType } = getPreferenceValues<Preferences.NowPlayingMenuBar>();
Expand Down Expand Up @@ -190,6 +191,39 @@ function NowPlayingMenuBarCommand({ launchType }: LaunchProps) {
const showName = show.name;
title = formatTitle({ name, artistName: showName, hideArtistName, maxTextLength });
coverImageUrl = show.images.slice(-1)[0]?.url || "";

menuItems = (
<>
<MenuBarExtra.Item
icon={Icon.RotateClockwise}
title="Skip 15 seconds"
onAction={async () => {
try {
const currentPositionSeconds = (currentlyPlayingData?.progress_ms || 0) / 1000;
await seek(currentPositionSeconds + 15);
await currentlyPlayingRevalidate();
} catch (err) {
const error = getErrorMessage(err);
showHUD(error);
}
}}
/>
<MenuBarExtra.Item
icon={Icon.RotateAntiClockwise}
title="Back 15 seconds"
onAction={async () => {
try {
const currentPositionSeconds = (currentlyPlayingData?.progress_ms || 0) / 1000;
await seek(currentPositionSeconds - 15);
await currentlyPlayingRevalidate();
} catch (err) {
const error = getErrorMessage(err);
showHUD(error);
}
}}
/>
</>
);
}

return (
Expand Down
Loading

0 comments on commit cbc4c8a

Please sign in to comment.