Skip to content

Commit

Permalink
base href for handling any url, set context.accountId
Browse files Browse the repository at this point in the history
  • Loading branch information
petersalomonsen committed Mar 5, 2024
1 parent afddb50 commit a6a9548
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dev:mainnet": "./scripts/dev.sh -a devhub.near -c devhub.near -n mainnet",
"build:preview": "node ./scripts/build-preview.mjs",
"dev": "npm run dev:mainnet",
"generateimportmap": "(cd playwright-tests/gateway/ && jspm link index.html -o index.html)",
"generateimportmap": "(cd playwright-tests/gateway/ && jspm link 404.html -o 404.html)",
"gateway": "node scripts/dev-gateway.mjs",
"test": "npx playwright test",
"test:watch:codespaces": "npm test -- --ui-host=0.0.0.0"
Expand Down
6 changes: 3 additions & 3 deletions playwright-tests/gateway/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Near social</title>
<base href="/" />
<title>Near social</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@near-wallet-selector/[email protected]/styles.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/main.a3ef7374a57ed9263007.bundle.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/runtime.11b6858f93d8625836ab.bundle.js"></script>
Expand All @@ -18,8 +19,7 @@
"@near-wallet-selector/core": "https://ga.jspm.io/npm:@near-wallet-selector/[email protected]/index.js",
"@near-wallet-selector/here-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/[email protected]/index.js",
"@near-wallet-selector/modal-ui-js": "https://ga.jspm.io/npm:@near-wallet-selector/[email protected]/index.js",
"@near-wallet-selector/my-near-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/[email protected]/index.js",
"near-bos-webcomponent/dist/main.a3ef7374a57ed9263007.bundle.js": "https://ga.jspm.io/npm:@jspm/[email protected]/nodelibs/@empty.js"
"@near-wallet-selector/my-near-wallet": "https://ga.jspm.io/npm:@near-wallet-selector/[email protected]/index.js"
},
"scopes": {
"https://ga.jspm.io/": {
Expand Down
11 changes: 11 additions & 0 deletions playwright-tests/gateway/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ const modal = setupModal(selector, {
document
.getElementById("openWalletSelectorButton")
.addEventListener("click", () => modal.show());

// Needed for context.accountId
const near_app_wallet_auth_key = JSON.parse(
localStorage.getItem("near_app_wallet_auth_key")
);
if (near_app_wallet_auth_key) {
localStorage.setItem(
"near-social-vm:v01::accountId:",
`"${near_app_wallet_auth_key.accountId}"`
);
}

0 comments on commit a6a9548

Please sign in to comment.