Skip to content

Commit

Permalink
feat: run source encoded in base64 through url hash
Browse files Browse the repository at this point in the history
  • Loading branch information
CNSeniorious000 committed Jun 28, 2024
1 parent 43bb282 commit abcd76c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/python/app/console.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export class Result {
export class Result<T> {
status: "complete" | "incomplete" | "syntax-error";
future: Promise<T>;
formatted_error?: string;
async get_repr(): Promise<string | undefined>;
}
Expand All @@ -13,5 +14,5 @@ class EnhancedConsole {
export class ConsoleAPI {
complete(source: string): [string[], number];
console: EnhancedConsole;
async push(line: string): Result;
push(line: string): Result<any>;
}
10 changes: 10 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import { patchSource, reformatInputSource } from "$lib/pyodide/translate";
import { pyodideReady } from "$lib/stores";
import { afterUpdate, beforeUpdate, onMount } from "svelte";
import { toast } from "svelte-sonner";
import { cubicIn, cubicOut } from "svelte/easing";
import { scale } from "svelte/transition";
Expand Down Expand Up @@ -48,6 +49,15 @@
inputRef.focus();
});
$: if ($pyodideReady && pyConsole) {
if (location.hash) {
toast("asdfasdf");
const source = atob(decodeURIComponent(location.hash.slice(1)));
location.hash = "";
pushBlock(source);
}
}
async function pushMany(lines: string[], wait = true, hidden = false, finallySetInput = "") {
let promise: Promise<any> | null = null;
for (const line of lines) {
Expand Down

0 comments on commit abcd76c

Please sign in to comment.