From 93c90e4c88ecde0aca0b97014e58dc32caa8d842 Mon Sep 17 00:00:00 2001 From: srgooglo <38926803+srgooglo@users.noreply.github.com> Date: Tue, 31 Mar 2020 03:58:43 +0200 Subject: [PATCH] 0.2.31a1 --- config/app.settings.js | 1 + globals/badges_list.js | 41 +++- package.json | 4 +- src/@ycore/libs.js | 1 + src/@ycore/libs/comty_ng/comty_user.js | 17 +- src/@ycore/libs/rs_cloud/pre.js | 10 + src/@ycore/libs/ycore_sdcp/pre.js | 2 +- src/@ycore/libs/ycore_sync/pre.js | 10 + src/@ycore/libs/yulio_id/pre.js | 12 +- src/@ycore/ycore_worker.js | 7 + src/components/Layout/Secondary/index.js | 4 +- src/components/Like_button/index.js | 12 +- src/components/MainFeed/index.js | 3 +- src/components/MainFeed/index.less | 4 + src/components/MediaPlayer/index.js | 85 ++++---- src/components/MediaPlayer/index.less | 10 +- src/components/MediaPlayer/plyr.js | 134 +++++++++++++ src/components/PostCard/index.js | 82 +++----- src/components/PostCard/index.less | 4 + src/components/PostCreator/index.js | 14 +- .../local_components/post_options.js | 5 +- src/components/SearchCard/index.less | 64 ------ src/components/UserProfile/index.js | 183 ++++++++++-------- src/pages/__m/index.js | 6 +- src/themes/base/index.less | 1 + 25 files changed, 449 insertions(+), 267 deletions(-) create mode 100644 src/@ycore/libs/ycore_sync/pre.js create mode 100644 src/components/MainFeed/index.less create mode 100644 src/components/MediaPlayer/plyr.js diff --git a/config/app.settings.js b/config/app.settings.js index 5d6704c0..baafa2a0 100755 --- a/config/app.settings.js +++ b/config/app.settings.js @@ -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, diff --git a/globals/badges_list.js b/globals/badges_list.js index e09ca0e8..d39f752a 100755 --- a/globals/badges_list.js +++ b/globals/badges_list.js @@ -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: (), + tip: 'Oh yeah!' }, + { + id: 'nsfw_flag', + title: 'NSFW', + color: 'volcano', + require: 'nsfw_flag', + icon: (), + tip: 'NSFW', + }, + { + id: 'pro', + title: 'CPRO™', + color: 'purple', + require: 'pro', + icon: (), + tip: 'CPRO™', + }, + { + id: 'dev', + title: 'DEVELOPER', + color: 'default', + require: 'dev', + icon: (), + tip: 'DEVELOPER', + }, + { + id: 'professional_retarder', + title: 'Professional Retarder', + color: 'gold', + require: '', + icon: (), + tip: 'hump....', + } ] diff --git a/package.json b/package.json index 0d4e91bd..aa525168 100755 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/@ycore/libs.js b/src/@ycore/libs.js index 590c25a2..d405bf00 100755 --- a/src/@ycore/libs.js +++ b/src/@ycore/libs.js @@ -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'; diff --git a/src/@ycore/libs/comty_ng/comty_user.js b/src/@ycore/libs/comty_ng/comty_user.js index fdc6a7f4..ac374d98 100644 --- a/src/@ycore/libs/comty_ng/comty_user.js +++ b/src/@ycore/libs/comty_ng/comty_user.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 - return false + 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) { diff --git a/src/@ycore/libs/rs_cloud/pre.js b/src/@ycore/libs/rs_cloud/pre.js index 6a5686b7..f180f1c7 100644 --- a/src/@ycore/libs/rs_cloud/pre.js +++ b/src/@ycore/libs/rs_cloud/pre.js @@ -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=` : ``}` + } +} diff --git a/src/@ycore/libs/ycore_sdcp/pre.js b/src/@ycore/libs/ycore_sdcp/pre.js index 766751f7..54191b4a 100755 --- a/src/@ycore/libs/ycore_sdcp/pre.js +++ b/src/@ycore/libs/ycore_sdcp/pre.js @@ -61,7 +61,7 @@ export const cryptSDCP = { return false }, valid: () => { - const a = ycore.asyncSDCP.get() + const a = ycore.sdcp.get() return a ? true : false }, } diff --git a/src/@ycore/libs/ycore_sync/pre.js b/src/@ycore/libs/ycore_sync/pre.js new file mode 100644 index 00000000..54efb3ab --- /dev/null +++ b/src/@ycore/libs/ycore_sync/pre.js @@ -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'); + } +} \ No newline at end of file diff --git a/src/@ycore/libs/yulio_id/pre.js b/src/@ycore/libs/yulio_id/pre.js index 66082f56..6abdddb7 100755 --- a/src/@ycore/libs/yulio_id/pre.js +++ b/src/@ycore/libs/yulio_id/pre.js @@ -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) { diff --git a/src/@ycore/ycore_worker.js b/src/@ycore/ycore_worker.js index 9939e8e8..1a2741d8 100755 --- a/src/@ycore/ycore_worker.js +++ b/src/@ycore/ycore_worker.js @@ -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. * diff --git a/src/components/Layout/Secondary/index.js b/src/components/Layout/Secondary/index.js index 16b10ee3..762cc0f6 100644 --- a/src/components/Layout/Secondary/index.js +++ b/src/components/Layout/Secondary/index.js @@ -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, diff --git a/src/components/Like_button/index.js b/src/components/Like_button/index.js index ac3e5ac2..018b53c8 100644 --- a/src/components/Like_button/index.js +++ b/src/components/Like_button/index.js @@ -6,12 +6,12 @@ import classnames from 'classnames' class Like_button extends React.PureComponent { constructor(props) { super(props), - (this.state = { - liked: this.props.liked, - likes: this.props.count, - type: this.props.liked ? 'dislike' : 'like', - clicked: false, - }) + this.state = { + liked: this.props.liked, + likes: this.props.count, + type: this.props.liked ? 'dislike' : 'like', + clicked: false, + } } SumLike() { diff --git a/src/components/MainFeed/index.js b/src/components/MainFeed/index.js index fed6a8f1..089ac83b 100755 --- a/src/components/MainFeed/index.js +++ b/src/components/MainFeed/index.js @@ -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 ( -
+
{invalid ? ( - - - ) - } - if (ident.includes('.webm')) { - return ( - - ) - } - if (ident.includes('.mp3')) { - return ( - - ) - } - if (ident.includes('.ogg')) { - return ( - - ) - } else { - return - } - } render() { const { file } = this.props - return ( -
- {this.renderPostPlayer(file)} -
- ) + 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 ( + // + // ) + return ( + + ) + } + if (type == 'audio') { + return ( + + ) + } + if (type == 'image') { + if (file.includes('gif')) { + return
+ } + return + } + return null } } diff --git a/src/components/MediaPlayer/index.less b/src/components/MediaPlayer/index.less index c4b59fd5..c7f53f82 100644 --- a/src/components/MediaPlayer/index.less +++ b/src/components/MediaPlayer/index.less @@ -12,7 +12,9 @@ margin-top: -250px; margin-left: -350px; } - + audio{ + width: 100%; + } video { object-fit: contain; position: absolute; @@ -23,9 +25,5 @@ margin-top: -250px; margin-left: -350px; } - - h3 { - color: rgb(85, 85, 85); - font-weight: 470; - } + } diff --git a/src/components/MediaPlayer/plyr.js b/src/components/MediaPlayer/plyr.js new file mode 100644 index 00000000..6a65adfa --- /dev/null +++ b/src/components/MediaPlayer/plyr.js @@ -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; \ No newline at end of file diff --git a/src/components/PostCard/index.js b/src/components/PostCard/index.js index ec2f948c..ce1428a4 100755 --- a/src/components/PostCard/index.js +++ b/src/components/PostCard/index.js @@ -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, - 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, - }) - } + 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 ( - - ) - } - if (ident.includes('.webm')) { - return ( - - ) - } - if (ident.includes('.mp3')) { - return ( - - ) - } - if (ident.includes('.ogg')) { - return ( - - ) - } else { - return - } + toogleMoreMenu(){ + this.setState({visibleMoreMenu: !this.state.visibleMoreMenu}) } goToPost(postID) { @@ -152,19 +125,26 @@ class PostCard extends React.PureComponent { const actions = customActions || defaultActions const MoreMenu = ( - + {ycore.IsThisPost.owner(publisher.id) ? ( handlePostActions.delete(id)} key="remove_post" - > - Remove post + > + handlePostActions.delete(id) & this.toogleMoreMenu()} + okText="Yes" + cancelText="No" + > + Remove post + + ) : null} {ycore.IsThisPost.owner(publisher.id) ? ( ycore.IsThisUser.pro(publisher.id) ? ( handlePostActions.boost(id)} + onClick={() => handlePostActions.boost(id) & this.toogleMoreMenu()} key="boost_post" > {' '} @@ -174,7 +154,7 @@ class PostCard extends React.PureComponent { ) : null} {ycore.IsThisPost.owner(publisher.id) ?
: null} handlePostActions.save(id)} + onClick={() => handlePostActions.save(id) & this.toogleMoreMenu()} key="save_post" > {' '} @@ -182,7 +162,7 @@ class PostCard extends React.PureComponent { {this.state.postReported? null: handlePostActions.report(id)} + onClick={() => handlePostActions.report(id) & this.toogleMoreMenu() } key="report_post" > Report post @@ -256,7 +236,7 @@ class PostCard extends React.PureComponent {
- +
@@ -277,7 +257,7 @@ class PostCard extends React.PureComponent { ) : null} {postFile ? (
- {this.renderPostPlayer(postFile)} +
) : null}
diff --git a/src/components/PostCard/index.less b/src/components/PostCard/index.less index 8912f447..38189c85 100755 --- a/src/components/PostCard/index.less +++ b/src/components/PostCard/index.less @@ -207,6 +207,10 @@ overflow: hidden; } + audio { + width: 100%; + } + h3 { color: rgb(85, 85, 85); font-weight: 470; diff --git a/src/components/PostCreator/index.js b/src/components/PostCreator/index.js index 10d68fb3..eda4ac97 100755 --- a/src/components/PostCreator/index.js +++ b/src/components/PostCreator/index.js @@ -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 }) diff --git a/src/components/PostCreator/local_components/post_options.js b/src/components/PostCreator/local_components/post_options.js index b9fff21d..6064139f 100755 --- a/src/components/PostCreator/local_components/post_options.js +++ b/src/components/PostCreator/local_components/post_options.js @@ -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 diff --git a/src/components/SearchCard/index.less b/src/components/SearchCard/index.less index d7651039..2c73e901 100755 --- a/src/components/SearchCard/index.less +++ b/src/components/SearchCard/index.less @@ -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; -} \ No newline at end of file diff --git a/src/components/UserProfile/index.js b/src/components/UserProfile/index.js index fde62cd8..8ebb95cd 100755 --- a/src/components/UserProfile/index.js +++ b/src/components/UserProfile/index.js @@ -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,101 +84,108 @@ 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 => { - return ( -
-
- -
+ - -
- -
-
-
- {ycore.booleanFix(values.nsfw_flag) ? ( - NSFW - ) : null} - {ycore.booleanFix(values.is_pro) ? ( - - CPRO™ - - ) : null} - {ycore.booleanFix(values.dev) ? ( - - DEVELOPER - - ) : null} -
- {ycore.IsThisUser.same(values.id) ? null : ( -
this.handleFollowUser()} - > - -
- )} -
-

- {values.username} - - {ycore.booleanFix(values.verified) ? ( - - ) : null} - -

- -
-
-
- } - /> -
- ) - } render() { - const { loading, UUID, invalid } = this.state + const { loading, UUID, invalid, RenderValue } = this.state return (
{loading ? ( ) : (
- {invalid ? null : this.UserHeader(this.state.RenderValue)} + {invalid ? null : +
+
+ +
+ + +
+ +
+
+
+ {this.state.UserTags.length>0? ( + + + {item.title} {item.icon} + + + )} /> : null} +
+ {ycore.IsThisUser.same(RenderValue.id) ? null : ( +
this.handleFollowUser()} + > + +
+ )} +
+

+ {RenderValue.username} + + {ycore.booleanFix(RenderValue.verified) ? ( + + ) : null} + +

+ +
+
+
+ } + /> +
} {ycore.IsThisUser.same(UUID) ? ( ) : null} diff --git a/src/pages/__m/index.js b/src/pages/__m/index.js index c84bed67..a8bd4faf 100755 --- a/src/pages/__m/index.js +++ b/src/pages/__m/index.js @@ -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 { ycore.app_modals.report_post()}> Open report_post modal + + ycore.sync.emmitPost()}> + Emmit Post feed +
diff --git a/src/themes/base/index.less b/src/themes/base/index.less index 9ecda9e2..4df1ea4e 100644 --- a/src/themes/base/index.less +++ b/src/themes/base/index.less @@ -39,6 +39,7 @@ // Global Documents body { + scroll-behavior: smooth; height: 100%; overflow-y: hidden; background-color: transparent; // rgb(249, 249, 249);