From e68b4cc0e8b87a523035c09e5ef3ed5f5a1d8410 Mon Sep 17 00:00:00 2001
From: srgooglo <38926803+srgooglo@users.noreply.github.com>
Date: Sun, 22 Mar 2020 17:29:58 +0100
Subject: [PATCH] 0.2.22A1
---
.env | 3 +-
.umirc.js | 1 +
app/main.js | 112 +++++++++++
app/preload.js | 8 +
app/renderer.js | 3 +
config/app.settings.js | 36 ++--
config/ycore.config.js | 5 +-
globals/settings.js | 40 ++--
mock/_utils.js | 40 ----
mock/route.js | 30 ---
package.json | 61 +++---
public/preload.js | 8 +
public/renderer.js | 3 +
src/@ycore/libs/comty_ng/pre.js | 34 +++-
src/@ycore/libs/ycore_styles/pre.js | 4 +-
src/@ycore/libs/yulio_id/pre.js | 6 +-
src/@ycore/ycore_worker.js | 29 +--
src/components/HeaderSearch/index.js | 2 +-
.../Layout/Secondary/components/post.js | 102 ----------
.../Layout/Secondary/components/post.less | 176 ------------------
src/components/Layout/Sider.js | 2 +-
src/components/Loader/Loader.js | 4 +-
src/components/MainFeed/index.js | 36 +++-
src/components/PostCard/index.js | 35 +++-
src/components/PostCreator/index.js | 21 +--
src/components/UserProfile/index.js | 3 +-
src/components/YulioID/index.js | 2 +-
src/layouts/PrimaryLayout.js | 2 +-
src/models/app.js | 7 +-
src/pages/__m/index.js | 21 ++-
src/pages/index.js | 6 +-
src/pages/settings/components/base.js | 6 +-
webpack.config.js | 7 +
33 files changed, 370 insertions(+), 485 deletions(-)
create mode 100644 app/main.js
create mode 100644 app/preload.js
create mode 100644 app/renderer.js
delete mode 100755 mock/_utils.js
delete mode 100755 mock/route.js
create mode 100644 public/preload.js
create mode 100644 public/renderer.js
delete mode 100644 src/components/Layout/Secondary/components/post.js
delete mode 100644 src/components/Layout/Secondary/components/post.less
create mode 100644 webpack.config.js
diff --git a/.env b/.env
index 5fdcd49b..45da7143 100755
--- a/.env
+++ b/.env
@@ -1 +1,2 @@
-UMI_UI=none
\ No newline at end of file
+UMI_UI=none
+NODE_ENV=production
\ No newline at end of file
diff --git a/.umirc.js b/.umirc.js
index 2c6c3a95..b15243eb 100755
--- a/.umirc.js
+++ b/.umirc.js
@@ -2,6 +2,7 @@
import { resolve } from 'path';
import { i18n } from './config/ycore.config.js';
export default {
+
ignoreMomentLocale: true,
targets: {
ie: 9,
diff --git a/app/main.js b/app/main.js
new file mode 100644
index 00000000..ab74862d
--- /dev/null
+++ b/app/main.js
@@ -0,0 +1,112 @@
+// Modules to control application life and create native browser window
+
+const path = require('path');
+const exec = require('child_process').exec;
+const { app, BrowserWindow, ipcMain } = require('electron');
+
+const isDev = process.env.NODE_ENV === 'development';
+
+ipcMain.on('print', async (event, arg) => {
+ // todo:下载网络文件到本地打印
+ arg.pdf = `${__dirname}/ReferenceCard.pdf`;
+ const fileUrl = arg.pdf;
+ switch (process.platform) {
+ case 'darwin':
+ case 'linux':
+ await exec('lp ' + fileUrl, (e) => {
+ if (e) throw e;
+ });
+ event.reply('asynchronous-reply', 'print done!');
+ break;
+ case 'win32':
+ await exec('print ' + fileUrl, {
+ windowsHide: true,
+ }, (e) => {
+ if (e) throw e;
+ });
+ event.reply('asynchronous-reply', 'print done!');
+ break;
+ default:
+ event.reply('asynchronous-reply', 'print failed!');
+ throw new Error(
+ 'Platform not supported.',
+ );
+ }
+});
+// Keep a global reference of the window object, if you don't, the window will
+// be closed automatically when the JavaScript object is garbage collected.
+let mainWindow;
+
+const installExtensions = async () => {
+ const installer = require('electron-devtools-installer');
+ const extensions = ['REACT_DEVELOPER_TOOLS', 'REDUX_DEVTOOLS'];
+ const forceDownload = !!process.env.UPGRADE_EXTENSIONS;
+ for (const name of extensions) {
+ try {
+ await installer.default(installer[name], forceDownload);
+ } catch (e) {
+ console.log(`Error installing ${name} extension: ${e.message}`);
+ }
+ }
+};
+
+async function createWindow() {
+ isDev && await installExtensions();
+
+ // Create the browser window.
+ mainWindow = new BrowserWindow({
+ width: 1000,
+ height: 600,
+ webPreferences: {
+ nodeIntegration: true,
+ preload: path.join(__dirname, 'preload.js'),
+ },
+ });
+
+ // and load the index.html of the app.
+ if (isDev) {
+ mainWindow.loadURL('http://localhost:8000/');
+ // Open the DevTools only if in development mode.
+ mainWindow.webContents.openDevTools();
+ } else {
+ const rdurl = path.join(__dirname, '../dist/index.html') // path.join(__dirname, '../dist/index.html')
+ console.log(rdurl)
+ mainWindow.loadFile(rdurl)
+
+ }
+
+ // Emitted when the window is closed.
+ mainWindow.on('closed', function() {
+ // Dereference the window object, usually you would store windows
+ // in an array if your app supports multi windows, this is the time
+ // when you should delete the corresponding element.
+ mainWindow = null;
+ });
+}
+
+// hot reload
+isDev && require('electron-reload')(__dirname, {
+ electron: require(`${__dirname}/../node_modules/electron`),
+ ignored: /node_modules|[\/\\]\./,
+});
+
+// This method will be called when Electron has finished
+// initialization and is ready to create browser windows.
+// Some APIs can only be used after this event occurs.
+app.on('ready', createWindow);
+
+// Quit when all windows are closed.
+app.on('window-all-closed', function() {
+ // On macOS it is common for applications and their menu bar
+ // to stay active until the user quits explicitly with Cmd + Q
+ if (process.platform !== 'darwin') app.quit();
+});
+
+app.on('activate', function() {
+ // On macOS it's common to re-create a window in the app when the
+ // dock icon is clicked and there are no other windows open.
+ if (mainWindow === null) createWindow();
+});
+
+// In this file you can include the rest of your app's specific main process
+// code. You can also put them in separate files and require them here.
\ No newline at end of file
diff --git a/app/preload.js b/app/preload.js
new file mode 100644
index 00000000..6d28f055
--- /dev/null
+++ b/app/preload.js
@@ -0,0 +1,8 @@
+// All of the Node.js APIs are available in the preload process.
+// It has the same sandbox as a Chrome extension.
+window.addEventListener('DOMContentLoaded', () => {
+ for (const versionType of ['chrome', 'electron', 'node']) {
+ console.log(`${versionType}-version`, process.versions[versionType]);
+ }
+ });
+
\ No newline at end of file
diff --git a/app/renderer.js b/app/renderer.js
new file mode 100644
index 00000000..901d75ec
--- /dev/null
+++ b/app/renderer.js
@@ -0,0 +1,3 @@
+// This file is required by the index.html file and will
+// be executed in the renderer process for that window.
+// All of the Node.js APIs are available in this process.
diff --git a/config/app.settings.js b/config/app.settings.js
index e9926e04..526edb06 100755
--- a/config/app.settings.js
+++ b/config/app.settings.js
@@ -1,5 +1,19 @@
-import {ReturnDevOption} from 'ycore'
-export var DevOptions = {
+function SettingStoragedValue(e){
+ try {
+ const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
+ const Ite = fromStorage.map(item => {
+ return item.SettingID === e? item.value : null
+ })
+ const fr = Ite.filter(Boolean)
+ return fr.toString()
+ }
+ catch (error) {
+ return null
+ }
+}
+const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
+
+export var AppSettings = {
// Global Behaviors
InfiniteLoading: false,
InfiniteLogin: false,
@@ -8,16 +22,14 @@ export var DevOptions = {
DisableRegister: true,
DisablePasswordRecover: true,
// Activating this, the logs must be trowed
- ShowFunctionsLogs: ReturnDevOption('force_showDevLogs'),
- StrictLightMode: ReturnDevOption('strict_lightMode'),
- SignForNotExpire: ReturnDevOption('sessions_noexpire'),
- auto_search_ontype: ReturnDevOption('auto_search_ontype'),
- auto_feedrefresh: ReturnDevOption('auto_feedrefresh'),
- default_showpostcreator: ReturnDevOption('default_showpostcreator'),
- default_collapse_sider: ReturnDevOption('default_collapse_sider'),
- use_dev_server: ReturnDevOption('use_dev_server'),
- force_show_postactions: ReturnDevOption('force_show_postactions'),
- MaxJWTexpire: 1556952, //1556952
+ force_showDevLogs: fromStorage? SettingStoragedValue('force_showDevLogs') : false,
+ StrictLightMode: fromStorage? SettingStoragedValue('strict_lightMode') : false,
+ SignForNotExpire: fromStorage? SettingStoragedValue('sessions_noexpire') : false,
+ auto_search_ontype: fromStorage? SettingStoragedValue('auto_search_ontype') : false,
+ auto_feedrefresh: fromStorage? SettingStoragedValue('auto_feedrefresh') : false,
+ default_showpostcreator: fromStorage? SettingStoragedValue('default_showpostcreator') : false,
+ default_collapse_sider: fromStorage? SettingStoragedValue('default_collapse_sider') : true,
+ force_show_postactions: fromStorage? SettingStoragedValue('force_show_postactions') : false,
MaxLengthPosts: '512',
CurrentBundle: 'light_ng',
// In KB
diff --git a/config/ycore.config.js b/config/ycore.config.js
index 26b3cdc0..e85081dc 100755
--- a/config/ycore.config.js
+++ b/config/ycore.config.js
@@ -10,6 +10,7 @@ module.exports = {
resource_bundle: 'light_ng',
+
/* Layout configuration, specify which layout to use for route. */
layouts: [
{
@@ -23,7 +24,9 @@ module.exports = {
// Global Server Key (Requiered for RS-YIBTP), Not autogenerated, must be included on. (Recommended not modify this constants)
server_key: "f706b0a535b6c2d36545c4137a0a3a26853ea8b5-1223c9ba7923152cae28e5a2e7501b2b-50600768",
},
-
+ App_Config: {
+ InitRes: '800x600',
+ },
i18n: {
languages: [
diff --git a/globals/settings.js b/globals/settings.js
index 2106037e..af46a4e2 100755
--- a/globals/settings.js
+++ b/globals/settings.js
@@ -1,68 +1,74 @@
-const ycore = require('ycore')
const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
-export var AppSettings = [
+function SettingStoragedValue(e){
+ try {
+ const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
+ const Ite = fromStorage.map(item => {
+ return item.SettingID === e? item.value : null
+ })
+ const fr = Ite.filter(Boolean)
+ return fr.toString()
+ }
+ catch (error) {
+ return null
+ }
+}
+
+export var ListSettings = [
{
"SettingID": "strict_lightMode",
"type" : "switch",
"title": "Strict Light Mode",
"description": "Force the app to apply full light mode theme when the light mode is activated... (Experimental)",
- "value": fromStorage? ycore.StorageValued('strict_lightMode') : false
+ "value": fromStorage? SettingStoragedValue('strict_lightMode') : false
},
{
"SettingID": "default_collapse_sider",
"type" : "switch",
"title": "Default Collapse Sider",
"description": "Force the app to apply collapsed mode theme when the app is mounted...",
- "value": fromStorage? ycore.StorageValued('default_collapse_sider') : true
+ "value": fromStorage? SettingStoragedValue('default_collapse_sider') : true
},
{
"SettingID": "auto_feedrefresh",
"type" : "switch",
"title": "Auto Feed Refresh",
"description": "Force the app to auto refresh the posts feed when exist news posts for update",
- "value": fromStorage? ycore.StorageValued('auto_feedrefresh') : false
+ "value": fromStorage? SettingStoragedValue('auto_feedrefresh') : false
},
{
"SettingID": "force_showDevLogs",
"type" : "switch",
"title": "Show Functions Logs",
"description": "Show all console logs... [Developer]",
- "value": fromStorage? ycore.StorageValued('force_showDevLogs') : false
+ "value": fromStorage? SettingStoragedValue('force_showDevLogs') : false
},
{
"SettingID": "sessions_noexpire",
"type" : "switch",
"title": "No expire session",
"description": "Force the app to not expire any session... [Developer]",
- "value": fromStorage? ycore.StorageValued('sessions_noexpire') : false
+ "value": fromStorage? SettingStoragedValue('sessions_noexpire') : false
},
{
"SettingID": "auto_search_ontype",
"type" : "switch",
"title": "Auto search",
"description": "Force the app to automaticly search when a type input is detected... [Developer]",
- "value": fromStorage? ycore.StorageValued('auto_search_ontype') : false
+ "value": fromStorage? SettingStoragedValue('auto_search_ontype') : false
},
{
"SettingID": "default_showpostcreator",
"type" : "switch",
"title": "Show default Post Creator",
"description": "Force the app to automaticly search when a type input is detected... [Developer]",
- "value": fromStorage? ycore.StorageValued('default_showpostcreator') : false
+ "value": fromStorage? SettingStoragedValue('default_showpostcreator') : false
},
{
"SettingID": "force_show_postactions",
"type" : "switch",
"title": "Not auto hide Posts Actions",
"description": "Force the app to dont hide the post actions (likes, comments ...etc) automaticly... [Developer]",
- "value": fromStorage? ycore.StorageValued('force_show_postactions') : false
- },
- {
- "SettingID": "use_dev_server",
- "type" : "switch",
- "title": "Use Comty™ Development Server",
- "description": "Force the app to connect to an development server... [High Recomended]",
- "value": fromStorage? ycore.StorageValued('use_dev_server') : false
+ "value": fromStorage? SettingStoragedValue('force_show_postactions') : false
},
]
diff --git a/mock/_utils.js b/mock/_utils.js
deleted file mode 100755
index deeb2000..00000000
--- a/mock/_utils.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Query objects that specify keys and values in an array where all values are objects.
- * @param {array} array An array where all values are objects, like [{key:1},{key:2}].
- * @param {string} key The key of the object that needs to be queried.
- * @param {string} value The value of the object that needs to be queried.
- * @return {object|undefined} Return frist object when query success.
- */
-export function queryArray(array, key, value) {
- if (!Array.isArray(array)) {
- return
- }
- return array.filter(_ => _[key] === value)
-}
-
-export function randomNumber(min, max) {
- return Math.floor(Math.random() * (max - min) + min)
-}
-
-export const Constant = {
- ApiPrefix: '/api/v1',
- NotFound: {
- message: 'Not Found',
- documentation_url: '',
- },
- Color: {
- green: '#64ea91',
- blue: '#8fc9fb',
- purple: '#d897eb',
- red: '#f69899',
- yellow: '#f8c82e',
- peach: '#f797d6',
- borderBase: '#e5e5e5',
- borderSplit: '#f4f4f4',
- grass: '#d6fbb5',
- sky: '#c1e0fc',
- },
-}
-
-export Mock from 'mockjs'
-export qs from 'qs'
diff --git a/mock/route.js b/mock/route.js
deleted file mode 100755
index 8a0145f8..00000000
--- a/mock/route.js
+++ /dev/null
@@ -1,30 +0,0 @@
-import {
- Constant
-} from './_utils'
-const {
- ApiPrefix
-} = Constant
-
-const database = [
-
- // DASHBOARD SECTION
- {
- id: '1',
- icon: 'home',
- name: 'Main',
- route: '/main',
- },
- {
- id: '2',
- icon: 'user',
- name: 'App Settings',
- route: '/settings'
- }
-
-]
-
-module.exports = {
- [`GET ${ApiPrefix}/routes`](req, res) {
- res.status(200).json(database)
- },
-}
\ No newline at end of file
diff --git a/package.json b/package.json
index 0cd8a538..6bd8060e 100755
--- a/package.json
+++ b/package.json
@@ -1,73 +1,50 @@
{
"name": "comty-development",
- "UUID": "annyudx7eo",
+ "UUID": "C8mVSr-4nmPp2-pr5Vrz-CU4kg4",
"title": "Comty™",
"DevBuild": true,
- "version": "0.2.19",
+ "version": "0.2.22",
"description": "",
- "main": "index.js",
+ "main": "app/main.js",
"author": "RageStudio",
"license": "ISC",
+ "build": {
+ "appId": "com.ragestudio.comtydesktop",
+ "mac": {
+ "category": "ragestudio.comty.social.desktop"
+ }
+ },
"dependencies": {
"@ant-design/compatible": "^1.0.1",
- "@ant-design/pro-layout": "^5.0.0",
- "@lingui/react": "^2.9.1",
"@material-ui/core": "^4.9.3",
"@material-ui/icons": "^4.9.1",
- "@steveeeie/react-page-transition": "^1.1.2",
- "ant-design-pro": "^2.3.2",
"antd": "^4.0.2",
- "autoprefixer": "9.7.4",
"axios": "^0.19.2",
"babel-core": "7.0.0-bridge.0",
- "bcryptjs": "^2.4.3",
- "body-parser": "^1.19.0",
"classnames": "^2.2.6",
- "concurrently": "^5.1.0",
"cryptr": "^6.0.1",
"dotenv": "^8.2.0",
"dva-model-extend": "^0.1.2",
"enquire-js": "^0.2.1",
- "immutability-helper": "^3.0.1",
- "is-empty": "^1.2.0",
"jquery": "^3.4.1",
- "json-format": "^1.0.1",
"jsonwebtoken": "^8.5.1",
"localforage": "^1.7.3",
"lodash": "^4.17.15",
"md5": "^2.2.1",
"moment": "^2.24.0",
"node-sass": "^4.13.1",
- "nprogress": "^0.2.0",
"os-utils": "0.0.14",
- "passport": "^0.4.1",
- "passport-auth0": "^1.3.2",
- "passport-jwt": "^4.0.0",
"path-to-regexp": "^6.1.0",
"prop-types": "^15.7.2",
- "qs": "^6.9.1",
"radium": "^0.26.0",
- "rc-tween-one": "^2.6.8",
"react-animations": "^1.0.0",
"react-dazzle": "^1.4.0",
- "react-fullscreen-crossbrowser": "^1.0.9",
"react-helmet": "^5.2.1",
- "react-iframe": "^1.8.0",
- "react-image": "^2.4.0",
- "react-infinite-scroller": "^1.2.4",
- "react-modal": "^3.11.1",
- "react-new-window": "^0.1.2",
- "react-notifications": "^1.4.3",
"react-perfect-scrollbar": "^1.5.8",
- "react-responsive": "^8.0.3",
- "react-router": "^5.1.2",
"react-scripts": "^3.3.1",
"react-select-country-list": "^2.1.2",
"react-sound": "^1.2.0",
- "react-transition-group": "^4.3.0",
"react-virtualized": "^9.21.2",
- "recompose": "^0.30.0",
- "sqlite": "^3.0.3",
"store": "^2.0.12",
"ts-cookies": "^1.0.0",
"umi-plugin-datahub": "^4.1.0",
@@ -84,6 +61,10 @@
"babel-plugin-macros": "^2.8.0",
"babel-plugin-module-resolver": "^4.0.0",
"cross-env": "^7.0.0",
+ "electron": "^8.1.1",
+ "electron-builder": "^22.4.1",
+ "electron-devtools-installer": "^2.2.4",
+ "electron-reload": "^1.5.0",
"eslint": "^6.8.0",
"eslint-config-react-app": "^5.2.0",
"eslint-plugin-flowtype": "^4.6.0",
@@ -93,7 +74,6 @@
"husky": "^4.2.3",
"less-vars-to-js": "^1.3.0",
"lint-staged": "^10.0.7",
- "mockjs": "^1.1.0",
"module": "^1.2.5",
"now": "^17.0.3",
"prettier": "^1.19.1",
@@ -125,9 +105,18 @@
}
},
"scripts": {
- "day": "umi dev && grunt bump minor",
- "app-dev": "umi dev && grunt bump",
- "tsc:w": "tsc -w",
+ "clean": "rimraf dist",
+ "postinstall": "electron-builder install-app-deps",
+ "app-dev": "concurrently \"npm run start\" \"wait-on http://localhost:8000 && npm run electron-dev\"",
+ "electron-dev": "cross-env NODE_ENV=development electron .",
+ "electron-prod": "cross-env NODE_ENV=production electron .",
+ "pack:mac": "npm run clean && npm run build && npm run private:build:mac",
+ "pack:win": "npm run clean && npm run build && npm run private:build:win",
+ "pack:linux": "npm run clean && npm run build && npm run private:build:linux",
+ "private:build:all": "electron-builder -mwl",
+ "private:build:mac": "electron-builder --mac",
+ "private:build:win": "electron-builder -c.extraMetadata.main=public/electron.js --win --x64",
+ "private:build:linux": "electron-builder --linux",
"analyze": "cross-env ANALYZE=1 umi build",
"build": "umi build",
"start": "umi dev",
diff --git a/public/preload.js b/public/preload.js
new file mode 100644
index 00000000..6d28f055
--- /dev/null
+++ b/public/preload.js
@@ -0,0 +1,8 @@
+// All of the Node.js APIs are available in the preload process.
+// It has the same sandbox as a Chrome extension.
+window.addEventListener('DOMContentLoaded', () => {
+ for (const versionType of ['chrome', 'electron', 'node']) {
+ console.log(`${versionType}-version`, process.versions[versionType]);
+ }
+ });
+
\ No newline at end of file
diff --git a/public/renderer.js b/public/renderer.js
new file mode 100644
index 00000000..901d75ec
--- /dev/null
+++ b/public/renderer.js
@@ -0,0 +1,3 @@
+// This file is required by the index.html file and will
+// be executed in the renderer process for that window.
+// All of the Node.js APIs are available in this process.
diff --git a/src/@ycore/libs/comty_ng/pre.js b/src/@ycore/libs/comty_ng/pre.js
index 597bcb63..31fae58f 100755
--- a/src/@ycore/libs/comty_ng/pre.js
+++ b/src/@ycore/libs/comty_ng/pre.js
@@ -1,8 +1,40 @@
import * as ycore from 'ycore'
var jquery = require("jquery");
import * as Icons from '@ant-design/icons'
+import { RenderFeed } from 'components/MainFeed'
+export const FeedHandler = {
+ refresh: () => {
+ RenderFeed.RefreshFeed()
+ },
+ killByID: (post_id) => {
+ RenderFeed.killByID(post_id)
+ },
+ addToRend: (payload) => {
+ RenderFeed.addToRend(payload)
+ }
+}
+
+export const IsThisPost = {
+ owner: (post_uid) => {
+ const a = ycore.handlerYIDT.__id()
+ if (post_uid == a) {
+ return true
+ }
+ return false
+ },
+ boosted: () => {
+
+ },
+ pinned: () => {
+
+ },
+ flagged: () => {
+
+ }
+}
+
export function GetGeneralData(callback){
let formdata = new FormData();
formdata.append("user_id", id);
@@ -252,7 +284,7 @@ export function GetPosts(userid, type, fkey, callback) {
let formdata = new FormData();
formdata.append("server_key", ycore.yConfig.server_key);
formdata.append("after_post_id", (fkey || 0))
- formdata.append("limit", ycore.DevOptions.limit_post_catch || 20)
+ formdata.append("limit", ycore.AppSettings.limit_post_catch || 20)
switch (type) {
case 'feed':
formdata.append("type", "get_news_feed");
diff --git a/src/@ycore/libs/ycore_styles/pre.js b/src/@ycore/libs/ycore_styles/pre.js
index d1bb4bba..16f1f74f 100755
--- a/src/@ycore/libs/ycore_styles/pre.js
+++ b/src/@ycore/libs/ycore_styles/pre.js
@@ -1,8 +1,8 @@
-import {DevOptions} from 'ycore'
+import {AppSettings} from 'ycore'
export function CurrentTheme(){
try {
- const bundle = localStorage.getItem('resource_bundle') || DevOptions.resource_bundle
+ const bundle = localStorage.getItem('resource_bundle') || AppSettings.resource_bundle
console.log('Loading resource Bundle =>', bundle)
return bundle
} catch (error) {
diff --git a/src/@ycore/libs/yulio_id/pre.js b/src/@ycore/libs/yulio_id/pre.js
index b1457eec..0ff10389 100755
--- a/src/@ycore/libs/yulio_id/pre.js
+++ b/src/@ycore/libs/yulio_id/pre.js
@@ -27,10 +27,10 @@ function __API__User (payload, sdcp){
dev,
is_pro,
username,
- exp: ycore.DevOptions.SignForNotExpire? 0 : Math.floor(Date.now() / 1000) + (60 * 60),
+ exp: ycore.AppSettings.SignForNotExpire? 0 : Math.floor(Date.now() / 1000) + (60 * 60),
}
ycore.handlerYIDT.set(frame, done => {
- done? ycore.RefreshONCE() : null
+ done? ycore.crouter.native('main') : null
})
}
@@ -82,7 +82,7 @@ export function ValidLoginSession(callback){
let validtoken = false;
const a = Cookies.get('cid');
if (a) {
- const modExp = ycore.DevOptions.SignForNotExpire;
+ const modExp = ycore.AppSettings.SignForNotExpire;
const ad = jwt.decode(a)
let notexp = true; // Sets if this is expired (Default is not expired)
diff --git a/src/@ycore/ycore_worker.js b/src/@ycore/ycore_worker.js
index 6687bf31..98957cd1 100755
--- a/src/@ycore/ycore_worker.js
+++ b/src/@ycore/ycore_worker.js
@@ -5,7 +5,7 @@
* @licensed Pending...
*/
-import {AppSettings} from "../../globals/settings.js";
+import {ListSettings} from "../../globals/settings.js";
import {Endpoints} from "globals/endpoints.js";
import * as Icons from '@ant-design/icons';
import localforage from "localforage"
@@ -99,7 +99,7 @@ export const AppInfo = {
* @param e {String} String of SettingID for search
* @return {string} Boolean value
*/
-export function StorageValued(e){
+export function SettingStoragedValue(e){
try {
const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
const Ite = fromStorage.map(item => {
@@ -113,20 +113,6 @@ export function StorageValued(e){
}
}
-/**
- * Return the values as alias (AppSettings, DevOptions)
- *
- * @param e {String} String of SettingID for search
- * @return {string} Boolean value
- */
-export function ReturnDevOption(e){
- const Ite = AppSettings.map(item => {
- return item.SettingID === e? item.value : null
- })
- const fr = Ite.filter(Boolean)
- return fr.toString()
-}
-
/**
* Global fix for convert '1, 0' to string boolean 'true, false'
*
@@ -202,7 +188,7 @@ export function requestFullscreen(){
*
*/
export function RefreshONCE(){
- window.location.reload();
+ window.location = "/"
}
/**
* Parse information about this App
@@ -236,6 +222,7 @@ export function DetectNoNStableBuild(e1) {
break;
}
}
+
/**
* User console with setting user permissions
*
@@ -243,19 +230,19 @@ export function DetectNoNStableBuild(e1) {
*/
export const yconsole = {
log: (...cont)=>{
- ReturnDevOption('force_showDevLogs')? console.log(...cont) : null
+ SettingStoragedValue('force_showDevLogs')? console.log(...cont) : null
return
},
debug: (...cont)=>{
- ReturnDevOption('force_showDevLogs')? console.debug(...cont) : null
+ SettingStoragedValue('force_showDevLogs')? console.debug(...cont) : null
return
},
error: (...cont)=>{
- ReturnDevOption('force_showDevLogs')? console.error(...cont) : null
+ SettingStoragedValue('force_showDevLogs')? console.error(...cont) : null
return
},
warn: (...cont)=>{
- ReturnDevOption('force_showDevLogs')? console.warn(...cont) : null
+ SettingStoragedValue('force_showDevLogs')? console.warn(...cont) : null
return
}
}
\ No newline at end of file
diff --git a/src/components/HeaderSearch/index.js b/src/components/HeaderSearch/index.js
index 1371632e..cf46547f 100755
--- a/src/components/HeaderSearch/index.js
+++ b/src/components/HeaderSearch/index.js
@@ -39,7 +39,7 @@ export default class HeaderSearch extends Component {
onChange = e => {
const { value } = e.target;
this.setState({value: value})
- if (ycore.DevOptions.auto_search_ontype == 'true') {
+ if (ycore.AppSettings.auto_search_ontype == 'true') {
this.autosend()
}
};
diff --git a/src/components/Layout/Secondary/components/post.js b/src/components/Layout/Secondary/components/post.js
deleted file mode 100644
index 37a34b76..00000000
--- a/src/components/Layout/Secondary/components/post.js
+++ /dev/null
@@ -1,102 +0,0 @@
-import React from 'react'
-import * as antd from 'antd'
-import styles from './post.less'
-import {CustomIcons, LikeBTN} from 'components'
-import * as ycore from 'ycore'
-import * as Icons from '@ant-design/icons';
-
-const { Meta } = antd.Card;
-
-// Set default by configuration
-const emptyPayload = {user: 'Post Empty', ago: 'This Post is empty', avatar: 'https://zos.alipayobjects.com/rmsportal/ODTLcjxAfvqbxHnVXCYX.png', content: 'Test Test' }
-
-export default class SecondaryPostCard extends React.Component{
- constructor(props){
- super(props),
- this.state = {
- FadeIN: true
- }
- }
-
- renderPostPlayer(payload){
- const ident = payload
- if (ident.includes('.mp4')) {
- return (
-
- )
- }
- if (ident.includes('.webm')) {
- return (
-
- )
- }
- if (ident.includes('.mp3')){
- return (
-
- )
- }
- if (ident.includes('.ogg')){
- return (
-
- )
- }
- else {
- return (
-
- )
- }
- }
-
- render(){
- const { payload, customActions } = this.props
- const ActShowMode = ycore.DevOptions.force_show_postactions
- const { id, post_time, postText, postFile, get_post_comments, postFileName, publisher, post_likes, is_post_pinned, is_liked } = payload || emptyPayload;
-
- const defaultActions = [
-