Skip to content

Commit

Permalink
Merge pull request #464 from golos-blockchain/dev
Browse files Browse the repository at this point in the history
Separating Wallet from Blogs
  • Loading branch information
Lex-Ai authored Nov 1, 2022
2 parents b761ddc + 80f4348 commit 5c65594
Show file tree
Hide file tree
Showing 130 changed files with 889 additions and 12,338 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ tmp/*
app/assets/static/*.js
app/assets/static/*.json
app/assets/sitemap.xml
default_cfg.js

config/golos.json
config/golos-dev.json
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ ENV PORT 8080
ENV NODE_ENV production

EXPOSE 8080
CMD [ "yarn", "run", "production" ]
CMD [ "yarn", "run", "prod" ]
43 changes: 3 additions & 40 deletions app/ResolveRoute.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
export const routeRegex = {
PostsIndex: /^\/(@[\w\.\d-]+)\/feed\/?$/,
UserProfile1: /^\/(@[\w\.\d-]+)\/?$/,
UserProfile2: /^\/(@[\w\.\d-]+)\/(blog|posts|comments|transfers|assets|create-asset|invites|curation-rewards|author-rewards|donates-from|donates-to|reputation|mentions|filled-orders|permissions|created|recent-replies|feed|password|witness|followed|followers|settings)\/??(?:&?[^=&]*=[^=&]*)*$/,
UserProfile2: /^\/(@[\w\.\d-]+)\/(blog|posts|comments|reputation|mentions|created|recent-replies|feed|followed|followers|settings)\/??(?:&?[^=&]*=[^=&]*)*$/,
UserProfile3: /^\/(@[\w\.\d-]+)\/[\w\.\d-]+/,
UserAssetEndPoints: /^\/(@[\w\.\d-]+)\/assets\/([\w\d.-]+)\/(update|transfer)$/,
UserEndPoints: /^(blog|posts|comments|transfers|assets|create-asset|invites|curation-rewards|author-rewards|donates-from|donates-to|reputation|mentions|filled-orders|permissions|created|recent-replies|feed|password|witness|followed|followers|settings)$/,
UserEndPoints: /^(blog|posts|comments|reputation|mentions|created|recent-replies|feed|followed|followers|settings)$/,
CategoryFilters: /^\/(hot|responses|donates|forums|trending|promoted|allposts|allcomments|created|active)\/?$/ig,
PostNoCategory: /^\/(@[\w\.\d-]+)\/([\w\d-]+)/,
Post: /^\/([\w\d\-\/]+)\/(\@[\w\d\.-]+)\/([\w\d-]+)\/?($|\?)/,
WorkerSort: /^\/workers\/([\w\d\-]+)\/?($|\?)/,
WorkerSearchByAuthor: /^\/workers\/([\w\d\-]+)\/(\@[\w\d.-]+)\/?($|\?)/,
WorkerRequest: /^\/workers\/([\w\d\-]+)\/(\@[\w\d.-]+)\/([\w\d-]+)\/?($|\?)/,
MarketPair: /^\/market\/([\w\d\.]+)\/([\w\d.]+)\/?($|\?)/,
PostJson: /^\/([\w\d\-\/]+)\/(\@[\w\d\.-]+)\/([\w\d-]+)(\.json)$/,
UserJson: /^\/(@[\w\.\d-]+)(\.json)$/,
UserNameJson: /^.*(?=(\.json))/
Expand All @@ -31,9 +26,6 @@ export default function resolveRoute(path)
if (path === '/start'){
return {page: 'Start'}
}
if (path === '/exchanges'){
return {page: 'Exchanges'}
}
if (path === '/services'){
return {page: 'Services'}
}
Expand All @@ -49,22 +41,6 @@ export default function resolveRoute(path)
if (path.match(/^\/tags\/?/)) {
return {page: 'Tags'};
}
if (path === '/change_password') {
return {page: 'ChangePassword'};
}
if (path === '/market') {
return {page: 'Market'};
}
let match = path.match(routeRegex.MarketPair);
if (match) {
return {page: 'Market', params: match.slice(1)};
}
if (path === '/~witnesses') {
return {page: 'Witnesses'};
}
if (path === '/workers') {
return {page: 'Workers'};
}
if (path === '/minused_accounts') {
return {page: 'MinusedAccounts'};
}
Expand Down Expand Up @@ -94,29 +70,16 @@ export default function resolveRoute(path)
if (path === '/search' || path.startsWith('/search/')) {
return {page: 'Search'};
}
match = path.match(routeRegex.WorkerRequest)
|| path.match(routeRegex.WorkerSearchByAuthor)
|| path.match(routeRegex.WorkerSort);
if (match) {
return {page: 'Workers', params: match.slice(1)};
}
match = path.match(routeRegex.PostsIndex);
let match = path.match(routeRegex.PostsIndex);
if (match) {
return {page: 'PostsIndex', params: ['home', match[1]]};
}
match = path.match(routeRegex.UserAssetEndPoints);
if (match) {
return {page: 'UserProfile', params: [match[1], 'assets', match[2], match[3]]};
}
match = path.match(routeRegex.UserProfile1) ||
// @user/"posts" is deprecated in favor of "comments" as of oct-2016 (#443)
path.match(routeRegex.UserProfile2);
if (match) {
return {page: 'UserProfile', params: match.slice(1)};
}
if (path === '/convert') {
return {page: 'ConvertAssetsLoader', params: []}
}
match = path.match(routeRegex.PostNoCategory);
if (match) {
return {page: 'PostNoCategory', params: match.slice(1)};
Expand Down
12 changes: 0 additions & 12 deletions app/RootRoute.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ export default {
]);
} else if (route.page === 'Start') {
cb(null, [require('@pages/Start')]);
} else if (route.page === 'Exchanges') {
cb(null, [require('@pages/Exchanges')]);
} else if (route.page === 'Services') {
cb(null, [require('@pages/Services')]);
} else if (route.page === 'Faq') {
Expand All @@ -40,12 +38,6 @@ export default {
cb(null, [require('@pages/XSS')]);
} else if (route.page === 'Tags') {
cb(null, [require('@pages/TagsIndex')]);
} else if (route.page === 'ChangePassword') {
cb(null, [require('@pages/ChangePasswordPage')]);
} else if (route.page === 'Witnesses') {
cb(null, [require('@pages/WitnessesLoader')]);
} else if (route.page === 'Workers') {
cb(null, [require('@pages/WorkersLoader')]);
} else if (route.page === 'MinusedAccounts') {
cb(null, [require('@pages/MinusedAccounts')]);
} else if (route.page === 'AppGotoURL') {
Expand All @@ -67,10 +59,6 @@ export default {
else cb(null, [require('@pages/SubmitPostServerRender')]);
} else if (route.page === 'UserProfile') {
cb(null, [require('@pages/UserProfile')]);
} else if (route.page === 'ConvertAssetsLoader') {
cb(null, [require('@pages/ConvertAssetsLoader')]);
} else if (route.page === 'Market') {
cb(null, [require('@pages/MarketLoader')]);
} else if (route.page === 'Post') {
cb(null, [require('@pages/PostPage')]);
} else if (route.page === 'PostNoCategory') {
Expand Down
125 changes: 125 additions & 0 deletions app/assets/icons/new/change_account.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion app/client_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const CATEGORIES = [
'искусство',
'история',
'кино',
'компьютеры',
'конкурсы',
'криптовалюты',
'культура',
Expand All @@ -89,6 +88,7 @@ export const CATEGORIES = [
'творчество',
'технологии',
'трейдинг',
'философия',
'фотография',
'хобби',
'экономика',
Expand Down
26 changes: 4 additions & 22 deletions app/components/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ import ScrollButton from '@elements/ScrollButton';
import { key_utils } from 'golos-lib-js/lib/auth/ecc';
import MiniHeader from '@modules/MiniHeader';
import golos from 'golos-lib-js';
import { session, pageSession } from 'golos-lib-js/lib/auth';
import tt from 'counterpart';
import PageViewsCounter from '@elements/PageViewsCounter';
import DialogManager from 'app/components/elements/common/DialogManager';
import { init as initAnchorHelper } from 'app/utils/anchorHelper';
import { authRegisterUrl, } from 'app/utils/AuthApiClient';
import { APP_ICON, VEST_TICKER, } from 'app/client_config';
import session from 'app/utils/session'

const GlobalStyle = createGlobalStyle`
body {
Expand Down Expand Up @@ -82,9 +82,9 @@ class App extends React.Component {

loadDownvotedPrefs = () => {
try {
const acc = session.load()
if (acc && acc[0]) {
const pref = localStorage.getItem('downvotedPref-' + acc[0])
const data = session.load()
if (data.currentName) {
const pref = localStorage.getItem('downvotedPref-' + data.currentName)
if (pref === 'gray_only') {
window.NO_HIDE = true
} else if (pref === 'no_gray') {
Expand Down Expand Up @@ -128,24 +128,6 @@ class App extends React.Component {
if (process.env.BROWSER) {
initAnchorHelper();
}

if (process.env.BROWSER) {
this.savedAuthCleaner();
}
}

savedAuthCleaner() {
setInterval(() => {
const saved = pageSession.load();
if (saved) {
const created = saved[0];
const now = Date.now();
if (now - created >= 3600000) {
console.log('session_id cleaned');
pageSession.clear();
}
}
}, 1000)
}

toggleBodyNightmode(nightmodeEnabled) {
Expand Down
Loading

0 comments on commit 5c65594

Please sign in to comment.