-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from zjkmxy/safari
Support iPad Safari (IndexedDB ponyfill)
- Loading branch information
Showing
15 changed files
with
108 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
importFile=$(grep -Po '(?<=await import\()(.+)\"' dist/sw.js) | ||
echo "Captured ${importFile}" | ||
ESCAPED_REPLACE=$(printf '%s\n' "$importFile" | sed -e 's/[\/&]/\\&/g') | ||
sed -i -e '1s/^/import { FileSystemWritableFileStream } from '${ESCAPED_REPLACE}';\n/' \ | ||
-e 's/.*await import.*/\/\//' \ | ||
-e 's/return new t(await this\[ee\]\.createWritable(e));/return new FileSystemWritableFileStream(await this\[ee\]\.createWritable(e));/' dist/sw.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,23 @@ | ||
<!doctype html> | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/ndn.svg" /> | ||
<link rel="apple-touch-icon" href="/ndn_app.png" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta name="theme-color" content="#ce93d8" /> | ||
<link href="/font/roboto-v30.css" rel="stylesheet" /> | ||
<link href="/font/roboto-mono-v23.css" rel="stylesheet" /> | ||
<title>NDN Workspace</title> | ||
<meta | ||
name="description" | ||
content="NDN Workspace for collaborative paper writing and documents" | ||
/> | ||
<script id="vite-plugin-pwa:register-sw" src="/registerSW.js"></script> | ||
</head> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/ndn.svg" /> | ||
<link rel="apple-touch-icon" href="/ndn_app.png"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<meta name="theme-color" content="#ce93d8" /> | ||
<link href="/font/roboto-v30.css" rel="stylesheet" /> | ||
<link href="/font/roboto-mono-v23.css" rel="stylesheet" /> | ||
<title>NDN Workspace</title> | ||
<meta name="description" content="NDN Workspace for collaborative paper writing and documents"> | ||
</head> | ||
|
||
<body> | ||
<div id="root" style="padding: 0; margin: 0;"></div> | ||
<script type="module" src="/src/index.tsx"></script> | ||
</body> | ||
|
||
</html> | ||
<body> | ||
<div id="root" style="padding: 0; margin: 0"></div> | ||
<script type="module" src="/src/index.tsx"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if ("serviceWorker" in navigator) { | ||
window.addEventListener("load", () => { | ||
navigator.serviceWorker.register("/sw.js", { scope: "/", type: "module" }); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { getOriginPrivateDirectory } from 'file-system-access' | ||
import indexedDbAdapter from 'file-system-access/lib/adapters/indexeddb' | ||
|
||
export const openRoot: () => Promise<FileSystemDirectoryHandle> = (() => { | ||
if (FileSystemFileHandle.prototype.createWritable !== undefined) { | ||
// Normal browsers | ||
return getOriginPrivateDirectory | ||
} else { | ||
// Weird Safari | ||
console.log('Safari ponyfill applied') | ||
return () => getOriginPrivateDirectory(indexedDbAdapter) | ||
} | ||
})() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters