Skip to content

Commit

Permalink
#1 共有からテキストを受信
Browse files Browse the repository at this point in the history
  • Loading branch information
amay077 committed Jul 21, 2024
1 parent 20db878 commit 563e19a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib/MainContent.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,16 @@ onMount(async () => {
// await connectToTwitter(params);
// }
const urlParams = new URLSearchParams(window.location.search);
const content = urlParams.get('text');
const url = urlParams.get('url');
if ((content?.length ?? 0) > 0) {
text = content ?? '';
} else if ((url?.length ?? 0) > 0) {
text = url ?? '';
}
} finally {
loading = false;
Expand Down
9 changes: 9 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,15 @@ const pwaOptions: Partial<VitePWAOptions> = {
background_color: '#ECFFE6',
theme_color: '#399918',
lang: 'ja',
share_target: {
action: '/',
method: 'GET',
params: {
title: 'title',
text: 'text',
url: 'url'
}
}
},
// includeAssets: ['ui_icon/*.svg'],
// devOptions: {
Expand Down

0 comments on commit 563e19a

Please sign in to comment.