Skip to content

Commit

Permalink
vBeta8.6.9
Browse files Browse the repository at this point in the history
  • Loading branch information
hrichiksite committed May 7, 2022
1 parent 1ddacd6 commit b39c10b
Show file tree
Hide file tree
Showing 31 changed files with 7,773 additions and 13,067 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Dogegram Backend

## Current Release - vBeta8.4.2 (Patch)
## Current Release - vBeta8.6.9

## Changelog 8.6.9
- New Email set-up for a few functions.
- Optimization for helper APIs.
- New model for NSFW detection.
- Optimization of Image upload.
- Optimization for less storage used in the database.
- Fix a few bugs, here and there.
- Add a few bugs, I don't know where

## Changelog 8.4.2
- Just to stay in sync with backend...
Expand Down
20,477 changes: 7,532 additions & 12,945 deletions package-lock.json

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@sentry/tracing": "^6.8.0",
"@stripe/react-stripe-js": "^1.6.0",
"@stripe/stripe-js": "^1.20.3",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.21.1",
Expand All @@ -23,15 +23,17 @@
"react": "^16.12.0",
"react-confetti": "^6.0.1",
"react-dom": "^16.12.0",
"react-dropzone": "^12.0.4",
"react-emoji-render": "^1.2.4",
"react-filerobot-image-editor": "^4.1.1",
"react-google-login": "^5.2.2",
"react-google-recaptcha": "^2.1.0",
"react-hot-toast": "^2.1.1",
"react-image-crop": "^8.6.2",
"react-otp-input": "^2.4.0",
"react-redux": "^7.1.3",
"react-router-dom": "^5.1.2",
"react-scripts": "^4.0.3",
"react-scripts": "^5.0.0",
"react-spring": "^8.0.27",
"react-switch": "^6.0.0",
"redux": "^4.0.5",
Expand Down
10 changes: 10 additions & 0 deletions public/.well_known/assetlinks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[{
"relation": ["delegate_permission/common.handle_all_urls"],
"target" : {
"namespace": "android_app",
"package_name": "xyz.dogegram.app",
"sha256_cert_fingerprints": [
"B0:B6:44:C6:E2:66:26:F3:43:C2:DE:5C:79:DF:1D:9D:E8:13:2B:E4:C1:AB:BC:E8:C7:3D:6C:EC:FA:50:06:E5"
] }
}
]
3 changes: 2 additions & 1 deletion public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
Allow: /

2 changes: 1 addition & 1 deletion src/components/App/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import MobileNav from '../../components/MobileNav/MobileNav';

import LoadingPage from '../../pages/LoadingPage/LoadingPage';

