Skip to content

Commit

Permalink
Receive task token from the platform
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastienTainon committed Jun 14, 2024
1 parent 6a4a6ed commit 537bf64
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
16 changes: 15 additions & 1 deletion frontend/task/LocalWorkDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,22 @@ export function LocalWorkDialog(props: LocalWorkDialogProps) {

const handleFocus = (event) => event.target.select();

const unsecuredCopyToClipboard = (text: string) => {
const textArea = document.createElement("textarea");
textArea.value = text;
document.body.appendChild(textArea);
textArea.focus();
textArea.select();
try {
document.execCommand('copy');
} catch (err) {
console.error('Unable to copy to clipboard', err);
}
document.body.removeChild(textArea);
}

const copyCommand = () => {
navigator.clipboard.writeText(shellCommand);
unsecuredCopyToClipboard(shellCommand);
setCopied(true);
if (timeoutRef.current) {
clearTimeout(timeoutRef.current);
Expand Down
1 change: 1 addition & 0 deletions frontend/task/platform/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export function getTaskMetadata() {
};
metadata.autoHeight = true;
metadata.disablePlatformProgress = true;
metadata.usesTokens = true; // To receive task token

return metadata;
}
Expand Down

0 comments on commit 537bf64

Please sign in to comment.