Fix files cache problem and static files management

This commit is contained in:
koalasat 2024-09-17 15:14:43 +02:00
parent f2a0d0e632
commit bfda0e93be
No known key found for this signature in database
GPG Key ID: 2F7F61C6146AB157
30 changed files with 810 additions and 467 deletions

15
.gitignore vendored
View File

@ -646,10 +646,17 @@ docs/.jekyll-cache*
docs/_site*
node
# mobile frontend statics
mobile/html/Web.bundle/js*
mobile/html/Web.bundle/css*
mobile/html/Web.bundle/assets*
# frontend statics
mobile/html/Web.bundle/static/*
# mobile/html/Web.bundle/index.html
desktopApp/static/*
# desktopApp/index.html
web/static/*
# web/basic.html
# web/pro.html
nodeapp/static/*
# nodeapp/basic.html
# nodeapp/pro.html
# Protocol Buffers
api/lightning/*.proto

View File

@ -1,63 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" type="image/png" href="./static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="./static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="./static/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="./static/assets/images/favicon-192x192.png" sizes="192x192">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" type="text/css" href="./static/css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="./static/css/leaflet.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
window.RobosatsSettings = 'web-basic'
window.RobosatsClient = 'desktop-app'
</script>
<script src="./static/frontend/main.js"></script>
</body>
</html>

View File

@ -1 +0,0 @@
../frontend/static

File diff suppressed because it is too large Load Diff

View File

@ -40,6 +40,7 @@
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-react": "^7.34.0",
"eslint-plugin-react-hooks": "^4.6.0",
"html-webpack-plugin": "^5.6.0",
"jest": "^29.6.1",
"prettier": "^3.3.3",
"ts-node": "^10.9.2",

View File

@ -15,6 +15,7 @@ import { GarageContextProvider } from './contexts/GarageContext';
import { FederationContextProvider } from './contexts/FederationContext';
const App = (): JSX.Element => {
const [client, _view] = window.RobosatsSettings.split('-');
return (
<StrictMode>
<ErrorBoundary>
@ -24,11 +25,7 @@ const App = (): JSX.Element => {
<FederationContextProvider>
<GarageContextProvider>
<CssBaseline />
{window.NativeRobosats === undefined && window.RobosatsClient === undefined ? (
<HostAlert />
) : (
<TorConnectionBadge />
)}
{client !== 'mobile' ? <HostAlert /> : <TorConnectionBadge />}
<Main />
</GarageContextProvider>
</FederationContextProvider>

View File

@ -12,9 +12,10 @@ import { GarageContext, type UseGarageStoreType } from '../contexts/GarageContex
import Routes from './Routes';
const getRouter = (): any => {
if (window.NativeRobosats === undefined && window.RobosatsClient === undefined) {
const [client, _view] = window.RobosatsSettings.split('-');
if (client === 'web') {
return BrowserRouter;
} else if (window.RobosatsClient === 'desktop-app') {
} else if (client === 'desktop') {
return HashRouter;
} else {
return MemoryRouter;

View File

@ -43,7 +43,7 @@ const RobotProfile = ({
setView,
width,
}: RobotProfileProps): JSX.Element => {
const { windowSize } = useContext<UseAppStoreType>(AppContext);
const { windowSize, client } = useContext<UseAppStoreType>(AppContext);
const { garage, slotUpdatedAt } = useContext<UseGarageStoreType>(GarageContext);
const { t } = useTranslation();
@ -317,7 +317,7 @@ const RobotProfile = ({
</LoadingButton>
</Grid>
{window.NativeRobosats === undefined ? (
{client !== 'mobile' ? (
<Grid item>
<Button
color='primary'

View File

@ -24,7 +24,7 @@ import { FederationContext, type UseFederationStoreType } from '../../contexts/F
import { GarageContext, type UseGarageStoreType } from '../../contexts/GarageContext';
const RobotPage = (): JSX.Element => {
const { torStatus, windowSize, settings, page } = useContext<UseAppStoreType>(AppContext);
const { torStatus, windowSize, settings, page, client } = useContext<UseAppStoreType>(AppContext);
const { garage } = useContext<UseGarageStoreType>(GarageContext);
const { federation, sortedCoordinators } = useContext<UseFederationStoreType>(FederationContext);
const { t } = useTranslation();
@ -44,7 +44,7 @@ const RobotPage = (): JSX.Element => {
const token = urlToken ?? garage.currentSlot;
if (token !== undefined && token !== null && page === 'robot') {
setInputToken(token);
if (window.NativeRobosats === undefined || torStatus === 'ON' || !settings.useProxy) {
if (client !== 'mobile' || torStatus === 'ON' || !settings.useProxy) {
setView('profile');
}
}
@ -82,7 +82,7 @@ const RobotPage = (): JSX.Element => {
garage.deleteSlot();
};
if (settings.useProxy && !(window.NativeRobosats === undefined) && !(torStatus === 'ON')) {
if (settings.useProxy && client === 'mobile' && !(torStatus === 'ON')) {
return (
<Paper
elevation={12}

View File

@ -46,7 +46,7 @@ const RobotAvatar: React.FC<Props> = ({
}) => {
const [avatarSrc, setAvatarSrc] = useState<string>('');
const [activeBackground, setActiveBackground] = useState<boolean>(true);
const { hostUrl } = useContext<UseAppStoreType>(AppContext);
const { hostUrl, client } = useContext<UseAppStoreType>(AppContext);
const backgroundFadeTime = 3000;
const [backgroundData] = useState<BackgroundData>(placeholder.loading);
@ -71,7 +71,7 @@ const RobotAvatar: React.FC<Props> = ({
useEffect(() => {
if (shortAlias && shortAlias !== '') {
if (!window.NativeRobosats) {
if (client !== 'mobile') {
setAvatarSrc(
`${hostUrl}/static/federation/avatars/${shortAlias}${small ? '.small' : ''}.webp`,
);

View File

@ -37,7 +37,7 @@ interface SettingsFormProps {
}
const SettingsForm = ({ dense = false }: SettingsFormProps): JSX.Element => {
const { fav, setFav, settings, setSettings } = useContext<UseAppStoreType>(AppContext);
const { fav, setFav, settings, setSettings, client } = useContext<UseAppStoreType>(AppContext);
const theme = useTheme();
const { t } = useTranslation();
const fontSizes = [
@ -237,7 +237,7 @@ const SettingsForm = ({ dense = false }: SettingsFormProps): JSX.Element => {
</ToggleButtonGroup>
</ListItem>
{window.NativeRobosats !== undefined && (
{client === 'mobile' && (
<ListItem>
<ListItemIcon>
<TorIcon />

View File

@ -1,4 +1,4 @@
import React, { useEffect, useState } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
Box,
@ -33,6 +33,7 @@ import { apiClient } from '../../../services/api';
import { systemClient } from '../../../services/System';
import lnproxies from '../../../../static/lnproxies.json';
import { UseAppStoreType, AppContext } from '../../../contexts/AppContext';
let filteredProxies: Array<Record<string, any>> = [];
export interface LightningForm {
invoice: string;
@ -89,6 +90,7 @@ export const LightningPayoutForm = ({
setLightning,
settings,
}: LightningPayoutFormProps): JSX.Element => {
const { client } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();
const theme = useTheme();
@ -153,7 +155,7 @@ export const LightningPayoutForm = ({
bitcoinNetwork = settings?.network ?? 'mainnet';
if (settings.host?.includes('.i2p') === true) {
internetNetwork = 'I2P';
} else if (settings.host?.includes('.onion') === true || window.NativeRobosats !== undefined) {
} else if (settings.host?.includes('.onion') === true || client === 'mobile') {
internetNetwork = 'TOR';
}

View File

@ -1,4 +1,4 @@
import React, { useState } from 'react';
import React, { useContext, useState } from 'react';
import { format } from 'date-fns';
import { useTranslation } from 'react-i18next';
import {
@ -37,6 +37,7 @@ import {
} from '../Icons';
import { type TradeCoordinatorSummary, type TradeRobotSummary } from '../../models/Order.model';
import { systemClient } from '../../services/System';
import { UseAppStoreType, AppContext } from '../../contexts/AppContext';
interface Props {
isMaker: boolean;
@ -61,6 +62,7 @@ const TradeSummary = ({
platformSummary,
orderId,
}: Props): JSX.Element => {
const { client } = useContext<UseAppStoreType>(AppContext);
const { t } = useTranslation();
const theme = useTheme();
@ -81,7 +83,7 @@ const TradeSummary = ({
taker: takerSummary,
platform: platformSummary,
};
if (window.NativeRobosats === undefined) {
if (client !== 'mobile') {
saveAsJson(`order${orderId}-summary.json`, summary);
} else {
systemClient.copyToClipboard(JSON.stringify(summary));

View File

@ -40,7 +40,6 @@ export interface SlideDirection {
export type TorStatus = 'ON' | 'STARTING' | 'STOPPING' | 'OFF';
export const isNativeRoboSats = !(window.NativeRobosats === undefined);
export const isDesktopRoboSats = !(window.RobosatsClient === undefined);
const pageFromPath = window.location.pathname.split('/')[1];
const isPagePathEmpty = pageFromPath === '';
@ -76,13 +75,14 @@ const makeTheme = function (settings: Settings): Theme {
};
const getHostUrl = (network = 'mainnet'): string => {
const [client, _view] = window.RobosatsSettings.split('-');
const randomAlias =
Object.keys(defaultFederation)[
Math.floor(Math.random() * Object.keys(defaultFederation).length)
];
let host = defaultFederation[randomAlias][network].onion;
let protocol = 'http:';
if (window.NativeRobosats === undefined) {
if (client !== 'mobile') {
host = getHost();
protocol = location.protocol;
}
@ -93,8 +93,9 @@ const getHostUrl = (network = 'mainnet'): string => {
const getOrigin = (network = 'mainnet'): Origin => {
const host = getHostUrl(network);
let origin: Origin = 'onion';
const [client, _view] = window.RobosatsSettings.split('-');
if (window.NativeRobosats !== undefined || host.includes('.onion')) {
if (client === 'mobile' || client === 'desktop' || host.includes('.onion')) {
origin = 'onion';
} else if (host.includes('i2p')) {
origin = 'i2p';
@ -106,13 +107,13 @@ const getOrigin = (network = 'mainnet'): Origin => {
};
const getSettings = (): Settings => {
let settings = new Settings();
if (window.RobosatsSettings === 'selfhosted-basic') {
settings = new SettingsSelfhosted();
} else if (window.RobosatsSettings === 'selfhosted-pro') {
settings = new SettingsSelfhostedPro();
} else if (window.RobosatsSettings === 'web-pro') {
settings = new SettingsPro();
let settings;
const [client, view] = window.RobosatsSettings.split('-');
if (client === 'selfhosted') {
settings = view === 'pro' ? new SettingsSelfhostedPro() : new SettingsSelfhosted();
} else {
settings = view === 'pro' ? new SettingsPro() : new Settings();
}
return settings;
@ -152,6 +153,8 @@ export interface UseAppStoreType {
fav: Favorites;
setFav: Dispatch<SetStateAction<Favorites>>;
worldmap?: GeoJsonObject;
client: 'mobile' | 'web' | 'desktop' | string;
view: 'basic' | 'pro' | string;
}
export const initialAppContext: UseAppStoreType = {
@ -178,6 +181,8 @@ export const initialAppContext: UseAppStoreType = {
fav: { type: null, currency: 0, mode: 'fiat', coordinator: 'any' },
setFav: () => {},
worldmap: undefined,
client: 'web',
view: 'basic',
};
export const AppContext = createContext<UseAppStoreType>(initialAppContext);
@ -191,6 +196,7 @@ export const AppContextProvider = ({ children }: AppContextProviderProps): JSX.E
const clientVersion = initialAppContext.clientVersion;
const hostUrl = initialAppContext.hostUrl;
const origin = initialAppContext.origin;
const [client, view] = window.RobosatsSettings.split('-');
const [settings, setSettings] = useState<Settings>(getSettings());
const [theme, setTheme] = useState<Theme>(() => {
@ -286,6 +292,8 @@ export const AppContextProvider = ({ children }: AppContextProviderProps): JSX.E
fav,
setFav,
worldmap,
client,
view,
}}
>
<ThemeProvider theme={theme}>{children}</ThemeProvider>

View File

@ -46,7 +46,7 @@ export const FederationContext = createContext<UseFederationStoreType>(initialFe
export const FederationContextProvider = ({
children,
}: FederationContextProviderProps): JSX.Element => {
const { settings, page, origin, hostUrl, open, torStatus } =
const { settings, page, origin, hostUrl, open, torStatus, client } =
useContext<UseAppStoreType>(AppContext);
const { setMaker, garage } = useContext<UseGarageStoreType>(GarageContext);
const [federation] = useState(new Federation(origin, settings, hostUrl));
@ -66,7 +66,7 @@ export const FederationContextProvider = ({
}, []);
useEffect(() => {
if (window.NativeRobosats === undefined || torStatus === 'ON' || !settings.useProxy) {
if (client !== 'mobile' || torStatus === 'ON' || !settings.useProxy) {
void federation.updateUrl(origin, settings, hostUrl);
void federation.update();
}

View File

@ -64,7 +64,7 @@ export const GarageContext = createContext<UseGarageStoreType>(initialGarageCont
export const GarageContextProvider = ({ children }: GarageContextProviderProps): JSX.Element => {
// All garage data structured
const { settings, torStatus, open, page } = useContext<UseAppStoreType>(AppContext);
const { settings, torStatus, open, page, client } = useContext<UseAppStoreType>(AppContext);
const pageRef = useRef(page);
const { federation, sortedCoordinators } = useContext<UseFederationStoreType>(FederationContext);
const [garage] = useState<Garage>(initialGarageContext.garage);
@ -93,14 +93,14 @@ export const GarageContextProvider = ({ children }: GarageContextProviderProps):
}, []);
useEffect(() => {
if (window.NativeRobosats === undefined || torStatus === 'ON' || !settings.useProxy) {
if (client !== 'mobile' || torStatus === 'ON' || !settings.useProxy) {
const token = garage.getSlot()?.token;
if (token) void garage.fetchRobot(federation, token);
}
}, [settings.network, settings.useProxy, torStatus]);
useEffect(() => {
if (window.NativeRobosats !== undefined && !systemClient.loading) {
if (client === 'mobile' && !systemClient.loading) {
garage.loadSlots();
}
}, [systemClient.loading]);

View File

@ -47,7 +47,9 @@ class BaseSettings {
this.host = getHost();
const useProxy = systemClient.getItem('settings_use_proxy');
this.useProxy = window.NativeRobosats !== undefined && useProxy !== 'false';
const [client, _view] = window.RobosatsSettings.split('-');
this.useProxy = client === 'mobile' && useProxy !== 'false';
apiClient.useProxy = this.useProxy;
}

View File

@ -5,7 +5,6 @@ declare global {
ReactNativeWebView?: ReactNativeWebView;
NativeRobosats?: NativeRobosats;
RobosatsSettings: 'web-basic' | 'web-pro' | 'selfhosted-basic' | 'selfhosted-pro';
RobosatsClient: 'desktop-app' | undefined;
}
}

View File

@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="onion-location" content="{{ ONION_LOCATION }}" />
<link rel="shortcut icon" href="/static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="/static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-96x96.png" sizes="96x96">
@ -12,11 +11,11 @@
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
{% load static %}
<link rel="stylesheet" href="{% static "css/fonts.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css/loader.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css/index.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css/leaflet.css" %}"/>
<link rel="stylesheet" href="/static/css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/leaflet.css"/>
</head>
<body>
<noscript>
@ -55,7 +54,8 @@
</div>
</div>
</div>
<script src="{% static "frontend/main.js" %}"></script>
<script>
window.RobosatsSettings = '<%= htmlWebpackPlugin.options.robosatsSettings %>'
</script>
</body>
</html>

View File

@ -1,7 +1,6 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="onion-location" content="{{ ONION_LOCATION }}" />
<link rel="shortcut icon" href="/static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="/static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-96x96.png" sizes="96x96">
@ -12,13 +11,13 @@
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats PRO - Simple and Private Bitcoin Exchange</title>
{% load static %}
<link rel="stylesheet" href="{% static "css/fonts.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css/loader.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css/index.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css/leaflet.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css_pro/react-grid-layout.css" %}"/>
<link rel="stylesheet" type="text/css" href="{% static "css_pro/react-resizable.css" %}"/>
<link rel="stylesheet" href="/static/css_pro/fonts.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/leaflet.css"/>
<link rel="stylesheet" type="text/css" href="/static/css_pro/react-grid-layout.css"/>
<link rel="stylesheet" type="text/css" href="/static/css_pro/react-resizable.css"/>
</head>
<body>
<noscript>
@ -57,7 +56,8 @@
</div>
</div>
</div>
<script src="{% static "frontend/pro.js" %}"></script>
<script>
window.RobosatsSettings = '<%= htmlWebpackPlugin.options.robosatsSettings %>'
</script>
</body>
</html>

View File

@ -1,6 +1,8 @@
import path from 'path';
import { Configuration } from 'webpack';
import CopyPlugin from 'copy-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
import { version } from './package.json';
const config: Configuration = {
entry: './src/index.js',
@ -24,12 +26,82 @@ const config: Configuration = {
},
};
const configWeb: Configuration = {
const configNode: Configuration = {
...config,
output: {
path: path.resolve(__dirname, 'static/frontend'),
filename: 'main.js',
filename: `main.v${version}.[contenthash].js`,
clean: true,
publicPath: '/static/frontend/',
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'),
filename: path.resolve(__dirname, '../nodeapp/basic.html'),
robosatsSettings: 'selfhosted-basic',
inject: 'body',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/pro.html'),
filename: path.resolve(__dirname, '../nodeapp/pro.html'),
robosatsSettings: 'selfhosted-pro',
inject: 'body',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'),
filename: path.resolve(__dirname, '../web/basic.html'),
robosatsSettings: 'web-basic',
inject: 'body',
}),
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/pro.html'),
filename: path.resolve(__dirname, '../web/pro.html'),
robosatsSettings: 'web-pro',
inject: 'body',
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'static'),
to: path.resolve(__dirname, '../nodeapp/static'),
},
],
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'static'),
to: path.resolve(__dirname, '../web/static'),
},
],
}),
],
};
const configDesktop: Configuration = {
...config,
output: {
path: path.resolve(__dirname, '../desktopApp/static/frontend'),
filename: `main.v${version}.[contenthash].js`,
clean: true,
publicPath: '/static/frontend/',
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'),
filename: path.resolve(__dirname, '../desktopApp/index.html'),
robosatsSettings: 'desktop-basic',
inject: 'body',
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'static'),
to: path.resolve(__dirname, '../desktopApp/static'),
},
],
}),
],
};
const configMobile: Configuration = {
@ -80,27 +152,27 @@ const configMobile: Configuration = {
],
},
plugins: [
new HtmlWebpackPlugin({
template: path.resolve(__dirname, 'templates/frontend/basic.html'),
filename: path.resolve(__dirname, '../mobile/html/Web.bundle/index.html'),
robosatsSettings: 'mobile-basic',
inject: 'body',
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, 'static/css'),
to: path.resolve(__dirname, '../mobile/html/Web.bundle/css'),
},
{
from: path.resolve(__dirname, 'static/assets/sounds'),
to: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/sounds'),
},
{
from: path.resolve(__dirname, 'static/federation'),
to: path.resolve(__dirname, '../mobile/html/Web.bundle/assets/federation'),
to: path.resolve(__dirname, '../mobile/html/Web.bundle/static'),
},
],
}),
],
output: {
path: path.resolve(__dirname, '../mobile/html/Web.bundle/js'),
filename: 'main.js',
path: path.resolve(__dirname, '../mobile/html/Web.bundle/static/frontend'),
filename: `main.v${version}.[contenthash].js`,
clean: true,
publicPath: '/static/frontend/',
},
};
export default [configWeb, configMobile];
export default [configNode, configDesktop, configMobile];

3
mobile/.gitignore vendored
View File

@ -63,5 +63,4 @@ buck-out/
/vendor/bundle/
# frontend js
/html/Web.bundle/js*
/html/Web.bundle/css*
/html/Web.bundle/static*

View File

@ -1,55 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" href="css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="css/loader.css"/>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
<link rel="stylesheet" type="text/css" href="css/leaflet.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script src="js/main.js"></script>
</body>
</html>

View File

@ -1,63 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="/static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-192x192.png" sizes="192x192">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" href="/static/css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/leaflet.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
window.RobosatsSettings = 'selfhosted-basic'
</script>
<script src="/static/frontend/main.js"></script>
</body>
</html>

View File

@ -1,19 +1,16 @@
version: '3.9'
# Frontend and node client development orchestration
name: robosats-frontend
name: robosats-nodeapp-frontend
services:
frontend:
build: ../frontend
container_name: npm-dev-frontend
container_name: nodeapp-dev-frontend
restart: always
command: npm run dev
volumes:
- ../frontend:/usr/src/frontend
- ../mobile:/usr/src/mobile
nodeapp:
nginx:
build: .
container_name: nodeapp-dev-frontend
container_name: nodeapp-dev-nginx
restart: always
environment:
TOR_PROXY_IP: 127.0.0.1
@ -23,11 +20,10 @@ services:
- ./:/usr/src/robosats/
- ./nginx.conf:/etc/nginx/nginx.conf
- ./coordinators/:/etc/nginx/conf.d/
- ../frontend/static:/usr/src/robosats/static
tor:
build: ../docker/tor
container_name: tor-dev-frontend
container_name: nodeapp-dev-tor
restart: always
environment:
LOCAL_USER_ID: 1000

View File

@ -64,14 +64,6 @@ http {
autoindex on;
}
location /nostr {
proxy_pass http://127.0.0.1:7777;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
}
location = /favicon.ico {
alias /usr/src/robosats/static/assets/images/favicon-96x96.png;
}

View File

@ -1,65 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="/static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-192x192.png" sizes="192x192">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats PRO - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" href="/static/css_pro/fonts.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/leaflet.css"/>
<link rel="stylesheet" type="text/css" href="/css_pro/react-grid-layout.css"/>
<link rel="stylesheet" type="text/css" href="/css_pro/react-resizable.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
window.RobosatsSettings = 'selfhosted-pro'
</script>
<script src="/static/frontend/main.js"></script>
</body>
</html>

View File

@ -1,63 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="/static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-192x192.png" sizes="192x192">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" href="/static/css/fonts.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/leaflet.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
window.RobosatsSettings = 'web-basic'
</script>
<script src="/static/frontend/main.js"></script>
</body>
</html>

20
web/docker-compose.yml Normal file
View File

@ -0,0 +1,20 @@
version: '3.9'
# Frontend and node client development orchestration
name: robosats-web-frontend
services:
frontend:
build: ../frontend
container_name: web-dev-frontend
restart: always
command: npm run dev
nginx:
build: .
container_name: web-dev-nginx
restart: always
volumes:
- ./:/usr/src/robosats/
- ./nginx.conf:/etc/nginx/nginx.conf
- ./coordinators/:/etc/nginx/conf.d/
ports:
- 80:80

View File

@ -1,65 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="/static/assets/images/favicon-96x96.png" />
<link rel="icon" type="image/png" href="/static/assets/images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-96x96.png" sizes="96x96">
<link rel="icon" type="image/png" href="/static/assets/images/favicon-192x192.png" sizes="192x192">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="A simple and private way to exchange bitcoin for national currencies. Robosats simplifies the peer-to-peer user experience and uses lightning hold invoices to minimize custody and trust requirements. No user registration required.">
<title>RoboSats PRO - Simple and Private Bitcoin Exchange</title>
<link rel="stylesheet" href="/static/css_pro/fonts.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/loader.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/index.css"/>
<link rel="stylesheet" type="text/css" href="/static/css/leaflet.css"/>
<link rel="stylesheet" type="text/css" href="/css_pro/react-grid-layout.css"/>
<link rel="stylesheet" type="text/css" href="/css_pro/react-resizable.css"/>
</head>
<body>
<noscript>
<div>
This site requires JavaScript. This message is only visible if you have it disabled. <br/><br/>
If you are using TOR browser set the "Security Level" to "Standard". If you keep seeing this message clear cache and storage of TOR browser app and retry.<br/><br/>
If the problem persists, ask for support in the RoboSats telegram group<a href="https://t.me/robosats"> (t.me/robosats)</a>
</div>
</noscript>
<div id="main">
<div id="app">
<div class="loaderCenter">
<div class="loaderSpinner"></div>
<div class="content-slider">
<div class="slider">
<div class="mask">
<ul>
<li class="anim1">
<div class="quote">Looking for robot parts ...</div>
</li>
<li class="anim2">
<div class="quote">Adding layers to the onion ...</div>
</li>
<li class="anim3">
<div class="quote">Winning at game theory ...</div>
</li>
<li class="anim4">
<div class="quote">Moving Sats at light speed ...</div>
</li>
<li class="anim5">
<div class="quote">Hiding in 2^256 bits of entropy...</div>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<script>
window.RobosatsSettings = 'web-pro'
</script>
<script src="/static/frontend/main.js"></script>
</body>
</html>