const TipsPage = lazy(()=>import('../../pages/PaymentsPage/TipsPage'));
const TipsPage = lazy(()=>import('../../pages/PaymentsPage/PayPage'));
const ProfilePage = lazy(() => import('../../pages/ProfilePage/ProfilePage'));
const PostPage = lazy(() => import('../../pages/PostPage/PostPage'));
const ConfirmationPage = lazy(() =>
Expand Down
4 changes: 2 additions & 2 deletions src/components/Avatar/Avatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';

const Avatar = ({
imageSrc = require('../../assets/img/default-avatar.png').default,
imageSrc,
className,
onClick,
style,
Expand All @@ -24,7 +24,7 @@ const Avatar = ({
className={avatarClasses}
onClick={onClick}
style={style}
src={imageSrc}
src={imageSrc != undefined ? (imageSrc.includes('dogeis.me') ? imageSrc : `https://bom1-storage.dogegram.xyz/${imageSrc}`) : (require('../../assets/img/default-avatar.png'))}
alt="Avatar"
/>
);
Expand Down
3 changes: 1 addition & 2 deletions src/components/LoginCard/LoginCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,12 @@ const LoginCard = ({
<OtpInput
value={otp}
onChange={(code)=>{
console.log(otp)
setOtp(code)
}}
numInputs={6}
separator={<span>-</span>}
placeholder="PLEASE"
containerStyle={{margin:'20px'}}
containerStyle={{marginTop:'20px', marginBottom:'20px'}}
inputStyle={{
width: '30px ',
height: '30px',
Expand Down
24 changes: 1 addition & 23 deletions src/components/NewPost/NewPost.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,7 @@ const NewPost = ({ file, hide }) => {
</MobileHeader>
)}
{renderSections()}
{activeSection !== 'details' && (
<nav className="new-post__nav">
<ul>
<li
className={`new-post__nav-item ${
activeSection === 'filter' && 'new-post__nav-item--active'
}`}
onClick={() => setActiveSection('filter')}
style={{ width: '100%' }}
>
<h4 className="heading-4">Crop and add some filter</h4>
</li>
{/* <li
className={`new-post__nav-item ${
activeSection === 'edit' && 'new-post__nav-item--active'
}`}
onClick={() => setActiveSection('edit')}
>
<h4 className="heading-4">Edit</h4>
</li> */}
</ul>
</nav>
)}

</section>
);
};
Expand Down
70 changes: 50 additions & 20 deletions src/components/NewPost/NewPostEdit/NewPostEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ import React, { useState, Fragment, useRef } from 'react';
import ReactCrop from 'react-image-crop';
import 'react-image-crop/dist/ReactCrop.css';
import FilterSelector from '../../FilterSelector/FilterSelector';
import FilerobotImageEditor, { TABS, TOOLS } from 'react-filerobot-image-editor';

import Icon from '../../Icon/Icon';

const NewPostEdit = ({ previewImage, setPreviewImage, file, filters }) => {
const [imageState, setImageState] = useState({
crop: { unit: '%', aspect: 4 / 5 },
isCropping: false,
crop: { },
isCropping: true,
});
const imageRef = useRef();

console.log(previewImage, 'aaaaaaaaafile')
const getCroppedImg = (image, crop) => {
const canvas = document.createElement('canvas');
const scaleX = image.naturalWidth / image.width;
Expand Down Expand Up @@ -46,6 +48,17 @@ const NewPostEdit = ({ previewImage, setPreviewImage, file, filters }) => {
});
};

const [isImgEditorShown, setIsImgEditorShown] = useState(false);


const openImgEditor = () => {
setIsImgEditorShown(true);
};

const closeImgEditor = () => {
setIsImgEditorShown(false);
};

const makeClientCrop = async (crop) => {
window.URL.revokeObjectURL(previewImage.src);
if (imageState.imageRef && crop.width && crop.height) {
Expand All @@ -70,15 +83,18 @@ const NewPostEdit = ({ previewImage, setPreviewImage, file, filters }) => {
setImageState((previous) => ({ ...previous, imageRef: image }));
};

const onDragStart = () => {
setImageState((previous) => ({ ...previous, isCropping: true }));
};
const saveImage = (editedImageObject) => {
console.log(editedImageObject, 'editedImageObject');
setPreviewImage({ src: editedImageObject.imageBase64 })
};


const baseFileUrl = window.URL.createObjectURL(file);
return (
<Fragment>
<div className="new-post__preview">
<div className="new-post__preview-image-container">
<ReactCrop
{/*<ReactCrop
src={previewImage.src}
crop={imageState.crop}
onChange={onCropChange}
Expand All @@ -93,22 +109,36 @@ const NewPostEdit = ({ previewImage, setPreviewImage, file, filters }) => {
filter: previewImage.filter,
}}
ruleOfThirds
/>
<Icon
icon="checkmark-outline"
className="new-post__crop-button"
style={imageState.isCropping ? { display: 'inline-block' } : {}}
onClick={() => makeClientCrop(imageState.crop)}
/>
/>*/}
<FilerobotImageEditor
style={{ width: '100%', height: '100%', position: 'absolute' }}
onBeforeSave={()=>{return false}}
source={previewImage.src ? previewImage.src : baseFileUrl}
onSave={(editedImageObject, designState) => saveImage(editedImageObject)}
annotationsCommon={{
fill: '#ff0000'
}}
Text={{ text: 'something...' }}
Crop={{
presetsItems: [
{
titleKey: 'classicPotrait',
descriptionKey: '4:3',
ratio: 4 / 3,
},
{
titleKey: 'classicLandscape',
descriptionKey: '21:9',
ratio: 21 / 9,
},
],
}}
tabsIds={[TABS.ADJUST, TABS.FINETUNE, TABS.FILTERS, TABS.RESIZE]} // or {['Adjust', 'Annotate', 'Watermark']}
defaultTabId={TABS.ADJUST} // or 'Annotate'
defaultToolId={TOOLS.CROP} // or 'Text'
/>
</div>
</div>
<FilterSelector
setFilter={(filter, filterName) =>
setPreviewImage((previous) => ({ ...previous, filter, filterName }))
}
previewImage={previewImage.src}
filters={filters}
/>
</Fragment>
);
};
Expand Down
32 changes: 24 additions & 8 deletions src/components/NewPost/NewPostForm/NewPostForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,30 @@ const NewPostForm = ({

const handleClick = async (event) => {
event.preventDefault();
const formData = new FormData();
formData.append('image', file);
formData.set('caption', caption);
formData.set('postText', postText);
formData.set('crop', JSON.stringify(previewImage.crop));
previewImage.filterName && formData.set('filter', previewImage.filterName);
console.log(file)
const fileToBase64 = async (file) =>
new Promise((resolve, reject) => {
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = () => resolve(reader.result)
reader.onerror = (e) => reject(e)
})

const postData = JSON.stringify({
image: await fileToBase64(file),
caption: caption,
postText: postText,
crop: JSON.stringify(previewImage.crop),
filter: previewImage.filterName ? previewImage.filterName : undefined
})


try {
setLoading(true);
const post = await createPost(formData, token);
if(file.size > 3*1e+6) {
throw new Error('Image should be under 3MB else buy Falcon subscription plan for an increase')
}
const post = await createPost(postData, token);
setLoading(false);
hide();
if (history.location.pathname === '/') {
Expand Down Expand Up @@ -89,7 +104,7 @@ const NewPostForm = ({
style={{ fontSize: '1.5rem' }}
onClick={(event) => handleClick(event)}
>
Share
Publish Post
</TextButton>
</MobileHeader>
<form
Expand Down Expand Up @@ -162,6 +177,7 @@ const NewPostForm = ({
/>
</Fragment>
<div className="post-form__legalnotice">
<h4>(if posing this takes a few secs, please have patience)</h4>
<h5 style={{ fontSize: '1rem' }}>By Posting content to our platform, you agree to abide by our community rules, terms of service and privacy policy.</h5>
</div>
</form>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const NotificationFeed = ({
userCardProps.subText = `whispered to you "${notification.notificationData.message}"`;
userCardChild = (
<img
src={require('../../../assets/img/whisper-pic.png').default}
src={require('../../../assets/img/whisper-pic.png')}
style={{
display: 'flex',
width:'50px',
Expand Down
Loading

0 comments on commit b39c10b

Please sign in to comment.