Skip to content

Commit

Permalink
testnet gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotBraem committed Apr 10, 2024
1 parent c9a400f commit 64e1908
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion apps/builddao/bos.config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"account": "${config_account}",
"account": "buildhub.near",
"aliases": ["./aliases.mainnet.json"],
"overrides": {
"testnet": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
"react-draggable": "^4.4.6",
"react-router-dom": "^5.2.0",
"styled-components": "^5.3.6",
"vm-browserify": "^1.1.2",
"zustand": "^4.4.6"
},
"scripts": {
Expand Down Expand Up @@ -83,7 +84,7 @@
"@babel/preset-react": "^7.14.5",
"assert": "^2.0.0",
"babel-loader": "^8.2.2",
"bos-workspace": "1.0.0-alpha.7",
"bos-workspace": "1.0.0-alpha.9",
"browserify-zlib": "^0.2.0",
"buffer": "^6.0.3",
"clean-webpack-plugin": "^4.0.0",
Expand Down
12 changes: 7 additions & 5 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ function App() {
currentGateway,
};

const index = Widgets.default;

return (
<div className="App" style={{ height: "100vh" }}>
<EthersProviderContext.Provider value={ethersProviderContext}>
Expand All @@ -214,19 +216,19 @@ function App() {
<JoinPage {...passProps} />
</Route>
<Route path={"/library"}>
<Redirect to="buildhub.near/widget/app?page=library" />
<Redirect to={`${index}?page=library`} />
</Route>
<Route path={"/propose"}>
<Redirect to="buildhub.near/widget/app?page=proposal&tab=proposals" />
<Redirect to={`${index}?page=proposal&tab=proposals`} />
</Route>
<Route path={"/projects"}>
<Redirect to="buildhub.near/widget/app?page=projects" />
<Redirect to={`${index}?page=projects`} />
</Route>
<Route path={"/feed"}>
<Redirect to="buildhub.near/widget/app?page=feed" />
<Redirect to={`${index}?page=feed`} />
</Route>
<Route path={"/resources"}>
<Redirect to="buildhub.near/widget/app?page=resources" />
<Redirect to={`${index}?page=resources`} />
</Route>
<Route path={"/edit/:widgetSrc*"}>
<EditorPage {...passProps} />
Expand Down
7 changes: 4 additions & 3 deletions src/data/widgets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ const TestnetDomains = {

export const NetworkId =
window.location.hostname in TestnetDomains ? "testnet" : "mainnet";
const TestnetWidgets = {

const TestnetWidgets = {
image: "eugenethedream/widget/Image",
default: "eugenethedream/widget/Welcome",
default: "builddao.testnet/widget/app",
viewSource: "eugenethedream/widget/WidgetSource",
widgetMetadataEditor: "eugenethedream/widget/WidgetMetadataEditor",
widgetMetadata: "eugenethedream/widget/WidgetMetadata",
Expand All @@ -20,7 +21,7 @@ const TestnetWidgets = {

const MainnetWidgets = {
image: "mob.near/widget/Image",
default: "buildhub.near/widget/home",
default: "buildhub.near/widget/app",
feed: "buildhub.near/widget/Feed",
resources: "buildhub.near/widget/Resources",
viewSource: "mob.near/widget/WidgetSource",
Expand Down
6 changes: 2 additions & 4 deletions src/pages/Viewer.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { Widget } from "near-social-vm";
import React, { useEffect, useMemo, useState } from "react";
import { useLocation, useParams } from "react-router-dom";
import OnboardingFlow from "../components/OnboardingFlow";

const SESSION_STORAGE_REDIRECT_MAP_KEY = "nearSocialVMredirectMap";

function Viewer({ code, ...props }) {
function Viewer({ code, widgets }) {
const { path } = useParams(); // get path from url, could be socialdb path or relative to "core"
const location = useLocation(); // get query params from url
const searchParams = new URLSearchParams(location.search);
Expand All @@ -19,7 +18,7 @@ function Viewer({ code, ...props }) {
}, [location]);

const src = useMemo(() => {
const defaultSrc = "buildhub.near/widget/app"; // default widget to load
const defaultSrc = widgets.default; // default widget to load
const pathSrc = path || defaultSrc; // if no path, load default widget
return pathSrc;
// const lastSlashIndex = pathSrc.lastIndexOf("/", pathSrc.indexOf(".near"));
Expand Down Expand Up @@ -62,7 +61,6 @@ function Viewer({ code, ...props }) {
props={{
path: src,
...passProps,
...props,
}}
config={{ redirectMap }}
/>
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module.exports = function (env) {
fs: false,
path: require.resolve("path-browserify"),
zlib: require.resolve("browserify-zlib"),
vm: require.resolve("vm-browserify"),
},
// Fix for using `yarn link "near-social-vm"`
alias: {
Expand Down
13 changes: 9 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5151,10 +5151,10 @@ borsh@1.0.0:
resolved "https://registry.yarnpkg.com/borsh/-/borsh-1.0.0.tgz#b564c8cc8f7a91e3772b9aef9e07f62b84213c1f"
integrity sha512-fSVWzzemnyfF89EPwlUNsrS5swF5CrtiN4e+h0/lLf4dz2he4L3ndM20PS9wj7ICSkXJe/TQUHdaPTq15b1mNQ==

bos-workspace@1.0.0-alpha.7:
version "1.0.0-alpha.7"
resolved "https://registry.yarnpkg.com/bos-workspace/-/bos-workspace-1.0.0-alpha.7.tgz#5001a6be5df5e764198bb072071e3f700ac7d0e1"
integrity sha512-B11waklcIlUXpNjlkhUvKln/lJ+5yEJCFbqTn4mH4pMt/NhnF159Ow+4CV9NEQ/JBlwE+tJhrvdrdJ03Hz3kzg==
bos-workspace@1.0.0-alpha.9:
version "1.0.0-alpha.9"
resolved "https://registry.yarnpkg.com/bos-workspace/-/bos-workspace-1.0.0-alpha.9.tgz#f0354455cf80b9d7dc76d31ad9053d1c72f14d40"
integrity sha512-RB8dD3AWbFCELzDr8NSp1TMdYUq8fOL5/SpRZiOBZqNO9r9Xb1huYn5ULfJkd6Ljz5VYDDf5f5oi1zoWq3Cjaw==
dependencies:
commander "^11.1.0"
crypto-js "^4.2.0"
Expand Down Expand Up @@ -12345,6 +12345,11 @@ vfile@^5.0.0:
unist-util-stringify-position "^3.0.0"
vfile-message "^3.0.0"

vm-browserify@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/vm-browserify/-/vm-browserify-1.1.2.tgz#78641c488b8e6ca91a75f511e7a3b32a86e5dda0"
integrity sha512-2ham8XPWTONajOR0ohOKOHXkm3+gaBmGut3SRuu75xLd/RRaY6vqgh8NBYYk7+RW3u5AtzPQZG8F10LHkl0lAQ==

warning@^4.0.0, warning@^4.0.1, warning@^4.0.2, warning@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/warning/-/warning-4.0.3.tgz#16e9e077eb8a86d6af7d64aa1e05fd85b4678ca3"
Expand Down

0 comments on commit 64e1908

Please sign in to comment.