This commit is contained in:
srgooglo 2020-03-31 03:58:43 +02:00
parent 087cc9592e
commit 93c90e4c88
25 changed files with 449 additions and 267 deletions

View File

@ -14,6 +14,7 @@ function SettingStoragedValue(e){
const fromStorage = JSON.parse(localStorage.getItem('app_settings')) const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
export var AppSettings = { export var AppSettings = {
__global_server_prexif: 'https://api.ragestudio.net/RSA-COMTY/r/',
// Global Behaviors // Global Behaviors
InfiniteLoading: false, InfiniteLoading: false,
InfiniteLogin: false, InfiniteLogin: false,

View File

@ -1,8 +1,45 @@
import * as Icons from '@ant-design/icons'
export var BadgesType = [ export var BadgesType = [
{ {
id: 'alpha_test', id: 'alpha_test',
title: 'Alpha Tester', title: 'Alpha Tester',
color: 'volcano', color: 'green',
tip: 'Oh yeah!', require: '',
icon: (<Icons.BugOutlined />),
tip: 'Oh yeah!'
}, },
{
id: 'nsfw_flag',
title: 'NSFW',
color: 'volcano',
require: 'nsfw_flag',
icon: (<Icons.RocketOutlined />),
tip: 'NSFW',
},
{
id: 'pro',
title: 'CPRO™',
color: 'purple',
require: 'pro',
icon: (<Icons.RocketOutlined />),
tip: 'CPRO™',
},
{
id: 'dev',
title: 'DEVELOPER',
color: 'default',
require: 'dev',
icon: (<Icons.RocketOutlined />),
tip: 'DEVELOPER',
},
{
id: 'professional_retarder',
title: 'Professional Retarder',
color: 'gold',
require: '',
icon: (<Icons.SmileOutlined />),
tip: 'hump....',
}
] ]

View File

@ -21,7 +21,7 @@
"@lingui/react": "^2.9.1", "@lingui/react": "^2.9.1",
"@material-ui/core": "^4.9.3", "@material-ui/core": "^4.9.3",
"@material-ui/icons": "^4.9.1", "@material-ui/icons": "^4.9.1",
"antd": "^4.0.4", "antd": "^4.1.0",
"axios": "^0.19.2", "axios": "^0.19.2",
"bag.js": "0.0.2", "bag.js": "0.0.2",
"classnames": "^2.2.6", "classnames": "^2.2.6",
@ -40,6 +40,7 @@
"nprogress": "^0.2.0", "nprogress": "^0.2.0",
"os-utils": "0.0.14", "os-utils": "0.0.14",
"path-to-regexp": "^6.1.0", "path-to-regexp": "^6.1.0",
"plyr-react": "^2.2.0",
"prop-types": "^15.7.2", "prop-types": "^15.7.2",
"radium": "^0.26.0", "radium": "^0.26.0",
"react-animations": "^1.0.0", "react-animations": "^1.0.0",
@ -50,6 +51,7 @@
"react-select-country-list": "^2.1.2", "react-select-country-list": "^2.1.2",
"react-sound": "^1.2.0", "react-sound": "^1.2.0",
"react-virtualized": "^9.21.2", "react-virtualized": "^9.21.2",
"socket.io-client": "^2.3.0",
"store": "^2.0.12", "store": "^2.0.12",
"timeago.js": "^4.0.2", "timeago.js": "^4.0.2",
"ts-cookies": "^1.0.0", "ts-cookies": "^1.0.0",

View File

@ -1,5 +1,6 @@
// List of modules used for this app // List of modules used for this app
export * from './libs/comty_ng/pre.js'; export * from './libs/comty_ng/pre.js';
export * from './libs/ycore_sync/pre.js';
export * from './libs/yulio_id/pre.js'; export * from './libs/yulio_id/pre.js';
export * from './libs/ycore_styles/pre.js'; export * from './libs/ycore_styles/pre.js';
export * from './libs/ycore_sdcp/pre.js'; export * from './libs/ycore_sdcp/pre.js';

View File

@ -1,4 +1,5 @@
import { API_Call, endpoints } from 'ycore' import { API_Call, endpoints } from 'ycore'
import { comty_rsa } from '../rs_cloud/pre'
export const comty_user = { export const comty_user = {
setData: () => {}, setData: () => {},
@ -20,8 +21,20 @@ export const comty_user = {
) )
}, },
block: (callback, payload) => { block: (callback, payload) => {
// TO DO if (!payload) {
return false return false
}
const { user_id, block_action } = payload
let formdata = new FormData()
formdata.append('user_id', user_id)
formdata.append('block_action', block_action)
API_Call((err,res)=>{
return callback(err,res)
},
comty_rsa.endpoint('block-user'),
formdata
)
}, },
find: (callback, payload) => { find: (callback, payload) => {
if (!payload) { if (!payload) {

View File

@ -89,3 +89,13 @@ export const __rscloud = {
set: () => {}, set: () => {},
}, },
} }
export const comty_rsa = {
endpoint: (endpoint, options) => {
let join_token = true;
if (options) {
join_token = options.join_token
}
return `${ycore.AppSettings.__global_server_prexif}${endpoint}${join_token? `?access_token=` : ``}`
}
}

View File

@ -61,7 +61,7 @@ export const cryptSDCP = {
return false return false
}, },
valid: () => { valid: () => {
const a = ycore.asyncSDCP.get() const a = ycore.sdcp.get()
return a ? true : false return a ? true : false
}, },
} }

