mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
0.2.31a1
This commit is contained in:
parent
087cc9592e
commit
93c90e4c88
@ -14,6 +14,7 @@ function SettingStoragedValue(e){
|
||||
const fromStorage = JSON.parse(localStorage.getItem('app_settings'))
|
||||
|
||||
export var AppSettings = {
|
||||
__global_server_prexif: 'https://api.ragestudio.net/RSA-COMTY/r/',
|
||||
// Global Behaviors
|
||||
InfiniteLoading: false,
|
||||
InfiniteLogin: false,
|
||||
|
@ -1,8 +1,45 @@
|
||||
import * as Icons from '@ant-design/icons'
|
||||
|
||||
|
||||
export var BadgesType = [
|
||||
{
|
||||
id: 'alpha_test',
|
||||
title: 'Alpha Tester',
|
||||
color: 'volcano',
|
||||
tip: 'Oh yeah!',
|
||||
color: 'green',
|
||||
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....',
|
||||
}
|
||||
]
|
||||
|
@ -21,7 +21,7 @@
|
||||
"@lingui/react": "^2.9.1",
|
||||
"@material-ui/core": "^4.9.3",
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"antd": "^4.0.4",
|
||||
"antd": "^4.1.0",
|
||||
"axios": "^0.19.2",
|
||||
"bag.js": "0.0.2",
|
||||
"classnames": "^2.2.6",
|
||||
@ -40,6 +40,7 @@
|
||||
"nprogress": "^0.2.0",
|
||||
"os-utils": "0.0.14",
|
||||
"path-to-regexp": "^6.1.0",
|
||||
"plyr-react": "^2.2.0",
|
||||
"prop-types": "^15.7.2",
|
||||
"radium": "^0.26.0",
|
||||
"react-animations": "^1.0.0",
|
||||
@ -50,6 +51,7 @@
|
||||
"react-select-country-list": "^2.1.2",
|
||||
"react-sound": "^1.2.0",
|
||||
"react-virtualized": "^9.21.2",
|
||||
"socket.io-client": "^2.3.0",
|
||||
"store": "^2.0.12",
|
||||
"timeago.js": "^4.0.2",
|
||||
"ts-cookies": "^1.0.0",
|
||||
|
@ -1,5 +1,6 @@
|
||||
// List of modules used for this app
|
||||
export * from './libs/comty_ng/pre.js';
|
||||
export * from './libs/ycore_sync/pre.js';
|
||||
export * from './libs/yulio_id/pre.js';
|
||||
export * from './libs/ycore_styles/pre.js';
|
||||
export * from './libs/ycore_sdcp/pre.js';
|
||||
|
@ -1,4 +1,5 @@
|
||||
import { API_Call, endpoints } from 'ycore'
|
||||
import { comty_rsa } from '../rs_cloud/pre'
|
||||
|
||||
export const comty_user = {
|
||||
setData: () => {},
|
||||
@ -20,8 +21,20 @@ export const comty_user = {
|
||||
)
|
||||
},
|
||||
block: (callback, payload) => {
|
||||
// TO DO
|
||||
if (!payload) {
|
||||
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) => {
|
||||
if (!payload) {
|
||||
|
@ -89,3 +89,13 @@ export const __rscloud = {
|
||||
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=` : ``}`
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ export const cryptSDCP = {
|
||||
return false
|
||||
},
|
||||
valid: () => {
|
||||
const a = ycore.asyncSDCP.get()
|
||||
const a = ycore.sdcp.get()
|
||||
return a ? true : false
|
||||
},
|
||||
}
|
||||
|
10
src/@ycore/libs/ycore_sync/pre.js
Normal file
10
src/@ycore/libs/ycore_sync/pre.js
Normal 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');
|
||||
}
|
||||
}
|
@ -18,16 +18,16 @@ export const make_data = {
|
||||
|
||||
export const IsThisUser = {
|
||||
admin: () => {
|
||||
const a = ycore.userData()
|
||||
return ycore.booleanFix(a.admin) ? true : false
|
||||
return ycore.booleanFix(ycore.userData().admin) ? true : false
|
||||
},
|
||||
dev: () => {
|
||||
const a = ycore.userData()
|
||||
return ycore.booleanFix(a.dev) ? true : false
|
||||
return ycore.booleanFix(ycore.userData().dev) ? true : false
|
||||
},
|
||||
pro: () => {
|
||||
const a = ycore.userData()
|
||||
return ycore.booleanFix(a.is_pro) ? true : false
|
||||
return ycore.booleanFix(ycore.userData().is_pro) ? true : false
|
||||
},
|
||||
nsfw: () => {
|
||||
return ycore.booleanFix(ycore.userData().nsfw) ? true : false
|
||||
},
|
||||
same: a => {
|
||||
if (a == ycore.userData().UserID) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
*/
|
||||
|
||||
import * as Endpoints from 'globals/endpoints/index.js'
|
||||
import io from 'socket.io-client'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import localforage from 'localforage'
|
||||
import { format } from 'timeago.js'
|
||||
@ -41,6 +42,12 @@ localforage.config({
|
||||
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.
|
||||
*
|
||||
|
@ -6,7 +6,6 @@ import styles from './index.less'
|
||||
import classnames from 'classnames'
|
||||
|
||||
import { __priPost, __secComments, __priSearch, __trendings, __pro } from './renders.js'
|
||||
import { FormatListNumbered } from '@material-ui/icons'
|
||||
|
||||
export const SwapMode = {
|
||||
close: () => {
|
||||
@ -37,7 +36,8 @@ export const SwapMode = {
|
||||
|
||||
export default class Secondary extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props), (window.SecondaryLayoutComponent = this)
|
||||
super(props),
|
||||
window.SecondaryLayoutComponent = this,
|
||||
this.state = {
|
||||
loading: true,
|
||||
half: false,
|
||||
|
@ -6,12 +6,12 @@ import classnames from 'classnames'
|
||||
class Like_button extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props),
|
||||
(this.state = {
|
||||
this.state = {
|
||||
liked: this.props.liked,
|
||||
likes: this.props.count,
|
||||
type: this.props.liked ? 'dislike' : 'like',
|
||||
clicked: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
SumLike() {
|
||||
|
@ -2,6 +2,7 @@ import React from 'react'
|
||||
import * as antd from 'antd'
|
||||
import * as ycore from 'ycore'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import styles from './index.less'
|
||||
|
||||
import { PostCard } from 'components'
|
||||
|
||||
@ -176,7 +177,7 @@ class MainFeed extends React.Component {
|
||||
render() {
|
||||
const { loading, invalid } = this.state
|
||||
return (
|
||||
<div id="mainfeed">
|
||||
<div className={styles.main_feed_wrapper} id="mainfeed">
|
||||
{invalid ? (
|
||||
<antd.Card
|
||||
style={{
|
||||
|
4
src/components/MainFeed/index.less
Normal file
4
src/components/MainFeed/index.less
Normal file
@ -0,0 +1,4 @@
|
||||
.main_feed_wrapper{
|
||||
scroll-behavior: smooth;
|
||||
|
||||
}
|
@ -1,46 +1,53 @@
|
||||
import React from 'react'
|
||||
import styles from './index.less'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
|
||||
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() {
|
||||
const { file } = this.props
|
||||
let type;
|
||||
|
||||
const ImageExtensions = ['.png', '.jpg', '.jpeg', '.gif']
|
||||
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 (
|
||||
<div className={styles.PlayerContainer}>
|
||||
{this.renderPostPlayer(file)}
|
||||
</div>
|
||||
<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
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,9 @@
|
||||
margin-top: -250px;
|
||||
margin-left: -350px;
|
||||
}
|
||||
|
||||
audio{
|
||||
width: 100%;
|
||||
}
|
||||
video {
|
||||
object-fit: contain;
|
||||
position: absolute;
|
||||
@ -24,8 +26,4 @@
|
||||
margin-left: -350px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: rgb(85, 85, 85);
|
||||
font-weight: 470;
|
||||
}
|
||||
}
|
||||
|
134
src/components/MediaPlayer/plyr.js
Normal file
134
src/components/MediaPlayer/plyr.js
Normal 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;
|
@ -1,7 +1,7 @@
|
||||
import React from 'react'
|
||||
import * as antd from 'antd'
|
||||
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 Icons from '@ant-design/icons'
|
||||
import Icon from '@ant-design/icons'
|
||||
@ -21,48 +21,21 @@ const emptyPayload = {
|
||||
class PostCard extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props),
|
||||
(this.state = {
|
||||
FadeIN: true,
|
||||
this.state = {
|
||||
visibleMoreMenu: false,
|
||||
postPinned: this.props.payload.is_post_pinned,
|
||||
postSaved: this.props.payload.is_post_saved,
|
||||
postReported: this.props.payload.is_post_reported,
|
||||
postBoosted: this.props.payload.is_post_boosted,
|
||||
ReportIgnore: false,
|
||||
})
|
||||
}
|
||||
}
|
||||
handleVisibleChange = flag => {
|
||||
this.setState({ visibleMoreMenu: flag });
|
||||
};
|
||||
|
||||
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} />
|
||||
}
|
||||
toogleMoreMenu(){
|
||||
this.setState({visibleMoreMenu: !this.state.visibleMoreMenu})
|
||||
}
|
||||
|
||||
goToPost(postID) {
|
||||
@ -152,19 +125,26 @@ class PostCard extends React.PureComponent {
|
||||
const actions = customActions || defaultActions
|
||||
|
||||
const MoreMenu = (
|
||||
<antd.Menu>
|
||||
<antd.Menu >
|
||||
{ycore.IsThisPost.owner(publisher.id) ? (
|
||||
<antd.Menu.Item
|
||||
onClick={() => handlePostActions.delete(id)}
|
||||
key="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>
|
||||
) : null}
|
||||
{ycore.IsThisPost.owner(publisher.id) ? (
|
||||
ycore.IsThisUser.pro(publisher.id) ? (
|
||||
<antd.Menu.Item
|
||||
onClick={() => handlePostActions.boost(id)}
|
||||
onClick={() => handlePostActions.boost(id) & this.toogleMoreMenu()}
|
||||
key="boost_post"
|
||||
>
|
||||
<Icons.RocketOutlined />{' '}
|
||||
@ -174,7 +154,7 @@ class PostCard extends React.PureComponent {
|
||||
) : null}
|
||||
{ycore.IsThisPost.owner(publisher.id) ? <hr /> : null}
|
||||
<antd.Menu.Item
|
||||
onClick={() => handlePostActions.save(id)}
|
||||
onClick={() => handlePostActions.save(id) & this.toogleMoreMenu()}
|
||||
key="save_post"
|
||||
>
|
||||
<Icons.SaveOutlined />{' '}
|
||||
@ -182,7 +162,7 @@ class PostCard extends React.PureComponent {
|
||||
</antd.Menu.Item>
|
||||
{this.state.postReported? null:
|
||||
<antd.Menu.Item
|
||||
onClick={() => handlePostActions.report(id)}
|
||||
onClick={() => handlePostActions.report(id) & this.toogleMoreMenu() }
|
||||
key="report_post"
|
||||
>
|
||||
<Icons.FlagOutlined /> Report post
|
||||
@ -256,7 +236,7 @@ class PostCard extends React.PureComponent {
|
||||
</h4>
|
||||
<div className={styles.PostTags}>
|
||||
<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" />
|
||||
</antd.Dropdown>
|
||||
</div>
|
||||
@ -277,7 +257,7 @@ class PostCard extends React.PureComponent {
|
||||
) : null}
|
||||
{postFile ? (
|
||||
<div className={styles.post_card_file}>
|
||||
{this.renderPostPlayer(postFile)}
|
||||
<MediaPlayer file={postFile} />
|
||||
</div>
|
||||
) : null}
|
||||
<div className={styles.ellipsisIcon}>
|
||||
|
@ -207,6 +207,10 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
audio {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
h3 {
|
||||
color: rgb(85, 85, 85);
|
||||
font-weight: 470;
|
||||
|
@ -9,6 +9,8 @@ import * as MICONS from '@material-ui/icons'
|
||||
|
||||
import Post_options 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) {
|
||||
const reader = new FileReader()
|
||||
@ -18,12 +20,12 @@ function getBase64(img, callback) {
|
||||
|
||||
export function HandleVisibility() {
|
||||
window.PostCreatorComponent.ToogleVisibility()
|
||||
return
|
||||
}
|
||||
|
||||
class PostCreator extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props), (window.PostCreatorComponent = this)
|
||||
super(props),
|
||||
window.PostCreatorComponent = this,
|
||||
this.state = {
|
||||
visible: true,
|
||||
FadeIN: true,
|
||||
@ -180,11 +182,13 @@ class PostCreator extends React.PureComponent {
|
||||
ycore.notify.error(err)
|
||||
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 pro_boost_val = ycore.ReturnValueFromMap({ data: post_options, key: 'pro_boost' })
|
||||
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}`)
|
||||
|
||||
if (pro_boost_val) {
|
||||
@ -239,8 +243,8 @@ class PostCreator extends React.PureComponent {
|
||||
ycore.yconsole.log('Item: ' + item.type)
|
||||
if (item.type.indexOf('image') != -1) {
|
||||
//item.
|
||||
let a = item.getAsFile()
|
||||
a
|
||||
let a;
|
||||
a = item.getAsFile()
|
||||
_this.setState({ file: a })
|
||||
ycore.ReadFileAsB64(a, res => {
|
||||
_this.setState({ fileURL: res })
|
||||
|
@ -18,7 +18,8 @@ export const optionBox = {
|
||||
|
||||
export default class Post_options extends React.Component {
|
||||
constructor(props) {
|
||||
super(props), (window.postoptions_box_class = this)
|
||||
super(props),
|
||||
window.postoptions_box_class = this,
|
||||
this.state = {
|
||||
options_repo: Post_Options,
|
||||
options_box: false,
|
||||
@ -59,7 +60,7 @@ export default class Post_options extends React.Component {
|
||||
}
|
||||
} catch (err) {
|
||||
ycore.notify.error(err)
|
||||
return true
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
@ -103,67 +103,3 @@
|
||||
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;
|
||||
}
|
@ -8,8 +8,9 @@ import { SetHeaderSearchType } from 'components/HeaderSearch'
|
||||
import * as Icons from '@ant-design/icons'
|
||||
import Icon from '@ant-design/icons'
|
||||
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) {
|
||||
super(props),
|
||||
(this.state = {
|
||||
@ -18,9 +19,29 @@ class UserProfile extends React.Component {
|
||||
RenderValue: {},
|
||||
loading: true,
|
||||
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 = () => {
|
||||
const payload = { user_id: this.state.UUID }
|
||||
ycore.comty_user.follow((err, res) => {
|
||||
@ -33,8 +54,7 @@ class UserProfile extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
const { regx } = this.props
|
||||
this.initUser(regx)
|
||||
this.initUser(this.props.regx)
|
||||
SetHeaderSearchType.disable()
|
||||
}
|
||||
|
||||
@ -64,56 +84,74 @@ class UserProfile extends React.Component {
|
||||
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({
|
||||
UUID: rp['0'].user_id,
|
||||
RenderValue: rp['0'],
|
||||
loading: false,
|
||||
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) {
|
||||
ycore.notify.error(err)
|
||||
}
|
||||
}, payload)
|
||||
}
|
||||
|
||||
UserHeader = values => {
|
||||
|
||||
|
||||
render() {
|
||||
const { loading, UUID, invalid, RenderValue } = this.state
|
||||
return (
|
||||
<div>
|
||||
{loading ? (
|
||||
<antd.Skeleton active />
|
||||
) : (
|
||||
<div>
|
||||
{invalid ? null :
|
||||
<div className={styles.userWrapper}>
|
||||
<div className={styles.UserCover}>
|
||||
<img src={values.cover} />
|
||||
<img src={RenderValue.cover} />
|
||||
</div>
|
||||
|
||||
<PageHeaderWrapper
|
||||
content={
|
||||
<div className={styles.pageHeaderContent}>
|
||||
<div className={styles.avatar}>
|
||||
<antd.Avatar shape="square" src={values.avatar} />
|
||||
<antd.Avatar shape="square" src={RenderValue.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 />
|
||||
{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>
|
||||
) : null}
|
||||
{ycore.booleanFix(values.dev) ? (
|
||||
<antd.Tag color="default">
|
||||
DEVELOPER <Icons.CodeOutlined />
|
||||
</antd.Tag>
|
||||
) : null}
|
||||
</antd.Tooltip>
|
||||
)} /> : null}
|
||||
</div>
|
||||
{ycore.IsThisUser.same(values.id) ? null : (
|
||||
{ycore.IsThisUser.same(RenderValue.id) ? null : (
|
||||
<div
|
||||
className={styles.follow_wrapper}
|
||||
onClick={() => this.handleFollowUser()}
|
||||
@ -123,9 +161,9 @@ class UserProfile extends React.Component {
|
||||
)}
|
||||
<div className={styles.contentTitle}>
|
||||
<h1 style={{ marginBottom: '0px' }}>
|
||||
{values.username}
|
||||
{RenderValue.username}
|
||||
<antd.Tooltip title="User Verified">
|
||||
{ycore.booleanFix(values.verified) ? (
|
||||
{ycore.booleanFix(RenderValue.verified) ? (
|
||||
<Icon
|
||||
style={{ color: 'blue', verticalAlign: 'top' }}
|
||||
component={CustomIcons.VerifiedBadge}
|
||||
@ -140,25 +178,14 @@ class UserProfile extends React.Component {
|
||||
lineHeight: '0',
|
||||
marginBottom: '5px',
|
||||
}}
|
||||
dangerouslySetInnerHTML={{ __html: values.about }}
|
||||
dangerouslySetInnerHTML={{ __html: RenderValue.about }}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
render() {
|
||||
const { loading, UUID, invalid } = this.state
|
||||
return (
|
||||
<div>
|
||||
{loading ? (
|
||||
<antd.Skeleton active />
|
||||
) : (
|
||||
<div>
|
||||
{invalid ? null : this.UserHeader(this.state.RenderValue)}
|
||||
</div>}
|
||||
{ycore.IsThisUser.same(UUID) ? (
|
||||
<PostCreator userData={ycore.userData()} />
|
||||
) : null}
|
||||
|
@ -46,7 +46,7 @@ export default class __m extends React.Component {
|
||||
handleDesktop() {
|
||||
const a = localStorage.getItem('desktop_src')
|
||||
let to
|
||||
if (a == 'false') {
|
||||
if ( a == 'false') {
|
||||
to = true
|
||||
} else {
|
||||
to = false
|
||||
@ -161,6 +161,10 @@ export default class __m extends React.Component {
|
||||
<antd.Button onClick={() => ycore.app_modals.report_post()}>
|
||||
Open report_post modal
|
||||
</antd.Button>
|
||||
|
||||
<antd.Button onClick={() => ycore.sync.emmitPost()}>
|
||||
Emmit Post feed
|
||||
</antd.Button>
|
||||
</div>
|
||||
|
||||
<div className={styles.titleHeader}>
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
// Global Documents
|
||||
body {
|
||||
scroll-behavior: smooth;
|
||||
height: 100%;
|
||||
overflow-y: hidden;
|
||||
background-color: transparent; // rgb(249, 249, 249);
|
||||
|
Loading…
x
Reference in New Issue
Block a user