mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
0.2.08A1
This commit is contained in:
parent
b0bd46d6e2
commit
b77941ed30
@ -16,7 +16,9 @@ export var DevOptions = {
|
||||
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',
|
||||
MaxLengthPosts: '512',
|
||||
CurrentBundle: 'light_ng'
|
||||
CurrentBundle: 'light_ng',
|
||||
MaximunAPIPayload: '101376'
|
||||
}
|
@ -1,18 +1,18 @@
|
||||
module.exports = {
|
||||
Endpoints: {
|
||||
follow_user: "https://api.ragestudio.net/RSA-COMTY/yid/follow-user?access_token=",
|
||||
action_post: "https://api.ragestudio.net/RSA-COMTY/yid/post-actions?access_token=",
|
||||
get_posts: "https://api.ragestudio.net/RSA-COMTY/yid/posts?access_token=",
|
||||
find_user: "https://api.ragestudio.net/RSA-COMTY/yid/find_user?access_token=",
|
||||
search_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/search?access_token=",
|
||||
get_sessions: "https://api.ragestudio.net/RSA-COMTY/yid/session_id?access_token=",
|
||||
auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/auth",
|
||||
new_post: "https://api.ragestudio.net/RSA-COMTY/yid/new_post?access_token=",
|
||||
get_config_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/get-site-settings?access_token=",
|
||||
get_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/get-user-data?access_token=",
|
||||
update_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/update-user-data?access_token=",
|
||||
removeToken: "https://api.ragestudio.net/RSA-COMTY/yid/delete-access-token?access_token=",
|
||||
register_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/create-account",
|
||||
resetPassword_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/send-reset-password-email?access_token=",
|
||||
follow_user: "https://api.ragestudio.net/RSA-COMTY/r/follow-user?access_token=",
|
||||
action_post: "https://api.ragestudio.net/RSA-COMTY/r/post-actions?access_token=",
|
||||
get_posts: "https://api.ragestudio.net/RSA-COMTY/r/posts?access_token=",
|
||||
find_user: "https://api.ragestudio.net/RSA-COMTY/r/find_user?access_token=",
|
||||
search_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/search?access_token=",
|
||||
get_sessions: "https://api.ragestudio.net/RSA-COMTY/r/session_id?access_token=",
|
||||
auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/auth",
|
||||
new_post: "https://comty.julioworld.club/api/new_post?access_token=",
|
||||
get_config_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-site-settings?access_token=",
|
||||
get_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/get-user-data?access_token=",
|
||||
update_userData_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/update-user-data?access_token=",
|
||||
removeToken: "https://api.ragestudio.net/RSA-COMTY/r/delete-access-token?access_token=",
|
||||
register_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/create-account",
|
||||
resetPassword_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/send-reset-password-email?access_token=",
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
"name": "comty-development",
|
||||
"title": "Comty™",
|
||||
"DevBuild": true,
|
||||
"version": "0.2.06",
|
||||
"version": "0.2.08",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"author": "RageStudio",
|
||||
|
@ -11,11 +11,11 @@ export function follow_user(id, callback) {
|
||||
body: formdata,
|
||||
redirect: 'follow'
|
||||
};
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(`Following user => ${id} `) : null
|
||||
ycore.yconsole.log(`Following user => ${id} `)
|
||||
const urlObj = `${ycore.endpoints.follow_user}${ycore.GetUserToken.decrypted().UserToken}`
|
||||
fetch(urlObj, requestOptions)
|
||||
.then(response => {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(response) : null
|
||||
ycore.yconsole.log(response)
|
||||
return callback(false, response)
|
||||
})
|
||||
.catch(error => {
|
||||
@ -61,27 +61,34 @@ export function PublishPost(privacy, raw, file, callback){
|
||||
if(!rawtext){
|
||||
return null
|
||||
}
|
||||
|
||||
let formdata = new FormData();
|
||||
formdata.append("user_id", ycore.GetUserToken.decrypted().UserID);
|
||||
formdata.append("type", "new_post")
|
||||
formdata.append("server_key", ycore.yConfig.server_key);
|
||||
formdata.append("postPrivacy", privacy)
|
||||
formdata.append("postText", raw);
|
||||
file? formdata.append("postPhotos", file) : null
|
||||
file? formdata.append("postPhoto", file) : null
|
||||
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
redirect: 'follow'
|
||||
"url": `${ycore.endpoints.new_post}${ycore.GetUserToken.decrypted().UserToken}`,
|
||||
"method": "POST",
|
||||
"timeout": 0,
|
||||
"data": formdata,
|
||||
"mimeType": "multipart/form-data",
|
||||
"processData": false,
|
||||
"contentType": false
|
||||
};
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(`Sending new post => ${rawtext} `) : null
|
||||
const urlObj = `${ycore.endpoints.new_post}${ycore.GetUserToken.decrypted().UserToken}`
|
||||
fetch(urlObj, requestOptions)
|
||||
.then(response => {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(response) : null
|
||||
|
||||
ycore.yconsole.log(`Sending new post => ${rawtext} `)
|
||||
jquery.ajax(requestOptions)
|
||||
.done(response => {
|
||||
ycore.yconsole.log(response)
|
||||
return callback(false, response)
|
||||
})
|
||||
.catch(error => {
|
||||
console.log('error', error)
|
||||
return callback(true, error)
|
||||
.fail(error => {
|
||||
ycore.yconsole.log('error', error)
|
||||
return callback(true, error)
|
||||
});
|
||||
}
|
||||
|
||||
@ -195,32 +202,26 @@ export function GetPosts(userid, type, callback) {
|
||||
|
||||
export const get_app_session = {
|
||||
get_id: (callback) => {
|
||||
const fromSto = sessionStorage.getItem('se_src')
|
||||
if (!fromSto){
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log("Missing session_id, setting up...") : null
|
||||
let formdata = new FormData();
|
||||
formdata.append("server_key", ycore.yConfig.server_key);
|
||||
formdata.append("type", "get");
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
redirect: 'follow'
|
||||
};
|
||||
const uriObj = `${ycore.endpoints.get_sessions}${ycore.GetUserToken.decrypted().UserToken}`
|
||||
notifyProccess()
|
||||
fetch(uriObj, requestOptions)
|
||||
.then(response => response.text())
|
||||
.then(result => {
|
||||
const pre = JSON.stringify(result)
|
||||
const pre2 = JSON.parse(pre)
|
||||
const pre3 = JSON.stringify(JSON.parse(pre2)["data"])
|
||||
const obj = JSON.parse(pre3)["session_id"]
|
||||
return asyncSessionStorage.setItem('se_src', btoa(obj)).then( callback(null, obj) )
|
||||
})
|
||||
.catch(error => console.log('error', error));
|
||||
}
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log("Returning from storage") : null
|
||||
return callback( null, atob(fromSto) )
|
||||
let formdata = new FormData();
|
||||
formdata.append("server_key", ycore.yConfig.server_key);
|
||||
formdata.append("type", "get");
|
||||
const requestOptions = {
|
||||
method: 'POST',
|
||||
body: formdata,
|
||||
redirect: 'follow'
|
||||
};
|
||||
const uriObj = `${ycore.endpoints.get_sessions}${ycore.GetUserToken.decrypted().UserToken}`
|
||||
ycore.notifyProccess('Getting session data...')
|
||||
fetch(uriObj, requestOptions)
|
||||
.then(response => response.text())
|
||||
.then(result => {
|
||||
const pre = JSON.stringify(result)
|
||||
const pre2 = JSON.parse(pre)
|
||||
const pre3 = JSON.stringify(JSON.parse(pre2)["data"])
|
||||
const obj = JSON.parse(pre3)["session_id"]
|
||||
return callback(null, obj)
|
||||
})
|
||||
.catch(error => ycore.yconsole.log('error', error));
|
||||
},
|
||||
raw: (callback) => {
|
||||
const formdata = new FormData();
|
||||
@ -238,17 +239,17 @@ export const get_app_session = {
|
||||
const pre = JSON.stringify(result)
|
||||
const parsed = JSON.parse(pre)
|
||||
const obj = JSON.parse(parsed)["data"]
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(result, obj) : null
|
||||
ycore.yconsole.log(result, obj)
|
||||
return callback(null, obj)
|
||||
})
|
||||
.catch(error => console.log('error', error));
|
||||
.catch(error => ycore.yconsole.log('error', error));
|
||||
}
|
||||
}
|
||||
export function PushUserData(inputIO1, inputIO2) {
|
||||
var getStoragedToken = Cookies.get('access_token');
|
||||
var yCore_GUDEP = ycore.endpoints.update_userData_endpoint;
|
||||
var urlOBJ = "" + yCore_GUDEP + getStoragedToken;
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Recived', global, 'sending to ', urlOBJ) : null
|
||||
ycore.yconsole.log('Recived', global, 'sending to ', urlOBJ)
|
||||
var form = new FormData();
|
||||
form.append("server_key", ycore.yConfig.server_key);
|
||||
form.append(inputIO1, inputIO2);
|
||||
@ -262,6 +263,6 @@ export function PushUserData(inputIO1, inputIO2) {
|
||||
"data": form
|
||||
};
|
||||
jquery.ajax(settings).done(function (response) {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(response) : null
|
||||
ycore.yconsole.log(response)
|
||||
});
|
||||
}
|
@ -15,7 +15,7 @@ export function InitSDCP(values, done) {
|
||||
let payload = {};
|
||||
if (!values) {
|
||||
const message = 'Missing payload! Exception while request data...';
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, message) : null
|
||||
ycore.yconsole.log(prefix, message)
|
||||
return;
|
||||
}
|
||||
payload.UserToken = values.UserToken;
|
||||
@ -27,7 +27,7 @@ export function InitSDCP(values, done) {
|
||||
let Ensamblator = btoa(JSON.stringify(cooked))
|
||||
ycore.SetupApp()
|
||||
ycore.asyncSDCP.setSDCP(Ensamblator).then(() => {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, ' SDCP Setup done') : null
|
||||
ycore.yconsole.log(prefix, ' SDCP Setup done')
|
||||
return done(true)
|
||||
})
|
||||
}
|
||||
@ -44,14 +44,14 @@ export function UpdateSDCP() {
|
||||
const e2 = btoa(Nsdcp)
|
||||
const n = e1.localeCompare(e2)
|
||||
if (!e2) {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'API Returned empty response! We recommend to logout') : null
|
||||
ycore.yconsole.log(prefix, 'API Returned empty response! We recommend to logout')
|
||||
return
|
||||
}
|
||||
if (e1 == e2) {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Equality') : null
|
||||
ycore.yconsole.log(prefix, 'SDCP Equality')
|
||||
}else{
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Update detected ! => ', n) : null
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `) : null
|
||||
ycore.yconsole.log(prefix, 'SDCP Update detected ! => ', n)
|
||||
ycore.yconsole.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `)
|
||||
ycore.asyncSDCP.setSDCP(e2)
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ export function InitSDCP(values, done) {
|
||||
let payload = {};
|
||||
if (!values) {
|
||||
const message = 'Missing payload! Exception while request data...';
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, message) : null
|
||||
ycore.yconsole.log(prefix, message)
|
||||
return;
|
||||
}
|
||||
payload.UserToken = values.UserToken;
|
||||
@ -29,7 +29,7 @@ export function InitSDCP(values, done) {
|
||||
let Ensamblator = btoa(JSON.stringify(cooked))
|
||||
ycore.SetupApp()
|
||||
ycore.asyncSDCP.setSDCP(Ensamblator).then(() => {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, ' SDCP Setup done') : null
|
||||
ycore.yconsole.log(prefix, ' SDCP Setup done')
|
||||
return done(true)
|
||||
})
|
||||
}
|
||||
@ -46,14 +46,14 @@ export function UpdateSDCP() {
|
||||
const e2 = btoa(Nsdcp)
|
||||
const n = e1.localeCompare(e2)
|
||||
if (!e2) {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'API Returned empty response! We recommend to logout') : null
|
||||
ycore.yconsole.log(prefix, 'API Returned empty response! We recommend to logout')
|
||||
return
|
||||
}
|
||||
if (e1 == e2) {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Equality') : null
|
||||
ycore.yconsole.log(prefix, 'SDCP Equality')
|
||||
}else{
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Update detected ! => ', n) : null
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `) : null
|
||||
ycore.yconsole.log(prefix, 'SDCP Update detected ! => ', n)
|
||||
ycore.yconsole.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `)
|
||||
ycore.asyncSDCP.setSDCP(e2)
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ export function SDCP() {
|
||||
try {
|
||||
atob(SDCPContainer);
|
||||
} catch (err) {
|
||||
console.error(prefix, err)
|
||||
ycore.yconsole.error(prefix, err)
|
||||
ycore.router.push({pathname: '/login',})
|
||||
return null
|
||||
}
|
||||
@ -75,7 +75,7 @@ export function SDCP() {
|
||||
let parsedSDCP = JSON.parse(decodedSDCP);
|
||||
return parsedSDCP;
|
||||
} catch (err) {
|
||||
console.error(prefix, err)
|
||||
ycore.yconsole.error(prefix, err)
|
||||
ycore.router.push({pathname: '/login',})
|
||||
return null
|
||||
}
|
||||
|
@ -12,13 +12,18 @@ function __ServerAlive(a, callback){
|
||||
|
||||
}
|
||||
|
||||
export function __permission(id){
|
||||
const userAdmin = ycore.SDCP().admin
|
||||
return ycore.booleanFix(userAdmin)
|
||||
}
|
||||
|
||||
function __API__User (payload){
|
||||
var ExpireTime = ycore.DevOptions.MaxJWTexpire
|
||||
const now = new Date()
|
||||
now.setDate(now.getDate() + 1)
|
||||
const { UserID, UserToken } = payload
|
||||
const frame = { UserID, UserToken, deadline: ( ycore.DevOptions.SignForNotExpire? null : now.getTime() )}
|
||||
console.debug(frame)
|
||||
ycore.yconsole.debug(frame)
|
||||
jwt.sign(
|
||||
frame,
|
||||
keys.secretOrKey,
|
||||
@ -79,10 +84,10 @@ export function MakeBackup(){
|
||||
}
|
||||
export function LogoutCall(){
|
||||
const prefix = ('[YID Session] ')
|
||||
console.log('Logout Called !')
|
||||
ycore.yconsole.log('Logout Called !')
|
||||
let DecodedToken = ycore.GetUserToken.decrypted().UserToken || atob(localStorage.getItem('last_backup'))
|
||||
const urlOBJ = (`${ycore.endpoints.removeToken}${DecodedToken}`)
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, ' Login out with token => ', DecodedToken, urlOBJ) : null
|
||||
ycore.yconsole.log(prefix, ' Login out with token => ', DecodedToken, urlOBJ)
|
||||
const form = new FormData();
|
||||
form.append("server_key", ycore.yConfig.server_key);
|
||||
const settings = {
|
||||
@ -97,7 +102,7 @@ export function LogoutCall(){
|
||||
jquery.ajax(settings)
|
||||
.done((response) => {
|
||||
const api_state = JSON.parse(response)['api_status']
|
||||
console.log(`Exit with => ${api_state}`)
|
||||
ycore.yconsole.log(`Exit with => ${api_state}`)
|
||||
if (api_state == '404') {
|
||||
antd.notification.open({
|
||||
placement: 'topLeft',
|
||||
@ -105,10 +110,10 @@ export function LogoutCall(){
|
||||
description: 'It seems that your token has been removed unexpectedly and could not log out from YulioID ',
|
||||
icon: <Icons.WarningOutlined style={{ color: 'orange' }} />
|
||||
})
|
||||
console.log("Failed logout with YulioID™", response)
|
||||
ycore.yconsole.log("Failed logout with YulioID™", response)
|
||||
}
|
||||
else {
|
||||
console.log("Successful logout with YulioID™", response, urlOBJ)
|
||||
ycore.yconsole.log("Successful logout with YulioID™", response, urlOBJ)
|
||||
}
|
||||
// Runtime after dispatch API
|
||||
Cookies.remove('token')
|
||||
@ -120,7 +125,7 @@ export function GetAuth(EncUsername, EncPassword, callback) {
|
||||
const prefix = '[Auth Server]:';
|
||||
if (!EncUsername || !EncPassword) {
|
||||
const message = 'Missing Data! Process Aborted...';
|
||||
console.log(prefix, message);
|
||||
ycore.yconsole.log(prefix, message);
|
||||
}
|
||||
const server_key = ycore.yConfig.server_key;
|
||||
let username = atob(EncUsername);
|
||||
@ -140,14 +145,14 @@ export function GetAuth(EncUsername, EncPassword, callback) {
|
||||
};
|
||||
jquery.ajax(settings)
|
||||
.done(function (response) {
|
||||
console.log(prefix, 'Server response... Dispathing data to login API...');
|
||||
ycore.yconsole.log(prefix, 'Server response... Dispathing data to login API...');
|
||||
try {
|
||||
var identState = JSON.parse(response)['api_status'];
|
||||
if (identState == 200) {
|
||||
const UserID = JSON.parse(response)['user_id'];
|
||||
const UserToken = JSON.parse(response)['access_token'];
|
||||
let FramePayload = { UserID, UserToken }
|
||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(FramePayload) : null
|
||||
ycore.yconsole.log(FramePayload)
|
||||
callback(null, '200')
|
||||
ycore.InitSDCP(FramePayload, (done) => done? __API__User(FramePayload) : null )
|
||||
}
|
||||
@ -180,7 +185,7 @@ export const GetUserToken = {
|
||||
if (!FB) {
|
||||
final = FC
|
||||
}
|
||||
ycore.DevOptions.ShowFunctionsLogs ? console.debug(final) : null
|
||||
ycore.yconsole.debug(final)
|
||||
return final
|
||||
},
|
||||
raw: function () {
|
||||
@ -195,7 +200,7 @@ export function GetUserData (values, callback) {
|
||||
const userid = globalValue.UserID
|
||||
if (!globalValue) {
|
||||
const message = 'Missing payload! Exception while request data... Maybe the user is not login';
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, message) : null
|
||||
ycore.yconsole.log(prefix, message)
|
||||
return;
|
||||
}
|
||||
const ApiPayload = new FormData();
|
||||
@ -222,7 +227,7 @@ export function GetUserData (values, callback) {
|
||||
)
|
||||
.fail(
|
||||
function (response) {
|
||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(prefix, 'Server failure!', response) : null
|
||||
ycore.yconsole.log(prefix, 'Server failure!', response)
|
||||
callback(true, response )
|
||||
}
|
||||
)
|
||||
|
@ -18,14 +18,48 @@ export var endpoints = Endpoints;
|
||||
export var yConfig = config.yConfig;
|
||||
|
||||
var package_json = require("../../package.json");
|
||||
|
||||
/**
|
||||
* Convert a base64 string in a Blob according to the data and contentType.
|
||||
*
|
||||
* @param b64Data {String} Pure base64 string without contentType
|
||||
* @param contentType {String} the content type of the file i.e (image/jpeg - image/png - text/plain)
|
||||
* @param sliceSize {Int} SliceSize to process the byteCharacters
|
||||
* @return Blob
|
||||
*/
|
||||
export function b64toBlob(b64Data, contentType, sliceSize) {
|
||||
contentType = contentType || '';
|
||||
sliceSize = sliceSize || 512;
|
||||
|
||||
var byteCharacters = atob(b64Data);
|
||||
var byteArrays = [];
|
||||
|
||||
for (var offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
||||
var slice = byteCharacters.slice(offset, offset + sliceSize);
|
||||
|
||||
var byteNumbers = new Array(slice.length);
|
||||
for (var i = 0; i < slice.length; i++) {
|
||||
byteNumbers[i] = slice.charCodeAt(i);
|
||||
}
|
||||
|
||||
var byteArray = new Uint8Array(byteNumbers);
|
||||
|
||||
byteArrays.push(byteArray);
|
||||
}
|
||||
|
||||
var blob = new Blob(byteArrays, {type: contentType});
|
||||
return blob;
|
||||
}
|
||||
|
||||
export const AppInfo = {
|
||||
name: package_json.title,
|
||||
version: package_json.version,
|
||||
logo: config.FullLogoPath,
|
||||
logo_dark: config.DarkFullLogoPath
|
||||
}
|
||||
|
||||
export function RegSW(){
|
||||
console.log('Registering Service Worker...')
|
||||
yconsole.log('Registering Service Worker...')
|
||||
sw.register()
|
||||
}
|
||||
|
||||
@ -79,6 +113,7 @@ export function notifyProccess(cust){
|
||||
antd.notification.open({
|
||||
icon: <Icons.LoadingOutlined style={{ color: '#108ee9' }} />,
|
||||
message: 'Please wait',
|
||||
description: (<div>{cust}</div>),
|
||||
placement: 'bottomLeft'
|
||||
})
|
||||
}
|
||||
@ -118,9 +153,11 @@ export const asyncSessionStorage = {
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export function RefreshONCE(){
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
export function DetectNoNStableBuild(e1) {
|
||||
switch (e1) {
|
||||
case 'TagComponent':
|
||||
@ -147,3 +184,22 @@ export function DetectNoNStableBuild(e1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
export const yconsole = {
|
||||
log: (...cont)=>{
|
||||
ReturnDevOption('force_showDevLogs')? console.log(...cont) : null
|
||||
return
|
||||
},
|
||||
debug: (...cont)=>{
|
||||
ReturnDevOption('force_showDevLogs')? console.debug(...cont) : null
|
||||
return
|
||||
},
|
||||
error: (...cont)=>{
|
||||
ReturnDevOption('force_showDevLogs')? console.error(...cont) : null
|
||||
return
|
||||
},
|
||||
warn: (...cont)=>{
|
||||
ReturnDevOption('force_showDevLogs')? console.warn(...cont) : null
|
||||
return
|
||||
}
|
||||
}
|
@ -35,14 +35,14 @@ class Control extends React.Component {
|
||||
}
|
||||
}
|
||||
DummySetControls = (e) =>{
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Controls recived => ', e) : null
|
||||
ycore.yconsole.log('Controls recived => ', e)
|
||||
if (this.state.Show == false) {
|
||||
this.setState({ FadeIN: true })
|
||||
}
|
||||
this.setState({Show: true, RenderFragment: e})
|
||||
}
|
||||
DummyCloseControls(){
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Closing Control Bar...') : null
|
||||
ycore.yconsole.log('Closing Control Bar...')
|
||||
this.setState({FadeIN: false})
|
||||
setTimeout(() => this.setState({ Show: false, RenderFragment: null}), 1000)
|
||||
}
|
||||
|
@ -60,6 +60,7 @@ class Sider extends PureComponent {
|
||||
e.key === 'general_settings' && ycore.crouter.native('settings')
|
||||
e.key === 'accountpage' && router.push('/account')
|
||||
e.key === 'explore' && router.push('main')
|
||||
e.key === 'admin_area' && router.push('__m')
|
||||
}
|
||||
|
||||
isDarkMode(){
|
||||
|
@ -31,7 +31,7 @@ class LikeBTN extends React.PureComponent {
|
||||
|
||||
dispatchLike(e){
|
||||
const { type } = this.state
|
||||
console.log(`Dispatch ${type} to post id => ${e}`)
|
||||
ycore.yconsole.log(`Dispatch ${type} to post id => ${e}`)
|
||||
this.setState({ clicked: true })
|
||||
setTimeout(() => {
|
||||
this.setState({ clicked: false })
|
||||
@ -57,7 +57,7 @@ class LikeBTN extends React.PureComponent {
|
||||
const { id } = this.props
|
||||
const { likes, liked, clicked } = this.state
|
||||
if (!id){
|
||||
console.error('[LikeBTN] No post id provided!')
|
||||
ycore.yconsole.error('[LikeBTN] No post id provided!')
|
||||
return null
|
||||
}
|
||||
return(
|
||||
|
@ -6,7 +6,7 @@ import {PostCard} from 'components'
|
||||
var userData = ycore.SDCP()
|
||||
|
||||
export function RefreshFeed(){
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Refreshing Feed...') : null
|
||||
ycore.yconsole.log('Refreshing Feed...')
|
||||
window.MainFeedComponent.handleRefreshList();
|
||||
return
|
||||
}
|
||||
@ -43,7 +43,7 @@ class MainFeed extends React.Component {
|
||||
const { get, filters } = this.props
|
||||
try {
|
||||
const feedParsed = JSON.parse(feedRaw)['data']
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(feedParsed) : null
|
||||
ycore.yconsole.log(feedParsed)
|
||||
return (
|
||||
feedParsed.map(item=> {
|
||||
const {id, postText, post_time, publisher, postFile, postFileName, is_liked, is_post_saved, is_post_reported, is_post_boosted, is_post_pinned, post_likes} = item
|
||||
|
@ -5,6 +5,8 @@ import {CustomIcons, LikeBTN} from 'components'
|
||||
import * as ycore from 'ycore'
|
||||
import * as Icons from '@ant-design/icons';
|
||||
import Icon from '@ant-design/icons'
|
||||
import classnames from 'classnames'
|
||||
import * as MICON from '@material-ui/icons';
|
||||
|
||||
const { Meta } = antd.Card;
|
||||
|
||||
@ -58,12 +60,33 @@ class PostCard extends React.PureComponent{
|
||||
|
||||
render(){
|
||||
const { payload, customActions } = this.props
|
||||
const ActShowMode = ycore.DevOptions.force_show_postactions
|
||||
const { id, user, ago, avatar, content, file, postFileName, publisher, post_likes, is_post_pinned, is_liked } = payload || emptyPayload;
|
||||
const defaultActions = [<div><LikeBTN count={post_likes} id={id} liked={ycore.booleanFix(is_liked)? true : false} key="like" /></div>,<Icons.ShareAltOutlined key="share" />,<Icons.MoreOutlined key="actionMenu" />]
|
||||
const defaultActions = [
|
||||
<div><LikeBTN count={post_likes} id={id} liked={ycore.booleanFix(is_liked)? true : false} key="like" /></div>,
|
||||
<MICON.InsertComment key="share" />,
|
||||
<div><antd.Dropdown overlay={MoreMenu} trigger={['click']}>
|
||||
<Icons.MoreOutlined key="actionMenu" />
|
||||
</antd.Dropdown></div>,
|
||||
]
|
||||
const actions = customActions || defaultActions;
|
||||
|
||||
const MoreMenu = (
|
||||
<antd.Menu>
|
||||
<antd.Menu.Item key="0">
|
||||
<a href="http://www.alipay.com/">1st menu item</a>
|
||||
</antd.Menu.Item>
|
||||
<antd.Menu.Item key="1">
|
||||
<a href="http://www.taobao.com/">2nd menu item</a>
|
||||
</antd.Menu.Item>
|
||||
<antd.Menu.Divider />
|
||||
<antd.Menu.Item key="3">3rd menu item</antd.Menu.Item>
|
||||
</antd.Menu>
|
||||
);
|
||||
|
||||
return(
|
||||
<div className={styles.cardWrapper}>
|
||||
<antd.Card actions={actions} >
|
||||
<antd.Card hoverable className={ActShowMode? styles.showMode : null} actions={actions} >
|
||||
<Meta
|
||||
avatar={<div className={styles.postAvatar}><antd.Avatar shape="square" size={50} src={avatar} /></div>}
|
||||
title={<div className={styles.titleWrapper} ><h4 onClick={() => ycore.crouter.native(`@${user}`)} className={styles.titleUser}>@{user} {ycore.booleanFix(publisher.verified)? <Icon style={{ color: 'blue' }} component={CustomIcons.VerifiedBadge} /> : null}{ycore.booleanFix(publisher.nsfw_flag)? <antd.Tag style={{ margin: '0 0 0 13px' }} color="volcano" >NSFW</antd.Tag> : null} </h4> <div className={styles.PostTags}>{ycore.booleanFix(is_post_pinned)? (<Icons.PushpinFilled /> ): null }</div> </div>}
|
||||
|
@ -6,6 +6,7 @@
|
||||
min-width: 265px;
|
||||
width: auto;
|
||||
margin: 23px auto 50px auto;
|
||||
|
||||
:global{
|
||||
.ant-card-meta-detail > div:not(:last-child){
|
||||
margin: 0
|
||||
@ -18,30 +19,47 @@
|
||||
.ant-card-body {
|
||||
padding: 13px 0 5px 0;
|
||||
}
|
||||
|
||||
.ant-card-actions {
|
||||
border-top: 0;
|
||||
background: #EBEBEB;
|
||||
opacity: 0;
|
||||
height: 30px;
|
||||
position: relative;
|
||||
transition: opacity 150ms linear, position 150ms linear, transform 150ms linear;
|
||||
border-radius: 0 0 10px 10px;
|
||||
opacity: 0;
|
||||
// Doesn't work... So sad :C
|
||||
&.showMode{
|
||||
opacity: 1;
|
||||
transform: translate(0, 15px);
|
||||
}
|
||||
}
|
||||
|
||||
.ant-card-actions:hover {
|
||||
opacity: 1;
|
||||
transform: translate(0, 15px);
|
||||
transition: opacity 150ms linear, position 150ms linear, transform 150ms linear;
|
||||
}
|
||||
.ant-card-actions > li > span > .anticon {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: white;
|
||||
border-radius: 23px;
|
||||
|
||||
}
|
||||
.ant-card-actions > li {
|
||||
margin: -20px 0 0 0 ;
|
||||
border-right: 0;
|
||||
i{
|
||||
|
||||
vertical-align: middle;
|
||||
height: 40px;
|
||||
width: 40px;
|
||||
background-color: #fff;
|
||||
border-radius: 24px;
|
||||
span {
|
||||
font-size: 16px;
|
||||
line-height: 22px;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
background: white;
|
||||
border-radius: 23px;
|
||||
margin: auto;
|
||||
}
|
||||
svg {
|
||||
height: 20px;
|
||||
@ -52,6 +70,14 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
.showMode{
|
||||
:global{
|
||||
ul {
|
||||
opacity: 1 !important;
|
||||
transform: translate(0, 15px);
|
||||
}
|
||||
}
|
||||
}
|
||||
.postAvatar{
|
||||
position: absolute;
|
||||
left: -8px;
|
||||
@ -73,10 +99,12 @@
|
||||
color:rgb(249, 179, 64);
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
i{
|
||||
float: right;
|
||||
margin: -0 6px 0 0;;
|
||||
font-size: 17px;
|
||||
:global {
|
||||
.anticon{
|
||||
float: right;
|
||||
margin: -0 6px 0 0;;
|
||||
font-size: 17px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.titleWrapper{
|
||||
|
@ -6,6 +6,7 @@ import {CustomIconss} from 'components'
|
||||
import { RefreshFeed } from 'components/MainFeed'
|
||||
import * as Icons from '@ant-design/icons';
|
||||
import Icon from '@ant-design/icons'
|
||||
import * as MICONS from '@material-ui/icons'
|
||||
|
||||
const { Meta } = antd.Card;
|
||||
const userData = ycore.SDCP();
|
||||
@ -38,7 +39,29 @@ class PostCreator extends React.PureComponent{
|
||||
UploadActive: false,
|
||||
}
|
||||
}
|
||||
renderPostPlayer(payload){
|
||||
const {file, fileURL} = this.state
|
||||
const videofilter = file.type === 'video/mp4'
|
||||
const imagefilter = file.type === 'image/jpeg' || file.type === 'image/png'
|
||||
if (imagefilter) {
|
||||
return (
|
||||
<div className={styles.imagePreviewWrapper}>
|
||||
<img className={styles.imagePreview} src={fileURL} />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
if (videofilter) {
|
||||
return (
|
||||
<div className={styles.imagePreviewWrapper}>
|
||||
<video id="player" playsInline controls >
|
||||
<source className={styles.imagePreview} src={file} type={file.type}/>
|
||||
</video>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
return null
|
||||
|
||||
}
|
||||
ToogleVisibility(){
|
||||
this.setState({ visible: !this.state.visible })
|
||||
}
|
||||
@ -48,17 +71,16 @@ class PostCreator extends React.PureComponent{
|
||||
}
|
||||
|
||||
handleFileUpload = info => {
|
||||
console.log(info.file.originFileObj)
|
||||
if (info.file.status === 'uploading') {
|
||||
this.setState({ loading: true });
|
||||
return;
|
||||
}
|
||||
if (info.file.status === 'done') {
|
||||
this.ToogleUpload()
|
||||
// Get this url from response in real world.
|
||||
getBase64(info.file.originFileObj, imageUrl =>
|
||||
this.setState({ file: info.file.originFileObj })
|
||||
getBase64(info.file.originFileObj, fileURL =>
|
||||
this.setState({
|
||||
imageUrl,
|
||||
fileURL,
|
||||
loading: false,
|
||||
}),
|
||||
);
|
||||
@ -66,16 +88,17 @@ class PostCreator extends React.PureComponent{
|
||||
};
|
||||
|
||||
beforeUpload(file) {
|
||||
console.log('before')
|
||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
||||
if (!isJpgOrPng) {
|
||||
message.error('You can only upload JPG/PNG file!');
|
||||
const filter = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'video/mp4';
|
||||
if (!filter) {
|
||||
antd.message.error('Invalid File!');
|
||||
this.FlushPostState('error')
|
||||
}
|
||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||||
if (!isLt2M) {
|
||||
message.error('Image must smaller than 2MB!');
|
||||
const maxsize = file.size / 1024 / 1024 < ycore.DevOptions.MaximunAPIPayload;
|
||||
if (!maxsize) {
|
||||
antd.message.error('Image must smaller than 99MB!');
|
||||
this.FlushPostState('error')
|
||||
}
|
||||
return isJpgOrPng && isLt2M;
|
||||
return filter && maxsize;
|
||||
}
|
||||
|
||||
handleChanges = ({ target: { value } }) => {
|
||||
@ -93,43 +116,49 @@ class PostCreator extends React.PureComponent{
|
||||
this.setState({ toolbox_open: !this.state.toolbox_open })
|
||||
}
|
||||
|
||||
handlePublishPost = (e) => {
|
||||
const { rawtext, shareWith, imageUrl } = this.state;
|
||||
let postFile;
|
||||
if (imageUrl) {
|
||||
console.log('EXIST ',imageUrl)
|
||||
postFile = imageUrl;
|
||||
FlushPostState = (type) =>{
|
||||
switch (type) {
|
||||
case 'error':
|
||||
this.setState({
|
||||
posting_ok: false,
|
||||
posting: false,
|
||||
rawtext: '',
|
||||
fileURL: '',
|
||||
file: ''
|
||||
})
|
||||
setTimeout( () => {this.setState({ posting_ok: false }) }, 1000)
|
||||
break;
|
||||
|
||||
default:
|
||||
this.setState({
|
||||
posting_ok: true,
|
||||
posting: false,
|
||||
rawtext: '',
|
||||
fileURL: '',
|
||||
file: ''
|
||||
})
|
||||
setTimeout( () => {this.setState({ posting_ok: false }) }, 1000)
|
||||
RefreshFeed()
|
||||
return
|
||||
}
|
||||
if(!rawtext){
|
||||
}
|
||||
|
||||
handlePublishPost = (e) => {
|
||||
const { rawtext, shareWith, file } = this.state;
|
||||
if(!rawtext || !file){
|
||||
return null
|
||||
}
|
||||
this.setState({ posting: true, keys_remaining: '512' })
|
||||
console.log('to post ',postFile)
|
||||
ycore.PublishPost(ycore.GetPostPrivacy.bool(shareWith), rawtext, postFile, (err, res) => {
|
||||
ycore.PublishPost(ycore.GetPostPrivacy.bool(shareWith), rawtext, file, (err, res) => {
|
||||
if (err) {
|
||||
ycore.notifyError(err)
|
||||
return
|
||||
}
|
||||
this.setState({ posting_ok: true, posting: false, rawtext: ''})
|
||||
setTimeout( () => {this.setState({ posting_ok: false }) }, 1000)
|
||||
RefreshFeed()
|
||||
this.FlushPostState()
|
||||
|
||||
})
|
||||
}
|
||||
OpenControl = () =>{
|
||||
let controls = [(
|
||||
<div> <antd.Button onClick={() => this.ResetUpload()} icon={<Icons.DeleteOutlined />} /> </div>
|
||||
)]
|
||||
ycore.ControlBar.set(controls)
|
||||
}
|
||||
CloseControl = () =>{
|
||||
ycore.ControlBar.close()
|
||||
}
|
||||
ResetUpload (){
|
||||
this.setState({
|
||||
imageUrl: null
|
||||
})
|
||||
this.ToogleUpload()
|
||||
}
|
||||
|
||||
|
||||
render(){
|
||||
const { keys_remaining, visible } = this.state;
|
||||
@ -166,6 +195,7 @@ class PostCreator extends React.PureComponent{
|
||||
<Icons.InboxOutlined />
|
||||
</p>
|
||||
<p className="ant-upload-text">Click or drag file to this area to upload</p>
|
||||
<span>*Allowed PNG, JPG, MP4 </span>
|
||||
</div>
|
||||
</antd.Upload.Dragger>
|
||||
</div>
|
||||
@ -179,14 +209,11 @@ class PostCreator extends React.PureComponent{
|
||||
<div className={styles.progressHandler}><antd.Progress strokeWidth="4px" className={this.state.posting? styles.proccessUnset : (keys_remaining < 512? styles.proccessSet : styles.proccessUnset)} status={this.handleKeysProgressBar()} showInfo={false} percent={percent} /></div>
|
||||
|
||||
<div className={styles.postExtra} >
|
||||
{ this.state.imageUrl?
|
||||
<div className={styles.imagePreviewWrapper}>
|
||||
<img className={styles.imagePreview} src={this.state.imageUrl} />
|
||||
</div> : null
|
||||
{ this.state.file?
|
||||
this.renderPostPlayer() : null
|
||||
}
|
||||
<antd.Button type="ghost" onClick={() => this.ToogleUpload()} > <Icons.CameraFilled /></antd.Button>
|
||||
<antd.Button type="ghost"> <Icons.VideoCameraFilled /></antd.Button>
|
||||
<antd.Button onClick={this.handleToggleToolbox} type="ghost"><Icons.PlusCircleOutlined /></antd.Button>
|
||||
<antd.Button type="ghost" onClick={() => this.ToogleUpload()} > <MICONS.AddCircle /></antd.Button>
|
||||
<antd.Button type="ghost" onClick={this.handleToggleToolbox} ><MICONS.Tune /></antd.Button>
|
||||
<antd.Dropdown overlay={shareOptionsMenu}>
|
||||
<a className={styles.shareWith} onClick={e => e.preventDefault()}>
|
||||
{ycore.GetPostPrivacy.decorator(this.state.shareWith)}
|
||||
|
@ -138,11 +138,24 @@
|
||||
line-height: 30px;
|
||||
}
|
||||
:global{
|
||||
.MuiSvgIcon-root {
|
||||
width: 1em;
|
||||
height: 1em;
|
||||
display: inline-block;
|
||||
font-size: 18px;
|
||||
transition: fill 200ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
||||
flex-shrink: 0;
|
||||
margin: 8px;
|
||||
line-height: 1px;
|
||||
user-select: none;
|
||||
}
|
||||
.ant-btn .anticon {
|
||||
transition: margin-left 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||
margin: 8px;
|
||||
}
|
||||
.ant-btn{
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
float: left;
|
||||
padding: 0;
|
||||
border-radius: 11px;
|
||||
@ -151,8 +164,7 @@
|
||||
border-color: transparent;
|
||||
}
|
||||
.ant-btn:hover{
|
||||
border-color: rgb(53, 53, 53);
|
||||
color: rgb(53, 53, 53);
|
||||
border-color: transparent;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ const userData = ycore.SDCP();
|
||||
|
||||
function isOwnProfile(id){
|
||||
if(id == userData.id){
|
||||
ycore.DevOptions.ShowFunctionsLogs ? console.log('Is your own profile !!'): null
|
||||
ycore.yconsole.log('Is your own profile !!')
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@ -54,9 +54,9 @@ class UserProfile extends React.Component {
|
||||
exception? ycore.notifyError(exception) : null
|
||||
try {
|
||||
const rp = JSON.parse(response)
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log(rp) : null
|
||||
ycore.yconsole.log(rp)
|
||||
if (!rp['0']) {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Bad response / User not found') : null
|
||||
ycore.yconsole.log('Bad response / User not found')
|
||||
const val = { id: null, username: 'User not found!'}
|
||||
this.setState({ RenderValue: val, loading: false })
|
||||
return
|
||||
@ -64,7 +64,7 @@ class UserProfile extends React.Component {
|
||||
const c1 = rp['0'].username.toLowerCase()
|
||||
const c2 = string.toLowerCase()
|
||||
if (c1 !== c2) {
|
||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(`Using aproximate user! => ${c1} / ${c2}`) : null
|
||||
ycore.yconsole.log(`Using aproximate user! => ${c1} / ${c2}`)
|
||||
ycore.crouter.native(`@${c1}`)
|
||||
}
|
||||
this.setState({ UUID: rp['0'].user_id, RenderValue: rp['0'], loading: false , Followed: ycore.booleanFix(rp['0'].is_following)})
|
||||
@ -107,7 +107,6 @@ class UserProfile extends React.Component {
|
||||
};
|
||||
render(){
|
||||
const { loading, UUID } = this.state
|
||||
console.log(UUID)
|
||||
return(
|
||||
<div>
|
||||
{loading? <antd.Skeleton active /> :
|
||||
|
@ -7,6 +7,7 @@ import '@ant-design/compatible/assets/index.css';
|
||||
import { Button, Input, Drawer, Collapse } from 'antd';
|
||||
import styles from './index.less';
|
||||
import formstyle from './formstyle.less'
|
||||
import * as ycore from 'ycore'
|
||||
|
||||
const FormItem = Form.Item
|
||||
|
||||
@ -46,16 +47,16 @@ class YulioID extends Component {
|
||||
|
||||
if (!EncUsername || !EncPassword) {
|
||||
var message = 'Incomplete information!'
|
||||
console.log(prefix, message)
|
||||
ycore.yconsole.log(prefix, message)
|
||||
}
|
||||
|
||||
if (EncUsername && EncPassword){
|
||||
this.setState({ ShowLoading: true, StateMessage: 'Wait a sec...' });
|
||||
if (DevOptions.InfiniteLogin == true) {
|
||||
console.log(prefix, 'InfiniteLogin is enabled! Disabled getAuth')
|
||||
ycore.yconsole.log(prefix, 'InfiniteLogin is enabled! Disabled getAuth')
|
||||
}
|
||||
else {
|
||||
console.log(prefix, 'Initialising login process...')
|
||||
ycore.yconsole.log(prefix, 'Initialising login process...')
|
||||
GetAuth(EncUsername, EncPassword, (exception, response) => this.handleResponse(response))
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ export default {
|
||||
return
|
||||
}
|
||||
else if(!pathMatchRegexp(['','/login'], window.location.pathname)) {
|
||||
console.log('REP')
|
||||
if (validBackup == true) {
|
||||
ycore.LogoutCall()
|
||||
}
|
||||
|
@ -1,27 +1,27 @@
|
||||
import React, { PureComponent } from 'react'
|
||||
import { UserProfile } from 'components'
|
||||
import __m from '../__m/index.js'
|
||||
import { pathMatchRegexp } from 'utils'
|
||||
import Error404 from '../404.js'
|
||||
import * as ycore from 'ycore'
|
||||
|
||||
|
||||
|
||||
class PageIndexer extends PureComponent {
|
||||
|
||||
render() {
|
||||
const {location} = this.props
|
||||
const matchUser = pathMatchRegexp("/@:id", location.pathname);
|
||||
const matchSearch = pathMatchRegexp("/s/:id", location.pathname);
|
||||
const matchMaster = pathMatchRegexp("/__m", location.pathname)
|
||||
|
||||
if (matchUser) {
|
||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(`User matched! ${location.pathname}`) : null
|
||||
ycore.yconsole.log(`User matched! ${location.pathname}`)
|
||||
return(<div>
|
||||
<UserProfile regx={matchUser} />
|
||||
</div>)
|
||||
}
|
||||
if (matchSearch) {
|
||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(`Search matched! ${location.pathname}`) : null
|
||||
return(<div>
|
||||
<UserProfile regx={matchSearch} />
|
||||
</div>)
|
||||
if (matchMaster){
|
||||
return ycore.__permission()? <__m /> : <Error404 />
|
||||
}
|
||||
// By default return Error 404
|
||||
return(<div><Error404 /></div>)
|
||||
|
75
src/pages/__m/index.js
Normal file
75
src/pages/__m/index.js
Normal file
@ -0,0 +1,75 @@
|
||||
|
||||
import React from 'react';
|
||||
import * as ycore from 'ycore'
|
||||
import * as antd from 'antd'
|
||||
import * as Icons from '@ant-design/icons';
|
||||
import Icon from '@ant-design/icons'
|
||||
|
||||
import styles from './style.less'
|
||||
import { GridContent } from '@ant-design/pro-layout';
|
||||
|
||||
|
||||
|
||||
export default class __m extends React.Component {
|
||||
constructor(props){
|
||||
super(props),
|
||||
this.state = {
|
||||
s_id: '',
|
||||
};
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (ycore.__permission() == false) {
|
||||
return ycore.crouter.native('main')
|
||||
}
|
||||
this.handleSID()
|
||||
}
|
||||
|
||||
handleSID(){
|
||||
ycore.get_app_session.get_id((err, response)=> {
|
||||
if (err){
|
||||
return ycore.notifyError(err)
|
||||
}
|
||||
this.setState({ s_id: response})
|
||||
})
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<GridContent>
|
||||
<React.Fragment>
|
||||
<div className={styles.titleHeader}>
|
||||
<h1><Icons.ApartmentOutlined /> Administration</h1>
|
||||
</div>
|
||||
|
||||
<div className={styles.titleHeader}>
|
||||
<h1><Icons.BugOutlined /> Debug</h1>
|
||||
</div>
|
||||
<div className={styles.sectionWrapper}>
|
||||
<div>
|
||||
<antd.Button onClick={() => this.handleSID()} > Refresh Session ID</antd.Button>
|
||||
<span> {this.state.s_id} </span>
|
||||
</div>
|
||||
</div>
|
||||
<antd.Row
|
||||
gutter={24}
|
||||
type="flex"
|
||||
style={{
|
||||
marginTop: 24,
|
||||
}}
|
||||
>
|
||||
|
||||
<antd.Col xl={12} lg={24} md={24} sm={24} xs={24}>
|
||||
|
||||
<h1>__m2</h1>
|
||||
|
||||
</antd.Col>
|
||||
</antd.Row>
|
||||
|
||||
<h1>__m3 offline</h1>
|
||||
|
||||
</React.Fragment>
|
||||
</GridContent>
|
||||
);
|
||||
}
|
||||
}
|
24
src/pages/__m/style.less
Normal file
24
src/pages/__m/style.less
Normal file
@ -0,0 +1,24 @@
|
||||
@import '~themes/vars.less';
|
||||
|
||||
.titleHeader{
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 40px;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
line-height: 40px;
|
||||
padding: 0 30px 0 15px;
|
||||
h1{
|
||||
font-family: "Poppins", sans-serif;
|
||||
font-size: 14px;
|
||||
color: #1890ff;
|
||||
}
|
||||
|
||||
}
|
||||
.sectionWrapper{
|
||||
display: flex;
|
||||
position: relative;
|
||||
margin: 15px auto 15px 0;
|
||||
padding: 15px;
|
||||
background-color: rgb(236, 236, 236);
|
||||
}
|
@ -28,7 +28,7 @@ class SearchPageIndexer extends PureComponent {
|
||||
const raw = parsed.toString()
|
||||
const string = raw.replace('/s/', "")
|
||||
ycore.SeachKeywords(string, (exception, response) => {
|
||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Founded entries => ', JSON.parse(response)) : null
|
||||
ycore.yconsole.log('Founded entries => ', JSON.parse(response))
|
||||
exception? ycore.notifyError(exception) : null
|
||||
this.setState({ SearchResult: response })
|
||||
this.toogleLoading()
|
||||
|
@ -17,7 +17,7 @@ class Base extends Component {
|
||||
|
||||
componentDidMount(){
|
||||
if (!localStorage.getItem('app_settings')) {
|
||||
DevOptions.ShowFunctionsLogs? console.warn('The settings for this app in your Account isnt set yet, Using stock settings...') : null
|
||||
ycore.yconsole.warn('The settings for this app in your Account isnt set yet, Using stock settings...')
|
||||
}
|
||||
}
|
||||
SettingRender = data =>{
|
||||
@ -69,7 +69,7 @@ class Base extends Component {
|
||||
const updatedValue = [...this.state.SettingRepo]
|
||||
.map(ita => ita === item? Object.assign(ita, { "value": to }) : ita);
|
||||
this.setState({SettingRepo: updatedValue, forSave: true})
|
||||
DevOptions.ShowFunctionsLogs? console.log(`Changing ${item.SettingID} to value ${to}`) : null
|
||||
yconsole.log(`Changing ${item.SettingID} to value ${to}`)
|
||||
} catch (err) {
|
||||
console.log(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user