View File

@ -0,0 +1,10 @@
import * as ycore from 'ycore'
import io from 'socket.io-client'
var socket = io('http://localhost:5500');
export const sync = {
emmitPost: () => {
socket.emit('new');
}
}

View File

@ -18,16 +18,16 @@ export const make_data = {
export const IsThisUser = { export const IsThisUser = {
admin: () => { admin: () => {
const a = ycore.userData() return ycore.booleanFix(ycore.userData().admin) ? true : false
return ycore.booleanFix(a.admin) ? true : false
}, },
dev: () => { dev: () => {
const a = ycore.userData() return ycore.booleanFix(ycore.userData().dev) ? true : false
return ycore.booleanFix(a.dev) ? true : false
}, },
pro: () => { pro: () => {
const a = ycore.userData() return ycore.booleanFix(ycore.userData().is_pro) ? true : false
return ycore.booleanFix(a.is_pro) ? true : false },
nsfw: () => {
return ycore.booleanFix(ycore.userData().nsfw) ? true : false
}, },
same: a => { same: a => {
if (a == ycore.userData().UserID) { if (a == ycore.userData().UserID) {

View File

@ -6,6 +6,7 @@
*/ */
import * as Endpoints from 'globals/endpoints/index.js' import * as Endpoints from 'globals/endpoints/index.js'
import io from 'socket.io-client'
import * as Icons from '@ant-design/icons' import * as Icons from '@ant-design/icons'
import localforage from 'localforage' import localforage from 'localforage'
import { format } from 'timeago.js' import { format } from 'timeago.js'
@ -41,6 +42,12 @@ localforage.config({
storeName: package_json.name, storeName: package_json.name,
}) })
var socket = io('http://localhost:5500');
socket.on('post_feed', function (data) {
console.log('SOCKET => ',data)
});
/** /**
* Convert a base64 string in a Blob according to the data and contentType. * Convert a base64 string in a Blob according to the data and contentType.
* *

View File

@ -6,7 +6,6 @@ import styles from './index.less'
import classnames from 'classnames' import classnames from 'classnames'
import { __priPost, __secComments, __priSearch, __trendings, __pro } from './renders.js' import { __priPost, __secComments, __priSearch, __trendings, __pro } from './renders.js'
import { FormatListNumbered } from '@material-ui/icons'
export const SwapMode = { export const SwapMode = {
close: () => { close: () => {
@ -37,7 +36,8 @@ export const SwapMode = {
export default class Secondary extends React.PureComponent { export default class Secondary extends React.PureComponent {
constructor(props) { constructor(props) {
super(props), (window.SecondaryLayoutComponent = this) super(props),
window.SecondaryLayoutComponent = this,
this.state = { this.state = {
loading: true, loading: true,
half: false, half: false,

View File

@ -6,12 +6,12 @@ import classnames from 'classnames'
class Like_button extends React.PureComponent { class Like_button extends React.PureComponent {
constructor(props) { constructor(props) {
super(props), super(props),
(this.state = { this.state = {
liked: this.props.liked, liked: this.props.liked,
likes: this.props.count, likes: this.props.count,
type: this.props.liked ? 'dislike' : 'like', type: this.props.liked ? 'dislike' : 'like',
clicked: false, clicked: false,
}) }
} }
SumLike() { SumLike() {

View File

@ -2,6 +2,7 @@ import React from 'react'
import * as antd from 'antd' import * as antd from 'antd'
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 styles from './index.less'
import { PostCard } from 'components' import { PostCard } from 'components'
@ -176,7 +177,7 @@ class MainFeed extends React.Component {
render() { render() {
const { loading, invalid } = this.state const { loading, invalid } = this.state
return ( return (
<div id="mainfeed"> <div className={styles.main_feed_wrapper} id="mainfeed">
{invalid ? ( {invalid ? (
<antd.Card <antd.Card
style={{ style={{

View File

@ -0,0 +1,4 @@
.main_feed_wrapper{
scroll-behavior: smooth;
}

View File

@ -1,46 +1,53 @@
import React from 'react' import React from 'react'
import styles from './index.less' import * as Icons from '@ant-design/icons'
export default class MediaPlayer extends React.PureComponent { export default class MediaPlayer extends React.PureComponent {
renderPostPlayer(payload) {
const ident = payload
if (ident.includes('.mp4')) {
return (
<video id="player" playsInline controls>
<source src={`${payload}`} type="video/mp4" />
</video>
)
}
if (ident.includes('.webm')) {
return (
<video id="player" playsInline controls>
<source src={payload} type="video/webm" />
</video>
)
}
if (ident.includes('.mp3')) {
return (
<audio id="player" controls>
<source src={payload} type="audio/mp3" />
</audio>
)
}
if (ident.includes('.ogg')) {
return (
<audio id="player" controls>
<source src={payload} type="audio/ogg" />
</audio>
)
} else {
return <img src={payload} />
}
}
render() { render() {
const { file } = this.props const { file } = this.props
return ( let type;
<div className={styles.PlayerContainer}>
{this.renderPostPlayer(file)} const ImageExtensions = ['.png', '.jpg', '.jpeg', '.gif']
</div> const VideoExtensions = ['.mp4', '.mov', '.avi']
) const AudioExtensions = ['.mp3', '.ogg', '.wav']
const FilesAllowed = ImageExtensions.concat(VideoExtensions, AudioExtensions)
for (const prop in FilesAllowed) {
if(file.includes(`${ImageExtensions[prop]}`)){
type = 'image'
}
if(file.includes(`${VideoExtensions[prop]}`)){
type = 'video'
}
if(file.includes(`${AudioExtensions[prop]}`)){
type = 'audio'
}
}
if (type == 'video') {
// const payload = {type: 'video', sources: [{src: file,}]}
// return (
// <PlyrComponent styles={{ width: '100%' }} sources={payload} />
// )
return (
<video id="player" playsInline controls>
<source src={file} />
</video>
)
}
if (type == 'audio') {
return (
<audio id="player" controls>
<source src={file} />
</audio>
)
}
if (type == 'image') {
if (file.includes('gif')) {
return <div><Icons.GifOutlined /> <img src={file} /></div>
}
return <img src={file} />
}
return null
} }
} }

View File

@ -12,7 +12,9 @@
margin-top: -250px; margin-top: -250px;
margin-left: -350px; margin-left: -350px;
} }
audio{
width: 100%;
}
video { video {
object-fit: contain; object-fit: contain;
position: absolute; position: absolute;
@ -24,8 +26,4 @@
margin-left: -350px; margin-left: -350px;
} }
h3 {
color: rgb(85, 85, 85);
font-weight: 470;
}
} }

View File

@ -0,0 +1,134 @@
"use strict";
function e(e) {
return e && "object" == typeof e && "default" in e ? e.default : e
}
Object.defineProperty(exports, "__esModule", {
value: !0
});
var t = e(require("react")),
n = e(require("plyr"));
function o(e, t) {
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function")
}
function i(e, t) {
for (var n = 0; n < t.length; n++) {
var o = t[n];
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, o.key, o)
}
}
function r(e) {
return (r = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (e) {
return typeof e
} : function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
})(e)
}
function c(e) {
return (c = "function" == typeof Symbol && "symbol" === r(Symbol.iterator) ? function (e) {
return r(e)
} : function (e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : r(e)
})(e)
}
function s(e, t) {
return !t || "object" !== c(t) && "function" != typeof t ? function (e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}(e) : t
}
function a(e) {
return (a = Object.setPrototypeOf ? Object.getPrototypeOf : function (e) {
return e.__proto__ || Object.getPrototypeOf(e)
})(e)
}
function l(e, t) {
return (l = Object.setPrototypeOf || function (e, t) {
return e.__proto__ = t, e
})(e, t)
}
require("plyr/dist/plyr.css");
! function (e, t) {
void 0 === t && (t = {});
var n = t.insertAt;
if (e && "undefined" != typeof document) {
var o = document.head || document.getElementsByTagName("head")[0],
i = document.createElement("style");
i.type = "text/css", "top" === n && o.firstChild ? o.insertBefore(i, o.firstChild) : o.appendChild(i), i.styleSheet ? i.styleSheet.cssText = e : i.appendChild(document.createTextNode(e))
}
}('.yjs-plyr{width: 100%!important;position:relative;background-color:#4caf50;border:none;font-size:28px;color:#fff;padding:20px;width:200px;text-align:center;-webkit-transition-duration:.4s;transition-duration:.4s;text-decoration:none;overflow:hidden;cursor:pointer;box-shadow:0 8px 16px 0 rgba(0,0,0,.2),0 6px 20px 0 rgba(0,0,0,.19)}.PlyrComponent:after{content:"";background:#f1f1f1;display:block;position:absolute;padding-top:300%;padding-left:350%;margin-left:-20px!important;margin-top:-120%;opacity:0;transition:all .8s}.PlyrComponent:active:after{padding:0;margin:0;opacity:1;transition:0s}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInN0eWxlcy5jc3MiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZUFDRSxpQkFBa0IsQ0FDbEIsd0JBQXlCLENBQ3pCLFdBQVksQ0FDWixjQUFlLENBQ2YsVUFBYyxDQUNkLFlBQWEsQ0FDYixXQUFZLENBQ1osaUJBQWtCLENBQ2xCLCtCQUFpQyxDQUNqQyx1QkFBeUIsQ0FDekIsb0JBQXFCLENBQ3JCLGVBQWdCLENBQ2hCLGNBQWUsQ0FDZixtRUFDRixDQUVBLHFCQUNFLFVBQVcsQ0FDWCxrQkFBbUIsQ0FDbkIsYUFBYyxDQUNkLGlCQUFrQixDQUNsQixnQkFBaUIsQ0FDakIsaUJBQWtCLENBQ2xCLDJCQUE2QixDQUM3QixnQkFBaUIsQ0FDakIsU0FBVSxDQUNWLGtCQUNGLENBRUEsNEJBQ0UsU0FBVSxDQUNWLFFBQVMsQ0FDVCxTQUFVLENBQ1YsYUFDRiIsImZpbGUiOiJzdHlsZXMuY3NzIiwic291cmNlc0NvbnRlbnQiOlsiLlBseXJDb21wb25lbnQge1xuICBwb3NpdGlvbjogcmVsYXRpdmU7XG4gIGJhY2tncm91bmQtY29sb3I6ICM0Q0FGNTA7XG4gIGJvcmRlcjogbm9uZTtcbiAgZm9udC1zaXplOiAyOHB4O1xuICBjb2xvcjogI0ZGRkZGRjtcbiAgcGFkZGluZzogMjBweDtcbiAgd2lkdGg6IDIwMHB4O1xuICB0ZXh0LWFsaWduOiBjZW50ZXI7XG4gIC13ZWJraXQtdHJhbnNpdGlvbi1kdXJhdGlvbjogMC40czsgLyogU2FmYXJpICovXG4gIHRyYW5zaXRpb24tZHVyYXRpb246IDAuNHM7XG4gIHRleHQtZGVjb3JhdGlvbjogbm9uZTtcbiAgb3ZlcmZsb3c6IGhpZGRlbjtcbiAgY3Vyc29yOiBwb2ludGVyO1xuICBib3gtc2hhZG93OiAwIDhweCAxNnB4IDAgcmdiYSgwLDAsMCwwLjIpLCAwIDZweCAyMHB4IDAgcmdiYSgwLDAsMCwwLjE5KTtcbn1cblxuLlBseXJDb21wb25lbnQ6YWZ0ZXIge1xuICBjb250ZW50OiBcIlwiO1xuICBiYWNrZ3JvdW5kOiAjZjFmMWYxO1xuICBkaXNwbGF5OiBibG9jaztcbiAgcG9zaXRpb246IGFic29sdXRlO1xuICBwYWRkaW5nLXRvcDogMzAwJTtcbiAgcGFkZGluZy1sZWZ0OiAzNTAlO1xuICBtYXJnaW4tbGVmdDogLTIwcHggIWltcG9ydGFudDtcbiAgbWFyZ2luLXRvcDogLTEyMCU7XG4gIG9wYWNpdHk6IDA7XG4gIHRyYW5zaXRpb246IGFsbCAwLjhzXG59XG5cbi5QbHlyQ29tcG9uZW50OmFjdGl2ZTphZnRlciB7XG4gIHBhZGRpbmc6IDA7XG4gIG1hcmdpbjogMDtcbiAgb3BhY2l0eTogMTtcbiAgdHJhbnNpdGlvbjogMHNcbn1cbiJdfQ== */');
var u = function (e) {
function r() {
return o(this, r), s(this, a(r).apply(this, arguments))
}
var c, u, p;
return function (e, t) {
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
e.prototype = Object.create(t && t.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}), t && l(e, t)
}(r, t.Component), c = r, (u = [{
key: "componentDidMount",
value: function () {
this.player = new n(".yjs-plyr", this.props.options), this.player.source = this.props.sources
}
}, {
key: "componentWillUnmount",
value: function () {
this.player.destroy()
}
}, {
key: "render",
value: function () {
return t.createElement("video", {
className: "yjs-plyr plyr"
})
}
}]) && i(c.prototype, u), p && i(c, p), r
}();
u.defaultProps = {
options: {
controls: ["rewind", "play", "fast-forward", "progress", "current-time", "duration", "mute", "volume", "settings", "fullscreen"],
i18n: {
restart: "Restart",
rewind: "Rewind {seektime}s",
play: "Play",
pause: "Pause",
fastForward: "Forward {seektime}s",
seek: "Seek",
seekLabel: "{currentTime} of {duration}",
played: "Played",
buffered: "Buffered",
currentTime: "Current time",
duration: "Duration",
volume: "Volume",
mute: "Mute",
unmute: "Unmute",
enableCaptions: "Enable captions",
disableCaptions: "Disable captions",
download: "Download",
enterFullscreen: "Enter fullscreen",
exitFullscreen: "Exit fullscreen",
frameTitle: "Player for {title}",
captions: "Captions",
settings: "Settings",
menuBack: "Go back to previous menu",
speed: "Speed",
normal: "Normal",
quality: "Quality",
loop: "Loop"
}
},
}, exports.PlyrComponent = u;

View File

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import * as antd from 'antd' import * as antd from 'antd'
import styles from './index.less' import styles from './index.less'
import { CustomIcons, Like_button } from 'components' import { CustomIcons, Like_button, MediaPlayer } 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'
@ -21,48 +21,21 @@ const emptyPayload = {
class PostCard extends React.PureComponent { class PostCard extends React.PureComponent {
constructor(props) { constructor(props) {
super(props), super(props),
(this.state = { this.state = {
FadeIN: true, visibleMoreMenu: false,
postPinned: this.props.payload.is_post_pinned, postPinned: this.props.payload.is_post_pinned,
postSaved: this.props.payload.is_post_saved, postSaved: this.props.payload.is_post_saved,
postReported: this.props.payload.is_post_reported, postReported: this.props.payload.is_post_reported,
postBoosted: this.props.payload.is_post_boosted, postBoosted: this.props.payload.is_post_boosted,
ReportIgnore: false, ReportIgnore: false,
}) }
} }
handleVisibleChange = flag => {
this.setState({ visibleMoreMenu: flag });
};
renderPostPlayer(payload) { toogleMoreMenu(){
const ident = payload this.setState({visibleMoreMenu: !this.state.visibleMoreMenu})
if (ident.includes('.mp4')) {
return (
<video id="player" playsInline controls>
<source src={`${payload}`} type="video/mp4" />
</video>
)
}
if (ident.includes('.webm')) {
return (
<video id="player" playsInline controls>
<source src={payload} type="video/webm" />
</video>
)
}
if (ident.includes('.mp3')) {
return (
<audio id="player" controls>
<source src={payload} type="audio/mp3" />
</audio>
)
}
if (ident.includes('.ogg')) {
return (
<audio id="player" controls>
<source src={payload} type="audio/ogg" />
</audio>
)
} else {
return <img src={payload} />
}
} }
goToPost(postID) { goToPost(postID) {
@ -152,19 +125,26 @@ class PostCard extends React.PureComponent {
const actions = customActions || defaultActions const actions = customActions || defaultActions
const MoreMenu = ( const MoreMenu = (
<antd.Menu> <antd.Menu >
{ycore.IsThisPost.owner(publisher.id) ? ( {ycore.IsThisPost.owner(publisher.id) ? (
<antd.Menu.Item <antd.Menu.Item
onClick={() => handlePostActions.delete(id)}
key="remove_post" key="remove_post"
> >
<Icons.DeleteOutlined /> Remove post <antd.Popconfirm
title="Are you sure delete this post?"
onConfirm={() => handlePostActions.delete(id) & this.toogleMoreMenu()}
okText="Yes"
cancelText="No"
>
<Icons.DeleteOutlined /> Remove post
</antd.Popconfirm>
</antd.Menu.Item> </antd.Menu.Item>
) : null} ) : null}
{ycore.IsThisPost.owner(publisher.id) ? ( {ycore.IsThisPost.owner(publisher.id) ? (
ycore.IsThisUser.pro(publisher.id) ? ( ycore.IsThisUser.pro(publisher.id) ? (
<antd.Menu.Item <antd.Menu.Item
onClick={() => handlePostActions.boost(id)} onClick={() => handlePostActions.boost(id) & this.toogleMoreMenu()}
key="boost_post" key="boost_post"
> >
<Icons.RocketOutlined />{' '} <Icons.RocketOutlined />{' '}
@ -174,7 +154,7 @@ class PostCard extends React.PureComponent {
) : null} ) : null}
{ycore.IsThisPost.owner(publisher.id) ? <hr /> : null} {ycore.IsThisPost.owner(publisher.id) ? <hr /> : null}
<antd.Menu.Item <antd.Menu.Item
onClick={() => handlePostActions.save(id)} onClick={() => handlePostActions.save(id) & this.toogleMoreMenu()}
key="save_post" key="save_post"
> >
<Icons.SaveOutlined />{' '} <Icons.SaveOutlined />{' '}
@ -182,7 +162,7 @@ class PostCard extends React.PureComponent {
</antd.Menu.Item> </antd.Menu.Item>
{this.state.postReported? null: {this.state.postReported? null:
<antd.Menu.Item <antd.Menu.Item
onClick={() => handlePostActions.report(id)} onClick={() => handlePostActions.report(id) & this.toogleMoreMenu() }
key="report_post" key="report_post"
> >
<Icons.FlagOutlined /> Report post <Icons.FlagOutlined /> Report post
@ -256,7 +236,7 @@ class PostCard extends React.PureComponent {
</h4> </h4>
<div className={styles.PostTags}> <div className={styles.PostTags}>
<div className={styles.MoreMenu}> <div className={styles.MoreMenu}>
<antd.Dropdown overlay={MoreMenu} trigger={['click']}> <antd.Dropdown onVisibleChange={this.handleVisibleChange} visible={this.state.visibleMoreMenu} overlay={MoreMenu} trigger={['click']}>
<Icons.MoreOutlined key="actionMenu" /> <Icons.MoreOutlined key="actionMenu" />
</antd.Dropdown> </antd.Dropdown>
</div> </div>
@ -277,7 +257,7 @@ class PostCard extends React.PureComponent {
) : null} ) : null}
{postFile ? ( {postFile ? (
<div className={styles.post_card_file}> <div className={styles.post_card_file}>
{this.renderPostPlayer(postFile)} <MediaPlayer file={postFile} />
</div> </div>
) : null} ) : null}
<div className={styles.ellipsisIcon}> <div className={styles.ellipsisIcon}>

View File

@ -207,6 +207,10 @@
overflow: hidden; overflow: hidden;
} }
audio {
width: 100%;
}
h3 { h3 {
color: rgb(85, 85, 85); color: rgb(85, 85, 85);
font-weight: 470; font-weight: 470;

View File

@ -9,6 +9,8 @@ import * as MICONS from '@material-ui/icons'
import Post_options from './local_components/post_options' import Post_options from './local_components/post_options'
import { optionBox } from './local_components/post_options' import { optionBox } from './local_components/post_options'
import io from 'socket.io-client'
var socket = io('http://localhost:5500');
function getBase64(img, callback) { function getBase64(img, callback) {
const reader = new FileReader() const reader = new FileReader()
@ -18,12 +20,12 @@ function getBase64(img, callback) {
export function HandleVisibility() { export function HandleVisibility() {
window.PostCreatorComponent.ToogleVisibility() window.PostCreatorComponent.ToogleVisibility()
return
} }
class PostCreator extends React.PureComponent { class PostCreator extends React.PureComponent {
constructor(props) { constructor(props) {
super(props), (window.PostCreatorComponent = this) super(props),
window.PostCreatorComponent = this,
this.state = { this.state = {
visible: true, visible: true,
FadeIN: true, FadeIN: true,
@ -180,11 +182,13 @@ class PostCreator extends React.PureComponent {
ycore.notify.error(err) ycore.notify.error(err)
return false return false
} }
const status_temp_error = JSON.parse(res)['data'].error
status_temp_error? ycore.notify.error('It seems that a processing error has occurred, your publication has not been published.') : null
const id_temp_parse = JSON.parse(res)['data'].id const id_temp_parse = JSON.parse(res)['data'].id
const pro_boost_val = ycore.ReturnValueFromMap({ data: post_options, key: 'pro_boost' }) const pro_boost_val = ycore.ReturnValueFromMap({ data: post_options, key: 'pro_boost' })
const allow_comments_val = ycore.ReturnValueFromMap({ data: post_options, key: 'allow_comments' }) const allow_comments_val = ycore.ReturnValueFromMap({ data: post_options, key: 'allow_comments' })
socket.emit('push_post');
ycore.yconsole.log(`pro_boost => ${pro_boost_val} | allow_comments => ${allow_comments_val}`) ycore.yconsole.log(`pro_boost => ${pro_boost_val} | allow_comments => ${allow_comments_val}`)
if (pro_boost_val) { if (pro_boost_val) {
@ -239,8 +243,8 @@ class PostCreator extends React.PureComponent {
ycore.yconsole.log('Item: ' + item.type) ycore.yconsole.log('Item: ' + item.type)
if (item.type.indexOf('image') != -1) { if (item.type.indexOf('image') != -1) {
//item. //item.
let a = item.getAsFile() let a;
a a = item.getAsFile()
_this.setState({ file: a }) _this.setState({ file: a })
ycore.ReadFileAsB64(a, res => { ycore.ReadFileAsB64(a, res => {
_this.setState({ fileURL: res }) _this.setState({ fileURL: res })

View File

@ -18,7 +18,8 @@ export const optionBox = {
export default class Post_options extends React.Component { export default class Post_options extends React.Component {
constructor(props) { constructor(props) {
super(props), (window.postoptions_box_class = this) super(props),
window.postoptions_box_class = this,
this.state = { this.state = {
options_repo: Post_Options, options_repo: Post_Options,
options_box: false, options_box: false,
@ -59,7 +60,7 @@ export default class Post_options extends React.Component {
} }
} catch (err) { } catch (err) {
ycore.notify.error(err) ycore.notify.error(err)
return true return false
} }
} }
return false return false

View File

@ -103,67 +103,3 @@
cursor: pointer; cursor: pointer;
} }
} }
.postContent {
word-break: break-all;
display: flex;
border-radius: 3px;
margin: 23px 24px 23px 24px;
h3 {
color: rgb(85, 85, 85);
font-weight: 470;
}
}
.postContentFILE {
display: flex;
margin: 23px 0 5px 0;
max-height: 600px;
overflow: hidden;
img {
width: calc(100% + 30px);
overflow: hidden;
margin: auto;
}
video {
max-height: 600px;
width: calc(100% + 30px);
overflow: hidden;
}
h3 {
color: rgb(85, 85, 85);
font-weight: 470;
}
}
.likebtn {
:global {
svg {
color: rgba(0, 0, 0, 0.45);
}
svg:hover {
color: rgb(233, 35, 68);
transition: all 0.2s linear;
}
}
}
.ellipsisIcon {
color: rgba(0, 0, 0, 0.45);
width: 100%;
position: absolute;
text-align: center;
margin: auto;
font-size: 30px;
transition: opacity 150ms linear;
}
.ellipsisIcon:hover {
opacity: 0;
transition: opacity 150ms linear;
}

View File

@ -8,8 +8,9 @@ import { SetHeaderSearchType } from 'components/HeaderSearch'
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 Follow_btn from './components/Follow_btn.js' import Follow_btn from './components/Follow_btn.js'
import {BadgesType} from 'globals/badges_list'
class UserProfile extends React.Component { class UserProfile extends React.PureComponent {
constructor(props) { constructor(props) {
super(props), super(props),
(this.state = { (this.state = {
@ -18,9 +19,29 @@ class UserProfile extends React.Component {
RenderValue: {}, RenderValue: {},
loading: true, loading: true,
Followed: '', Followed: '',
UserTags: [],
}) })
} }
require(i) {
if (i) {
try {
switch (i) {
case 'pro':
return ycore.booleanFix(this.state.RenderValue.is_pro)
case 'dev':
return ycore.booleanFix(this.state.RenderValue.dev)
case 'nsfw':
return ycore.booleanFix(this.state.RenderValue.nsfw_flag)
}
} catch (err) {
ycore.notify.error(err)
return false
}
}
return false
}
handleFollowUser = () => { handleFollowUser = () => {
const payload = { user_id: this.state.UUID } const payload = { user_id: this.state.UUID }
ycore.comty_user.follow((err, res) => { ycore.comty_user.follow((err, res) => {
@ -33,8 +54,7 @@ class UserProfile extends React.Component {
} }
componentDidMount() { componentDidMount() {
const { regx } = this.props this.initUser(this.props.regx)
this.initUser(regx)
SetHeaderSearchType.disable() SetHeaderSearchType.disable()
} }
@ -64,101 +84,108 @@ class UserProfile extends React.Component {
ycore.router.go(`@${c1}`) ycore.router.go(`@${c1}`)
} }
const payload = { id: rp['0'].user_id }
ycore.comty_user.__tags((err, res) => {
if (err) {
ycore.notify.error(err)
return
}
}, payload)
this.setState({ this.setState({
UUID: rp['0'].user_id, UUID: rp['0'].user_id,
RenderValue: rp['0'], RenderValue: rp['0'],
loading: false, loading: false,
Followed: ycore.booleanFix(rp['0'].is_following), Followed: ycore.booleanFix(rp['0'].is_following),
}) })
ycore.comty_user.__tags((err, res) => {
if (err) return false
let fn = [];
const a = JSON.parse(res)['tags']
const b = Object.entries(Object.assign({}, a[0]))
const objectArray = b.slice(1,b.length)
objectArray.forEach(([key, value]) => {
if (value == 'true') {
BadgesType.map(item => {
item.id === key ? (item? fn.push(item) : null) : null
})
}
})
BadgesType.map(item => {
this.require(item.require)? fn.push(item) : null
})
this.setState({ UserTags: fn })
}, { id: this.state.UUID })
} catch (err) { } catch (err) {
ycore.notify.error(err) ycore.notify.error(err)
} }
}, payload) }, payload)
} }
UserHeader = values => {
return (
<div className={styles.userWrapper}>
<div className={styles.UserCover}>
<img src={values.cover} />
</div>
<PageHeaderWrapper
content={
<div className={styles.pageHeaderContent}>
<div className={styles.avatar}>
<antd.Avatar shape="square" src={values.avatar} />
</div>
<div className={styles.content}>
<div className={styles.TagWrappers}>
{ycore.booleanFix(values.nsfw_flag) ? (
<antd.Tag color="volcano">NSFW</antd.Tag>
) : null}
{ycore.booleanFix(values.is_pro) ? (
<antd.Tag color="purple">
CPRO <Icons.RocketOutlined />
</antd.Tag>
) : null}
{ycore.booleanFix(values.dev) ? (
<antd.Tag color="default">
DEVELOPER <Icons.CodeOutlined />
</antd.Tag>
) : null}
</div>
{ycore.IsThisUser.same(values.id) ? null : (
<div
className={styles.follow_wrapper}
onClick={() => this.handleFollowUser()}
>
<Follow_btn followed={this.state.Followed ? true : false} />
</div>
)}
<div className={styles.contentTitle}>
<h1 style={{ marginBottom: '0px' }}>
{values.username}
<antd.Tooltip title="User Verified">
{ycore.booleanFix(values.verified) ? (
<Icon
style={{ color: 'blue', verticalAlign: 'top' }}
component={CustomIcons.VerifiedBadge}
/>
) : null}
</antd.Tooltip>
</h1>
<span
style={{
fontSize: '14px',
fontWeight: '100',
lineHeight: '0',
marginBottom: '5px',
}}
dangerouslySetInnerHTML={{ __html: values.about }}
/>
</div>
</div>
</div>
}
/>
</div>
)
}
render() { render() {
const { loading, UUID, invalid } = this.state const { loading, UUID, invalid, RenderValue } = this.state
return ( return (
<div> <div>
{loading ? ( {loading ? (
<antd.Skeleton active /> <antd.Skeleton active />
) : ( ) : (
<div> <div>
{invalid ? null : this.UserHeader(this.state.RenderValue)} {invalid ? null :
<div className={styles.userWrapper}>
<div className={styles.UserCover}>
<img src={RenderValue.cover} />
</div>
<PageHeaderWrapper
content={
<div className={styles.pageHeaderContent}>
<div className={styles.avatar}>
<antd.Avatar shape="square" src={RenderValue.avatar} />
</div>
<div className={styles.content}>
<div className={styles.TagWrappers}>
{this.state.UserTags.length>0? <antd.List
dataSource={this.state.UserTags}
renderItem={item=>(
<antd.Tooltip title={item.tip}>
<antd.Tag id={item.id} color={item.color}>
{item.title} {item.icon}
</antd.Tag>
</antd.Tooltip>
)} /> : null}
</div>
{ycore.IsThisUser.same(RenderValue.id) ? null : (
<div
className={styles.follow_wrapper}
onClick={() => this.handleFollowUser()}
>
<Follow_btn followed={this.state.Followed ? true : false} />
</div>
)}
<div className={styles.contentTitle}>
<h1 style={{ marginBottom: '0px' }}>
{RenderValue.username}
<antd.Tooltip title="User Verified">
{ycore.booleanFix(RenderValue.verified) ? (
<Icon
style={{ color: 'blue', verticalAlign: 'top' }}
component={CustomIcons.VerifiedBadge}
/>
) : null}
</antd.Tooltip>
</h1>
<span
style={{
fontSize: '14px',
fontWeight: '100',
lineHeight: '0',
marginBottom: '5px',
}}
dangerouslySetInnerHTML={{ __html: RenderValue.about }}
/>
</div>
</div>
</div>
}
/>
</div>}
{ycore.IsThisUser.same(UUID) ? ( {ycore.IsThisUser.same(UUID) ? (
<PostCreator userData={ycore.userData()} /> <PostCreator userData={ycore.userData()} />
) : null} ) : null}

View File

@ -46,7 +46,7 @@ export default class __m extends React.Component {
handleDesktop() { handleDesktop() {
const a = localStorage.getItem('desktop_src') const a = localStorage.getItem('desktop_src')
let to let to
if (a == 'false') { if ( a == 'false') {
to = true to = true
} else { } else {
to = false to = false
@ -161,6 +161,10 @@ export default class __m extends React.Component {
<antd.Button onClick={() => ycore.app_modals.report_post()}> <antd.Button onClick={() => ycore.app_modals.report_post()}>
Open report_post modal Open report_post modal
</antd.Button> </antd.Button>
<antd.Button onClick={() => ycore.sync.emmitPost()}>
Emmit Post feed
</antd.Button>
</div> </div>
<div className={styles.titleHeader}> <div className={styles.titleHeader}>

View File

@ -39,6 +39,7 @@
// Global Documents // Global Documents
body { body {
scroll-behavior: smooth;
height: 100%; height: 100%;
overflow-y: hidden; overflow-y: hidden;
background-color: transparent; // rgb(249, 249, 249); background-color: transparent; // rgb(249, 249, 249);