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_showpostcreator: ReturnDevOption('default_showpostcreator'),
|
||||||
default_collapse_sider: ReturnDevOption('default_collapse_sider'),
|
default_collapse_sider: ReturnDevOption('default_collapse_sider'),
|
||||||
use_dev_server: ReturnDevOption('use_dev_server'),
|
use_dev_server: ReturnDevOption('use_dev_server'),
|
||||||
|
force_show_postactions: ReturnDevOption('force_show_postactions'),
|
||||||
MaxJWTexpire: '1556952',
|
MaxJWTexpire: '1556952',
|
||||||
MaxLengthPosts: '512',
|
MaxLengthPosts: '512',
|
||||||
CurrentBundle: 'light_ng'
|
CurrentBundle: 'light_ng',
|
||||||
|
MaximunAPIPayload: '101376'
|
||||||
}
|
}
|
@ -1,18 +1,18 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
Endpoints: {
|
Endpoints: {
|
||||||
follow_user: "https://api.ragestudio.net/RSA-COMTY/yid/follow-user?access_token=",
|
follow_user: "https://api.ragestudio.net/RSA-COMTY/r/follow-user?access_token=",
|
||||||
action_post: "https://api.ragestudio.net/RSA-COMTY/yid/post-actions?access_token=",
|
action_post: "https://api.ragestudio.net/RSA-COMTY/r/post-actions?access_token=",
|
||||||
get_posts: "https://api.ragestudio.net/RSA-COMTY/yid/posts?access_token=",
|
get_posts: "https://api.ragestudio.net/RSA-COMTY/r/posts?access_token=",
|
||||||
find_user: "https://api.ragestudio.net/RSA-COMTY/yid/find_user?access_token=",
|
find_user: "https://api.ragestudio.net/RSA-COMTY/r/find_user?access_token=",
|
||||||
search_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/search?access_token=",
|
search_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/search?access_token=",
|
||||||
get_sessions: "https://api.ragestudio.net/RSA-COMTY/yid/session_id?access_token=",
|
get_sessions: "https://api.ragestudio.net/RSA-COMTY/r/session_id?access_token=",
|
||||||
auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/auth",
|
auth_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/auth",
|
||||||
new_post: "https://api.ragestudio.net/RSA-COMTY/yid/new_post?access_token=",
|
new_post: "https://comty.julioworld.club/api/new_post?access_token=",
|
||||||
get_config_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/get-site-settings?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/yid/get-user-data?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/yid/update-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/yid/delete-access-token?access_token=",
|
removeToken: "https://api.ragestudio.net/RSA-COMTY/r/delete-access-token?access_token=",
|
||||||
register_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/create-account",
|
register_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/create-account",
|
||||||
resetPassword_endpoint: "https://api.ragestudio.net/RSA-COMTY/yid/send-reset-password-email?access_token=",
|
resetPassword_endpoint: "https://api.ragestudio.net/RSA-COMTY/r/send-reset-password-email?access_token=",
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,7 @@
|
|||||||
"name": "comty-development",
|
"name": "comty-development",
|
||||||
"title": "Comty™",
|
"title": "Comty™",
|
||||||
"DevBuild": true,
|
"DevBuild": true,
|
||||||
"version": "0.2.06",
|
"version": "0.2.08",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"author": "RageStudio",
|
"author": "RageStudio",
|
||||||
|
@ -11,11 +11,11 @@ export function follow_user(id, callback) {
|
|||||||
body: formdata,
|
body: formdata,
|
||||||
redirect: 'follow'
|
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}`
|
const urlObj = `${ycore.endpoints.follow_user}${ycore.GetUserToken.decrypted().UserToken}`
|
||||||
fetch(urlObj, requestOptions)
|
fetch(urlObj, requestOptions)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(response) : null
|
ycore.yconsole.log(response)
|
||||||
return callback(false, response)
|
return callback(false, response)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
@ -61,26 +61,33 @@ export function PublishPost(privacy, raw, file, callback){
|
|||||||
if(!rawtext){
|
if(!rawtext){
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
let formdata = new FormData();
|
let formdata = new FormData();
|
||||||
formdata.append("user_id", ycore.GetUserToken.decrypted().UserID);
|
formdata.append("user_id", ycore.GetUserToken.decrypted().UserID);
|
||||||
|
formdata.append("type", "new_post")
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
formdata.append("server_key", ycore.yConfig.server_key);
|
||||||
formdata.append("postPrivacy", privacy)
|
formdata.append("postPrivacy", privacy)
|
||||||
formdata.append("postText", raw);
|
formdata.append("postText", raw);
|
||||||
file? formdata.append("postPhotos", file) : null
|
file? formdata.append("postPhoto", file) : null
|
||||||
|
|
||||||
const requestOptions = {
|
const requestOptions = {
|
||||||
method: 'POST',
|
"url": `${ycore.endpoints.new_post}${ycore.GetUserToken.decrypted().UserToken}`,
|
||||||
body: formdata,
|
"method": "POST",
|
||||||
redirect: 'follow'
|
"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}`
|
ycore.yconsole.log(`Sending new post => ${rawtext} `)
|
||||||
fetch(urlObj, requestOptions)
|
jquery.ajax(requestOptions)
|
||||||
.then(response => {
|
.done(response => {
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(response) : null
|
ycore.yconsole.log(response)
|
||||||
return callback(false, response)
|
return callback(false, response)
|
||||||
})
|
})
|
||||||
.catch(error => {
|
.fail(error => {
|
||||||
console.log('error', error)
|
ycore.yconsole.log('error', error)
|
||||||
return callback(true, error)
|
return callback(true, error)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -195,9 +202,6 @@ export function GetPosts(userid, type, callback) {
|
|||||||
|
|
||||||
export const get_app_session = {
|
export const get_app_session = {
|
||||||
get_id: (callback) => {
|
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();
|
let formdata = new FormData();
|
||||||
formdata.append("server_key", ycore.yConfig.server_key);
|
formdata.append("server_key", ycore.yConfig.server_key);
|
||||||
formdata.append("type", "get");
|
formdata.append("type", "get");
|
||||||
@ -207,7 +211,7 @@ export const get_app_session = {
|
|||||||
redirect: 'follow'
|
redirect: 'follow'
|
||||||
};
|
};
|
||||||
const uriObj = `${ycore.endpoints.get_sessions}${ycore.GetUserToken.decrypted().UserToken}`
|
const uriObj = `${ycore.endpoints.get_sessions}${ycore.GetUserToken.decrypted().UserToken}`
|
||||||
notifyProccess()
|
ycore.notifyProccess('Getting session data...')
|
||||||
fetch(uriObj, requestOptions)
|
fetch(uriObj, requestOptions)
|
||||||
.then(response => response.text())
|
.then(response => response.text())
|
||||||
.then(result => {
|
.then(result => {
|
||||||
@ -215,12 +219,9 @@ export const get_app_session = {
|
|||||||
const pre2 = JSON.parse(pre)
|
const pre2 = JSON.parse(pre)
|
||||||
const pre3 = JSON.stringify(JSON.parse(pre2)["data"])
|
const pre3 = JSON.stringify(JSON.parse(pre2)["data"])
|
||||||
const obj = JSON.parse(pre3)["session_id"]
|
const obj = JSON.parse(pre3)["session_id"]
|
||||||
return asyncSessionStorage.setItem('se_src', btoa(obj)).then( callback(null, obj) )
|
return callback(null, obj)
|
||||||
})
|
})
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => ycore.yconsole.log('error', error));
|
||||||
}
|
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log("Returning from storage") : null
|
|
||||||
return callback( null, atob(fromSto) )
|
|
||||||
},
|
},
|
||||||
raw: (callback) => {
|
raw: (callback) => {
|
||||||
const formdata = new FormData();
|
const formdata = new FormData();
|
||||||
@ -238,17 +239,17 @@ export const get_app_session = {
|
|||||||
const pre = JSON.stringify(result)
|
const pre = JSON.stringify(result)
|
||||||
const parsed = JSON.parse(pre)
|
const parsed = JSON.parse(pre)
|
||||||
const obj = JSON.parse(parsed)["data"]
|
const obj = JSON.parse(parsed)["data"]
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(result, obj) : null
|
ycore.yconsole.log(result, obj)
|
||||||
return callback(null, obj)
|
return callback(null, obj)
|
||||||
})
|
})
|
||||||
.catch(error => console.log('error', error));
|
.catch(error => ycore.yconsole.log('error', error));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export function PushUserData(inputIO1, inputIO2) {
|
export function PushUserData(inputIO1, inputIO2) {
|
||||||
var getStoragedToken = Cookies.get('access_token');
|
var getStoragedToken = Cookies.get('access_token');
|
||||||
var yCore_GUDEP = ycore.endpoints.update_userData_endpoint;
|
var yCore_GUDEP = ycore.endpoints.update_userData_endpoint;
|
||||||
var urlOBJ = "" + yCore_GUDEP + getStoragedToken;
|
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();
|
var form = new FormData();
|
||||||
form.append("server_key", ycore.yConfig.server_key);
|
form.append("server_key", ycore.yConfig.server_key);
|
||||||
form.append(inputIO1, inputIO2);
|
form.append(inputIO1, inputIO2);
|
||||||
@ -262,6 +263,6 @@ export function PushUserData(inputIO1, inputIO2) {
|
|||||||
"data": form
|
"data": form
|
||||||
};
|
};
|
||||||
jquery.ajax(settings).done(function (response) {
|
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 = {};
|
let payload = {};
|
||||||
if (!values) {
|
if (!values) {
|
||||||
const message = 'Missing payload! Exception while request data...';
|
const message = 'Missing payload! Exception while request data...';
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, message) : null
|
ycore.yconsole.log(prefix, message)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
payload.UserToken = values.UserToken;
|
payload.UserToken = values.UserToken;
|
||||||
@ -27,7 +27,7 @@ export function InitSDCP(values, done) {
|
|||||||
let Ensamblator = btoa(JSON.stringify(cooked))
|
let Ensamblator = btoa(JSON.stringify(cooked))
|
||||||
ycore.SetupApp()
|
ycore.SetupApp()
|
||||||
ycore.asyncSDCP.setSDCP(Ensamblator).then(() => {
|
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)
|
return done(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -44,14 +44,14 @@ export function UpdateSDCP() {
|
|||||||
const e2 = btoa(Nsdcp)
|
const e2 = btoa(Nsdcp)
|
||||||
const n = e1.localeCompare(e2)
|
const n = e1.localeCompare(e2)
|
||||||
if (!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
|
return
|
||||||
}
|
}
|
||||||
if (e1 == e2) {
|
if (e1 == e2) {
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Equality') : null
|
ycore.yconsole.log(prefix, 'SDCP Equality')
|
||||||
}else{
|
}else{
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Update detected ! => ', n) : null
|
ycore.yconsole.log(prefix, 'SDCP Update detected ! => ', n)
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `) : null
|
ycore.yconsole.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `)
|
||||||
ycore.asyncSDCP.setSDCP(e2)
|
ycore.asyncSDCP.setSDCP(e2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ export function InitSDCP(values, done) {
|
|||||||
let payload = {};
|
let payload = {};
|
||||||
if (!values) {
|
if (!values) {
|
||||||
const message = 'Missing payload! Exception while request data...';
|
const message = 'Missing payload! Exception while request data...';
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, message) : null
|
ycore.yconsole.log(prefix, message)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
payload.UserToken = values.UserToken;
|
payload.UserToken = values.UserToken;
|
||||||
@ -29,7 +29,7 @@ export function InitSDCP(values, done) {
|
|||||||
let Ensamblator = btoa(JSON.stringify(cooked))
|
let Ensamblator = btoa(JSON.stringify(cooked))
|
||||||
ycore.SetupApp()
|
ycore.SetupApp()
|
||||||
ycore.asyncSDCP.setSDCP(Ensamblator).then(() => {
|
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)
|
return done(true)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -46,14 +46,14 @@ export function UpdateSDCP() {
|
|||||||
const e2 = btoa(Nsdcp)
|
const e2 = btoa(Nsdcp)
|
||||||
const n = e1.localeCompare(e2)
|
const n = e1.localeCompare(e2)
|
||||||
if (!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
|
return
|
||||||
}
|
}
|
||||||
if (e1 == e2) {
|
if (e1 == e2) {
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Equality') : null
|
ycore.yconsole.log(prefix, 'SDCP Equality')
|
||||||
}else{
|
}else{
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(prefix, 'SDCP Update detected ! => ', n) : null
|
ycore.yconsole.log(prefix, 'SDCP Update detected ! => ', n)
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `) : null
|
ycore.yconsole.debug(`Compare versions => NEW ${[e1]} || OLD ${[e2]} `)
|
||||||
ycore.asyncSDCP.setSDCP(e2)
|
ycore.asyncSDCP.setSDCP(e2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,7 +66,7 @@ export function SDCP() {
|
|||||||
try {
|
try {
|
||||||
atob(SDCPContainer);
|
atob(SDCPContainer);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(prefix, err)
|
ycore.yconsole.error(prefix, err)
|
||||||
ycore.router.push({pathname: '/login',})
|
ycore.router.push({pathname: '/login',})
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ export function SDCP() {
|
|||||||
let parsedSDCP = JSON.parse(decodedSDCP);
|
let parsedSDCP = JSON.parse(decodedSDCP);
|
||||||
return parsedSDCP;
|
return parsedSDCP;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(prefix, err)
|
ycore.yconsole.error(prefix, err)
|
||||||
ycore.router.push({pathname: '/login',})
|
ycore.router.push({pathname: '/login',})
|
||||||
return null
|
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){
|
function __API__User (payload){
|
||||||
var ExpireTime = ycore.DevOptions.MaxJWTexpire
|
var ExpireTime = ycore.DevOptions.MaxJWTexpire
|
||||||
const now = new Date()
|
const now = new Date()
|
||||||
now.setDate(now.getDate() + 1)
|
now.setDate(now.getDate() + 1)
|
||||||
const { UserID, UserToken } = payload
|
const { UserID, UserToken } = payload
|
||||||
const frame = { UserID, UserToken, deadline: ( ycore.DevOptions.SignForNotExpire? null : now.getTime() )}
|
const frame = { UserID, UserToken, deadline: ( ycore.DevOptions.SignForNotExpire? null : now.getTime() )}
|
||||||
console.debug(frame)
|
ycore.yconsole.debug(frame)
|
||||||
jwt.sign(
|
jwt.sign(
|
||||||
frame,
|
frame,
|
||||||
keys.secretOrKey,
|
keys.secretOrKey,
|
||||||
@ -79,10 +84,10 @@ export function MakeBackup(){
|
|||||||
}
|
}
|
||||||
export function LogoutCall(){
|
export function LogoutCall(){
|
||||||
const prefix = ('[YID Session] ')
|
const prefix = ('[YID Session] ')
|
||||||
console.log('Logout Called !')
|
ycore.yconsole.log('Logout Called !')
|
||||||
let DecodedToken = ycore.GetUserToken.decrypted().UserToken || atob(localStorage.getItem('last_backup'))
|
let DecodedToken = ycore.GetUserToken.decrypted().UserToken || atob(localStorage.getItem('last_backup'))
|
||||||
const urlOBJ = (`${ycore.endpoints.removeToken}${DecodedToken}`)
|
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();
|
const form = new FormData();
|
||||||
form.append("server_key", ycore.yConfig.server_key);
|
form.append("server_key", ycore.yConfig.server_key);
|
||||||
const settings = {
|
const settings = {
|
||||||
@ -97,7 +102,7 @@ export function LogoutCall(){
|
|||||||
jquery.ajax(settings)
|
jquery.ajax(settings)
|
||||||
.done((response) => {
|
.done((response) => {
|
||||||
const api_state = JSON.parse(response)['api_status']
|
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') {
|
if (api_state == '404') {
|
||||||
antd.notification.open({
|
antd.notification.open({
|
||||||
placement: 'topLeft',
|
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 ',
|
description: 'It seems that your token has been removed unexpectedly and could not log out from YulioID ',
|
||||||
icon: <Icons.WarningOutlined style={{ color: 'orange' }} />
|
icon: <Icons.WarningOutlined style={{ color: 'orange' }} />
|
||||||
})
|
})
|
||||||
console.log("Failed logout with YulioID™", response)
|
ycore.yconsole.log("Failed logout with YulioID™", response)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log("Successful logout with YulioID™", response, urlOBJ)
|
ycore.yconsole.log("Successful logout with YulioID™", response, urlOBJ)
|
||||||
}
|
}
|
||||||
// Runtime after dispatch API
|
// Runtime after dispatch API
|
||||||
Cookies.remove('token')
|
Cookies.remove('token')
|
||||||
@ -120,7 +125,7 @@ export function GetAuth(EncUsername, EncPassword, callback) {
|
|||||||
const prefix = '[Auth Server]:';
|
const prefix = '[Auth Server]:';
|
||||||
if (!EncUsername || !EncPassword) {
|
if (!EncUsername || !EncPassword) {
|
||||||
const message = 'Missing Data! Process Aborted...';
|
const message = 'Missing Data! Process Aborted...';
|
||||||
console.log(prefix, message);
|
ycore.yconsole.log(prefix, message);
|
||||||
}
|
}
|
||||||
const server_key = ycore.yConfig.server_key;
|
const server_key = ycore.yConfig.server_key;
|
||||||
let username = atob(EncUsername);
|
let username = atob(EncUsername);
|
||||||
@ -140,14 +145,14 @@ export function GetAuth(EncUsername, EncPassword, callback) {
|
|||||||
};
|
};
|
||||||
jquery.ajax(settings)
|
jquery.ajax(settings)
|
||||||
.done(function (response) {
|
.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 {
|
try {
|
||||||
var identState = JSON.parse(response)['api_status'];
|
var identState = JSON.parse(response)['api_status'];
|
||||||
if (identState == 200) {
|
if (identState == 200) {
|
||||||
const UserID = JSON.parse(response)['user_id'];
|
const UserID = JSON.parse(response)['user_id'];
|
||||||
const UserToken = JSON.parse(response)['access_token'];
|
const UserToken = JSON.parse(response)['access_token'];
|
||||||
let FramePayload = { UserID, UserToken }
|
let FramePayload = { UserID, UserToken }
|
||||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(FramePayload) : null
|
ycore.yconsole.log(FramePayload)
|
||||||
callback(null, '200')
|
callback(null, '200')
|
||||||
ycore.InitSDCP(FramePayload, (done) => done? __API__User(FramePayload) : null )
|
ycore.InitSDCP(FramePayload, (done) => done? __API__User(FramePayload) : null )
|
||||||
}
|
}
|
||||||
@ -180,7 +185,7 @@ export const GetUserToken = {
|
|||||||
if (!FB) {
|
if (!FB) {
|
||||||
final = FC
|
final = FC
|
||||||
}
|
}
|
||||||
ycore.DevOptions.ShowFunctionsLogs ? console.debug(final) : null
|
ycore.yconsole.debug(final)
|
||||||
return final
|
return final
|
||||||
},
|
},
|
||||||
raw: function () {
|
raw: function () {
|
||||||
@ -195,7 +200,7 @@ export function GetUserData (values, callback) {
|
|||||||
const userid = globalValue.UserID
|
const userid = globalValue.UserID
|
||||||
if (!globalValue) {
|
if (!globalValue) {
|
||||||
const message = 'Missing payload! Exception while request data... Maybe the user is not login';
|
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;
|
return;
|
||||||
}
|
}
|
||||||
const ApiPayload = new FormData();
|
const ApiPayload = new FormData();
|
||||||
@ -222,7 +227,7 @@ export function GetUserData (values, callback) {
|
|||||||
)
|
)
|
||||||
.fail(
|
.fail(
|
||||||
function (response) {
|
function (response) {
|
||||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(prefix, 'Server failure!', response) : null
|
ycore.yconsole.log(prefix, 'Server failure!', response)
|
||||||
callback(true, response )
|
callback(true, response )
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -18,14 +18,48 @@ export var endpoints = Endpoints;
|
|||||||
export var yConfig = config.yConfig;
|
export var yConfig = config.yConfig;
|
||||||
|
|
||||||
var package_json = require("../../package.json");
|
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 = {
|
export const AppInfo = {
|
||||||
name: package_json.title,
|
name: package_json.title,
|
||||||
version: package_json.version,
|
version: package_json.version,
|
||||||
logo: config.FullLogoPath,
|
logo: config.FullLogoPath,
|
||||||
logo_dark: config.DarkFullLogoPath
|
logo_dark: config.DarkFullLogoPath
|
||||||
}
|
}
|
||||||
|
|
||||||
export function RegSW(){
|
export function RegSW(){
|
||||||
console.log('Registering Service Worker...')
|
yconsole.log('Registering Service Worker...')
|
||||||
sw.register()
|
sw.register()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,6 +113,7 @@ export function notifyProccess(cust){
|
|||||||
antd.notification.open({
|
antd.notification.open({
|
||||||
icon: <Icons.LoadingOutlined style={{ color: '#108ee9' }} />,
|
icon: <Icons.LoadingOutlined style={{ color: '#108ee9' }} />,
|
||||||
message: 'Please wait',
|
message: 'Please wait',
|
||||||
|
description: (<div>{cust}</div>),
|
||||||
placement: 'bottomLeft'
|
placement: 'bottomLeft'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -118,9 +153,11 @@ export const asyncSessionStorage = {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export function RefreshONCE(){
|
export function RefreshONCE(){
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function DetectNoNStableBuild(e1) {
|
export function DetectNoNStableBuild(e1) {
|
||||||
switch (e1) {
|
switch (e1) {
|
||||||
case 'TagComponent':
|
case 'TagComponent':
|
||||||
@ -147,3 +184,22 @@ export function DetectNoNStableBuild(e1) {
|
|||||||
break;
|
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) =>{
|
DummySetControls = (e) =>{
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Controls recived => ', e) : null
|
ycore.yconsole.log('Controls recived => ', e)
|
||||||
if (this.state.Show == false) {
|
if (this.state.Show == false) {
|
||||||
this.setState({ FadeIN: true })
|
this.setState({ FadeIN: true })
|
||||||
}
|
}
|
||||||
this.setState({Show: true, RenderFragment: e})
|
this.setState({Show: true, RenderFragment: e})
|
||||||
}
|
}
|
||||||
DummyCloseControls(){
|
DummyCloseControls(){
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Closing Control Bar...') : null
|
ycore.yconsole.log('Closing Control Bar...')
|
||||||
this.setState({FadeIN: false})
|
this.setState({FadeIN: false})
|
||||||
setTimeout(() => this.setState({ Show: false, RenderFragment: null}), 1000)
|
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 === 'general_settings' && ycore.crouter.native('settings')
|
||||||
e.key === 'accountpage' && router.push('/account')
|
e.key === 'accountpage' && router.push('/account')
|
||||||
e.key === 'explore' && router.push('main')
|
e.key === 'explore' && router.push('main')
|
||||||
|
e.key === 'admin_area' && router.push('__m')
|
||||||
}
|
}
|
||||||
|
|
||||||
isDarkMode(){
|
isDarkMode(){
|
||||||
|
@ -31,7 +31,7 @@ class LikeBTN extends React.PureComponent {
|
|||||||
|
|
||||||
dispatchLike(e){
|
dispatchLike(e){
|
||||||
const { type } = this.state
|
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 })
|
this.setState({ clicked: true })
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.setState({ clicked: false })
|
this.setState({ clicked: false })
|
||||||
@ -57,7 +57,7 @@ class LikeBTN extends React.PureComponent {
|
|||||||
const { id } = this.props
|
const { id } = this.props
|
||||||
const { likes, liked, clicked } = this.state
|
const { likes, liked, clicked } = this.state
|
||||||
if (!id){
|
if (!id){
|
||||||
console.error('[LikeBTN] No post id provided!')
|
ycore.yconsole.error('[LikeBTN] No post id provided!')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
return(
|
return(
|
||||||
|
@ -6,7 +6,7 @@ import {PostCard} from 'components'
|
|||||||
var userData = ycore.SDCP()
|
var userData = ycore.SDCP()
|
||||||
|
|
||||||
export function RefreshFeed(){
|
export function RefreshFeed(){
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log('Refreshing Feed...') : null
|
ycore.yconsole.log('Refreshing Feed...')
|
||||||
window.MainFeedComponent.handleRefreshList();
|
window.MainFeedComponent.handleRefreshList();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -43,7 +43,7 @@ class MainFeed extends React.Component {
|
|||||||
const { get, filters } = this.props
|
const { get, filters } = this.props
|
||||||
try {
|
try {
|
||||||
const feedParsed = JSON.parse(feedRaw)['data']
|
const feedParsed = JSON.parse(feedRaw)['data']
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(feedParsed) : null
|
ycore.yconsole.log(feedParsed)
|
||||||
return (
|
return (
|
||||||
feedParsed.map(item=> {
|
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
|
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 ycore from 'ycore'
|
||||||
import * as Icons from '@ant-design/icons';
|
import * as Icons from '@ant-design/icons';
|
||||||
import Icon 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;
|
const { Meta } = antd.Card;
|
||||||
|
|
||||||
@ -58,12 +60,33 @@ class PostCard extends React.PureComponent{
|
|||||||
|
|
||||||
render(){
|
render(){
|
||||||
const { payload, customActions } = this.props
|
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 { 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 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(
|
return(
|
||||||
<div className={styles.cardWrapper}>
|
<div className={styles.cardWrapper}>
|
||||||
<antd.Card actions={actions} >
|
<antd.Card hoverable className={ActShowMode? styles.showMode : null} actions={actions} >
|
||||||
<Meta
|
<Meta
|
||||||
avatar={<div className={styles.postAvatar}><antd.Avatar shape="square" size={50} src={avatar} /></div>}
|
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>}
|
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;
|
min-width: 265px;
|
||||||
width: auto;
|
width: auto;
|
||||||
margin: 23px auto 50px auto;
|
margin: 23px auto 50px auto;
|
||||||
|
|
||||||
:global{
|
:global{
|
||||||
.ant-card-meta-detail > div:not(:last-child){
|
.ant-card-meta-detail > div:not(:last-child){
|
||||||
margin: 0
|
margin: 0
|
||||||
@ -18,30 +19,47 @@
|
|||||||
.ant-card-body {
|
.ant-card-body {
|
||||||
padding: 13px 0 5px 0;
|
padding: 13px 0 5px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.ant-card-actions {
|
.ant-card-actions {
|
||||||
border-top: 0;
|
border-top: 0;
|
||||||
background: #EBEBEB;
|
background: #EBEBEB;
|
||||||
opacity: 0;
|
|
||||||
height: 30px;
|
height: 30px;
|
||||||
position: relative;
|
position: relative;
|
||||||
transition: opacity 150ms linear, position 150ms linear, transform 150ms linear;
|
transition: opacity 150ms linear, position 150ms linear, transform 150ms linear;
|
||||||
border-radius: 0 0 10px 10px;
|
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 {
|
.ant-card-actions:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
transform: translate(0, 15px);
|
transform: translate(0, 15px);
|
||||||
transition: opacity 150ms linear, position 150ms linear, transform 150ms linear;
|
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 {
|
.ant-card-actions > li {
|
||||||
margin: -20px 0 0 0 ;
|
margin: -20px 0 0 0 ;
|
||||||
border-right: 0;
|
border-right: 0;
|
||||||
i{
|
span {
|
||||||
|
font-size: 16px;
|
||||||
vertical-align: middle;
|
line-height: 22px;
|
||||||
height: 40px;
|
|
||||||
width: 40px;
|
width: 40px;
|
||||||
background-color: #fff;
|
height: 40px;
|
||||||
border-radius: 24px;
|
background: white;
|
||||||
|
border-radius: 23px;
|
||||||
|
margin: auto;
|
||||||
}
|
}
|
||||||
svg {
|
svg {
|
||||||
height: 20px;
|
height: 20px;
|
||||||
@ -52,6 +70,14 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.showMode{
|
||||||
|
:global{
|
||||||
|
ul {
|
||||||
|
opacity: 1 !important;
|
||||||
|
transform: translate(0, 15px);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.postAvatar{
|
.postAvatar{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: -8px;
|
left: -8px;
|
||||||
@ -73,12 +99,14 @@
|
|||||||
color:rgb(249, 179, 64);
|
color:rgb(249, 179, 64);
|
||||||
width: 100%;
|
width: 100%;
|
||||||
z-index: 10;
|
z-index: 10;
|
||||||
i{
|
:global {
|
||||||
|
.anticon{
|
||||||
float: right;
|
float: right;
|
||||||
margin: -0 6px 0 0;;
|
margin: -0 6px 0 0;;
|
||||||
font-size: 17px;
|
font-size: 17px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.titleWrapper{
|
.titleWrapper{
|
||||||
display: flex;
|
display: flex;
|
||||||
h4{
|
h4{
|
||||||
|
@ -6,6 +6,7 @@ import {CustomIconss} from 'components'
|
|||||||
import { RefreshFeed } from 'components/MainFeed'
|
import { RefreshFeed } from 'components/MainFeed'
|
||||||
import * as Icons from '@ant-design/icons';
|
import * as Icons from '@ant-design/icons';
|
||||||
import Icon from '@ant-design/icons'
|
import Icon from '@ant-design/icons'
|
||||||
|
import * as MICONS from '@material-ui/icons'
|
||||||
|
|
||||||
const { Meta } = antd.Card;
|
const { Meta } = antd.Card;
|
||||||
const userData = ycore.SDCP();
|
const userData = ycore.SDCP();
|
||||||
@ -38,7 +39,29 @@ class PostCreator extends React.PureComponent{
|
|||||||
UploadActive: false,
|
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(){
|
ToogleVisibility(){
|
||||||
this.setState({ visible: !this.state.visible })
|
this.setState({ visible: !this.state.visible })
|
||||||
}
|
}
|
||||||
@ -48,17 +71,16 @@ class PostCreator extends React.PureComponent{
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleFileUpload = info => {
|
handleFileUpload = info => {
|
||||||
console.log(info.file.originFileObj)
|
|
||||||
if (info.file.status === 'uploading') {
|
if (info.file.status === 'uploading') {
|
||||||
this.setState({ loading: true });
|
this.setState({ loading: true });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (info.file.status === 'done') {
|
if (info.file.status === 'done') {
|
||||||
this.ToogleUpload()
|
this.ToogleUpload()
|
||||||
// Get this url from response in real world.
|
this.setState({ file: info.file.originFileObj })
|
||||||
getBase64(info.file.originFileObj, imageUrl =>
|
getBase64(info.file.originFileObj, fileURL =>
|
||||||
this.setState({
|
this.setState({
|
||||||
imageUrl,
|
fileURL,
|
||||||
loading: false,
|
loading: false,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@ -66,16 +88,17 @@ class PostCreator extends React.PureComponent{
|
|||||||
};
|
};
|
||||||
|
|
||||||
beforeUpload(file) {
|
beforeUpload(file) {
|
||||||
console.log('before')
|
const filter = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'video/mp4';
|
||||||
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
|
if (!filter) {
|
||||||
if (!isJpgOrPng) {
|
antd.message.error('Invalid File!');
|
||||||
message.error('You can only upload JPG/PNG file!');
|
this.FlushPostState('error')
|
||||||
}
|
}
|
||||||
const isLt2M = file.size / 1024 / 1024 < 2;
|
const maxsize = file.size / 1024 / 1024 < ycore.DevOptions.MaximunAPIPayload;
|
||||||
if (!isLt2M) {
|
if (!maxsize) {
|
||||||
message.error('Image must smaller than 2MB!');
|
antd.message.error('Image must smaller than 99MB!');
|
||||||
|
this.FlushPostState('error')
|
||||||
}
|
}
|
||||||
return isJpgOrPng && isLt2M;
|
return filter && maxsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
handleChanges = ({ target: { value } }) => {
|
handleChanges = ({ target: { value } }) => {
|
||||||
@ -93,43 +116,49 @@ class PostCreator extends React.PureComponent{
|
|||||||
this.setState({ toolbox_open: !this.state.toolbox_open })
|
this.setState({ toolbox_open: !this.state.toolbox_open })
|
||||||
}
|
}
|
||||||
|
|
||||||
handlePublishPost = (e) => {
|
FlushPostState = (type) =>{
|
||||||
const { rawtext, shareWith, imageUrl } = this.state;
|
switch (type) {
|
||||||
let postFile;
|
case 'error':
|
||||||
if (imageUrl) {
|
this.setState({
|
||||||
console.log('EXIST ',imageUrl)
|
posting_ok: false,
|
||||||
postFile = imageUrl;
|
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
|
return null
|
||||||
}
|
}
|
||||||
this.setState({ posting: true, keys_remaining: '512' })
|
this.setState({ posting: true, keys_remaining: '512' })
|
||||||
console.log('to post ',postFile)
|
ycore.PublishPost(ycore.GetPostPrivacy.bool(shareWith), rawtext, file, (err, res) => {
|
||||||
ycore.PublishPost(ycore.GetPostPrivacy.bool(shareWith), rawtext, postFile, (err, res) => {
|
|
||||||
if (err) {
|
if (err) {
|
||||||
ycore.notifyError(err)
|
ycore.notifyError(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
this.setState({ posting_ok: true, posting: false, rawtext: ''})
|
this.FlushPostState()
|
||||||
setTimeout( () => {this.setState({ posting_ok: false }) }, 1000)
|
|
||||||
RefreshFeed()
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
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(){
|
render(){
|
||||||
const { keys_remaining, visible } = this.state;
|
const { keys_remaining, visible } = this.state;
|
||||||
@ -166,6 +195,7 @@ class PostCreator extends React.PureComponent{
|
|||||||
<Icons.InboxOutlined />
|
<Icons.InboxOutlined />
|
||||||
</p>
|
</p>
|
||||||
<p className="ant-upload-text">Click or drag file to this area to upload</p>
|
<p className="ant-upload-text">Click or drag file to this area to upload</p>
|
||||||
|
<span>*Allowed PNG, JPG, MP4 </span>
|
||||||
</div>
|
</div>
|
||||||
</antd.Upload.Dragger>
|
</antd.Upload.Dragger>
|
||||||
</div>
|
</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.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} >
|
<div className={styles.postExtra} >
|
||||||
{ this.state.imageUrl?
|
{ this.state.file?
|
||||||
<div className={styles.imagePreviewWrapper}>
|
this.renderPostPlayer() : null
|
||||||
<img className={styles.imagePreview} src={this.state.imageUrl} />
|
|
||||||
</div> : null
|
|
||||||
}
|
}
|
||||||
<antd.Button type="ghost" onClick={() => this.ToogleUpload()} > <Icons.CameraFilled /></antd.Button>
|
<antd.Button type="ghost" onClick={() => this.ToogleUpload()} > <MICONS.AddCircle /></antd.Button>
|
||||||
<antd.Button type="ghost"> <Icons.VideoCameraFilled /></antd.Button>
|
<antd.Button type="ghost" onClick={this.handleToggleToolbox} ><MICONS.Tune /></antd.Button>
|
||||||
<antd.Button onClick={this.handleToggleToolbox} type="ghost"><Icons.PlusCircleOutlined /></antd.Button>
|
|
||||||
<antd.Dropdown overlay={shareOptionsMenu}>
|
<antd.Dropdown overlay={shareOptionsMenu}>
|
||||||
<a className={styles.shareWith} onClick={e => e.preventDefault()}>
|
<a className={styles.shareWith} onClick={e => e.preventDefault()}>
|
||||||
{ycore.GetPostPrivacy.decorator(this.state.shareWith)}
|
{ycore.GetPostPrivacy.decorator(this.state.shareWith)}
|
||||||
|
@ -138,11 +138,24 @@
|
|||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
}
|
}
|
||||||
:global{
|
: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 {
|
.ant-btn .anticon {
|
||||||
transition: margin-left 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
transition: margin-left 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
|
||||||
margin: 8px;
|
margin: 8px;
|
||||||
}
|
}
|
||||||
.ant-btn{
|
.ant-btn{
|
||||||
|
width: 35px;
|
||||||
|
height: 35px;
|
||||||
float: left;
|
float: left;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border-radius: 11px;
|
border-radius: 11px;
|
||||||
@ -151,8 +164,7 @@
|
|||||||
border-color: transparent;
|
border-color: transparent;
|
||||||
}
|
}
|
||||||
.ant-btn:hover{
|
.ant-btn:hover{
|
||||||
border-color: rgb(53, 53, 53);
|
border-color: transparent;
|
||||||
color: rgb(53, 53, 53);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ const userData = ycore.SDCP();
|
|||||||
|
|
||||||
function isOwnProfile(id){
|
function isOwnProfile(id){
|
||||||
if(id == userData.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 true
|
||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
@ -54,9 +54,9 @@ class UserProfile extends React.Component {
|
|||||||
exception? ycore.notifyError(exception) : null
|
exception? ycore.notifyError(exception) : null
|
||||||
try {
|
try {
|
||||||
const rp = JSON.parse(response)
|
const rp = JSON.parse(response)
|
||||||
ycore.DevOptions.ShowFunctionsLogs? console.log(rp) : null
|
ycore.yconsole.log(rp)
|
||||||
if (!rp['0']) {
|
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!'}
|
const val = { id: null, username: 'User not found!'}
|
||||||
this.setState({ RenderValue: val, loading: false })
|
this.setState({ RenderValue: val, loading: false })
|
||||||
return
|
return
|
||||||
@ -64,7 +64,7 @@ class UserProfile extends React.Component {
|
|||||||
const c1 = rp['0'].username.toLowerCase()
|
const c1 = rp['0'].username.toLowerCase()
|
||||||
const c2 = string.toLowerCase()
|
const c2 = string.toLowerCase()
|
||||||
if (c1 !== c2) {
|
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}`)
|
ycore.crouter.native(`@${c1}`)
|
||||||
}
|
}
|
||||||
this.setState({ UUID: rp['0'].user_id, RenderValue: rp['0'], loading: false , Followed: ycore.booleanFix(rp['0'].is_following)})
|
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(){
|
render(){
|
||||||
const { loading, UUID } = this.state
|
const { loading, UUID } = this.state
|
||||||
console.log(UUID)
|
|
||||||
return(
|
return(
|
||||||
<div>
|
<div>
|
||||||
{loading? <antd.Skeleton active /> :
|
{loading? <antd.Skeleton active /> :
|
||||||
|
@ -7,6 +7,7 @@ import '@ant-design/compatible/assets/index.css';
|
|||||||
import { Button, Input, Drawer, Collapse } from 'antd';
|
import { Button, Input, Drawer, Collapse } from 'antd';
|
||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import formstyle from './formstyle.less'
|
import formstyle from './formstyle.less'
|
||||||
|
import * as ycore from 'ycore'
|
||||||
|
|
||||||
const FormItem = Form.Item
|
const FormItem = Form.Item
|
||||||
|
|
||||||
@ -46,16 +47,16 @@ class YulioID extends Component {
|
|||||||
|
|
||||||
if (!EncUsername || !EncPassword) {
|
if (!EncUsername || !EncPassword) {
|
||||||
var message = 'Incomplete information!'
|
var message = 'Incomplete information!'
|
||||||
console.log(prefix, message)
|
ycore.yconsole.log(prefix, message)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EncUsername && EncPassword){
|
if (EncUsername && EncPassword){
|
||||||
this.setState({ ShowLoading: true, StateMessage: 'Wait a sec...' });
|
this.setState({ ShowLoading: true, StateMessage: 'Wait a sec...' });
|
||||||
if (DevOptions.InfiniteLogin == true) {
|
if (DevOptions.InfiniteLogin == true) {
|
||||||
console.log(prefix, 'InfiniteLogin is enabled! Disabled getAuth')
|
ycore.yconsole.log(prefix, 'InfiniteLogin is enabled! Disabled getAuth')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log(prefix, 'Initialising login process...')
|
ycore.yconsole.log(prefix, 'Initialising login process...')
|
||||||
GetAuth(EncUsername, EncPassword, (exception, response) => this.handleResponse(response))
|
GetAuth(EncUsername, EncPassword, (exception, response) => this.handleResponse(response))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,6 @@ export default {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
else if(!pathMatchRegexp(['','/login'], window.location.pathname)) {
|
else if(!pathMatchRegexp(['','/login'], window.location.pathname)) {
|
||||||
console.log('REP')
|
|
||||||
if (validBackup == true) {
|
if (validBackup == true) {
|
||||||
ycore.LogoutCall()
|
ycore.LogoutCall()
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,27 @@
|
|||||||
import React, { PureComponent } from 'react'
|
import React, { PureComponent } from 'react'
|
||||||
import { UserProfile } from 'components'
|
import { UserProfile } from 'components'
|
||||||
|
import __m from '../__m/index.js'
|
||||||
import { pathMatchRegexp } from 'utils'
|
import { pathMatchRegexp } from 'utils'
|
||||||
import Error404 from '../404.js'
|
import Error404 from '../404.js'
|
||||||
import * as ycore from 'ycore'
|
import * as ycore from 'ycore'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PageIndexer extends PureComponent {
|
class PageIndexer extends PureComponent {
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {location} = this.props
|
const {location} = this.props
|
||||||
const matchUser = pathMatchRegexp("/@:id", location.pathname);
|
const matchUser = pathMatchRegexp("/@:id", location.pathname);
|
||||||
const matchSearch = pathMatchRegexp("/s/:id", location.pathname);
|
const matchMaster = pathMatchRegexp("/__m", location.pathname)
|
||||||
|
|
||||||
if (matchUser) {
|
if (matchUser) {
|
||||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(`User matched! ${location.pathname}`) : null
|
ycore.yconsole.log(`User matched! ${location.pathname}`)
|
||||||
return(<div>
|
return(<div>
|
||||||
<UserProfile regx={matchUser} />
|
<UserProfile regx={matchUser} />
|
||||||
</div>)
|
</div>)
|
||||||
}
|
}
|
||||||
if (matchSearch) {
|
if (matchMaster){
|
||||||
ycore.DevOptions.ShowFunctionsLogs ? console.log(`Search matched! ${location.pathname}`) : null
|
return ycore.__permission()? <__m /> : <Error404 />
|
||||||
return(<div>
|
|
||||||
<UserProfile regx={matchSearch} />
|
|
||||||
</div>)
|
|
||||||
}
|
}
|
||||||
// By default return Error 404
|
// By default return Error 404
|
||||||
return(<div><Error404 /></div>)
|
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 raw = parsed.toString()
|
||||||
const string = raw.replace('/s/', "")
|
const string = raw.replace('/s/', "")
|
||||||
ycore.SeachKeywords(string, (exception, response) => {
|
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
|
exception? ycore.notifyError(exception) : null
|
||||||
this.setState({ SearchResult: response })
|
this.setState({ SearchResult: response })
|
||||||
this.toogleLoading()
|
this.toogleLoading()
|
||||||
|
@ -17,7 +17,7 @@ class Base extends Component {
|
|||||||
|
|
||||||
componentDidMount(){
|
componentDidMount(){
|
||||||
if (!localStorage.getItem('app_settings')) {
|
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 =>{
|
SettingRender = data =>{
|
||||||
@ -69,7 +69,7 @@ class Base extends Component {
|
|||||||
const updatedValue = [...this.state.SettingRepo]
|
const updatedValue = [...this.state.SettingRepo]
|
||||||
.map(ita => ita === item? Object.assign(ita, { "value": to }) : ita);
|
.map(ita => ita === item? Object.assign(ita, { "value": to }) : ita);
|
||||||
this.setState({SettingRepo: updatedValue, forSave: true})
|
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) {
|
} catch (err) {
|
||||||
console.log(err)
|
console.log(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user