Coder Social home page Coder Social logo

cozy.nyc-old's Introduction

cozy.nyc

A site for NEETs...

Home

Build Status Dependency Status devDependency Status


This is only the frontend for cozy.nyc the backend can be found here cozy-api

Installation

yarn install

Running Dev Server

yarn dev

The first time it may take a little while to generate the first webpack-assets.json and complain with a few dozen [webpack-isomorphic-tools] (waiting for the first Webpack build to finish) printouts, but be patient. Give it 30 seconds.

Building and Running Production Server

yarn build
yarn start

Unit Tests

The project uses Jest to run your unit tests.

To run the tests in the project, just simply run npm test if you have Chrome installed, it will be automatically launched as a test service for you.

Join Our Discord

Discord - https://discord.gg/3WSA2SG

Special Thanks to @bertho-zero for providing https://github.com/bertho-zero/react-redux-universal-hot-example

cozy.nyc-old's People

Contributors

dependabot[bot] avatar nobodyhere2see avatar s1mb10t3 avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cozy.nyc-old's Issues

Edit Loadables

Loadable should be changed to a nice gif and work across every page.

.env

Actually use the .env cross the project

Fix thread page layout

When there are multiple threads the stack in a column of one. Columns should be scaled by display.

Font in production is using the wrong typeface and weight

Font of the Production version of the site is off compared to when it's in local/dev.

The text on the site seem to default to sans serif instead of Dosis. The weight of the font is off too. NavLinks in the home page should have a weight of 700.

Infinite fetching requests on thread page

Describe the bug
Infinite get calls happen when loading board page

To Reproduce

  1. Go to any board's page

Expected behavior
2. Not infinitely request

Screenshots
image

Additional context
Some sort of issue with componentDidMount

Stream Directory Page

Stream page should display a list of current streams on the site. List of streams can be pull from the cozy-api. Each stream should display a image or a short clip of the ongoing stream, the title, and the user hosting.

Login user after registration

Currently when you register a user it just returns you to home. The api should return a token for use to store and use for user auth.

User Profiles

All registered users need a profile page. Users info and profile image is pulled from the cozy-api. Example can be found in backup here

ToDo:

  • Display user public info. i.e. username, bio, location

Stream Page

Display embedded stream to page along with a chat once that done.

Edit User

Users should be able to change their email, username, password, bio, and location.
This stuff like email, username, and password should be editable on its own page account settings and stuff like bio and location should be editable under the current users profile page and a profile settings page.

Issue #49 should be solved before starting this one

Auth System

Current Authentication needs to be reworked to use the cozy-api. Example of a working authentication action can be found the in the backup fork here and current authentication can be found here.

ToDo:

  • Login with cozy-api
  • Register with cozy-api
  • Store auth tokens via cookies or session
  • Token verification

Cannot create production build

After running yarn build then yarn start I get the following error.

yarn run v1.16.0
$ concurrently --kill-others "yarn start-prod"
$ cross-env NODE_PATH=src NODE_ENV=production PORT=8080 APIHOST='https://api.cozy.nyc' ./bin/server.js
[0] events.js:174
[0]       throw er; // Unhandled 'error' event
[0]       ^
[0] 
[0] Error: spawn ./bin/server.js EACCES
[0]     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
[0]     at onErrorNT (internal/child_process.js:415:16)
[0]     at process._tickCallback (internal/process/next_tick.js:63:19)
[0]     at Function.Module.runMain (internal/modules/cjs/loader.js:745:11)
[0]     at startup (internal/bootstrap/node.js:283:19)
[0]     at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
[0] Emitted 'error' event at:
[0]     at Process.ChildProcess._handle.onexit (internal/child_process.js:246:12)
[0]     at onErrorNT (internal/child_process.js:415:16)
[0]     [... lines matching original stack trace ...]
[0]     at bootstrapNodeJSCore (internal/bootstrap/node.js:743:3)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[0] yarn start-prod exited with code 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Already tried downgrading bootstrap to a previous version that worked with production.

Profile Button

Profile Button displays the current users profile image, username, and a logout button. If the users isn't login it just shows the option to login or register.

The backup fork already has a profile-button component written here. Needs to be rewritten for current fork.

Auth system should be complete first before implementing this component
Take a look at issue #49

Adding a stream

Users should be able to post their streams on the site. This should be done by using a post call to the cozy-api.

Cookies sent in header

Describe the bug
JWT currently being sent in both cookies and header, remove it from being sent in cookies for security.

To Reproduce
Check browser cookies after logging into site--
For Chrome users, log in, click View in the Chrome navigation bar > Developer > Javascript Console > Application > Cookies > 0.0.0.0:3000.

Expected behavior
"jwt" has a value when it should not be there.

Desktop (please complete the following information):

  • Browser: Chrome

Additional context
live laugh love

Stored auth tokens are not being verified and expiring

Describe the bug
Site should verify the authentication token stored on the client's cookie. Cookie don't expire.

Expected behavior
Authentication Tokens should be verified ether before a POST or any api call that requires authentication and/or create a error handle for failed call.

Tokens also should expire after a set amount of time and logout the user.

Additional context
Token expiration may have to be handle in cozy-api

Update Boards - Display threads

Boards now need to display all threads on a given board.

We also need to view a thread. Should be able to view the OP's post along with all the replies.

PR #63 is the start off point for this update.
Design mockups in the works

Add Exceptions for failed API Calls.

Certain API calls on the site don't have exceptions when a call fails or returns nothing causing pages to be blank and/or crash.

/boards - Page is blank when the API calls fails or returns nothing. Page should return an message stating that the boards are down if the API fails or returns nothing.

/boards/:boardtag - Same issue with the board page. Page should return an message stating that the boards are down if the API fails or if returns nothing, display a message to the user that this board is empty.

Login/Register

Allow users to login and register through the site using cozy's api.

Radio Page crashing

The channel-list component crashes the site when visiting the radio page.

Fix thread urls

Visiting a thread will have the url of http://0.0.0.0:3000/boards/undefined/3 while it should be http://0.0.0.0:3000/boards/g/3

token-related api calls returning 404 errors

Describe the bug
I believe the routes for tokens being requested in the frontend are incorrect--see Additional context at the bottom for more details

To Reproduce
Steps to reproduce the behavior:

  1. View Javascript console from browser, click the Network tab
  2. Either go to https://cozy.nyc/ or go to https://cozy.nyc/login and try logging in with a registered account
  3. In the Network tab, verify/ and token/ requests return a 404 not found error

Expected behavior
Since the token is being stored in the backend as well as stored in cookies, should be able to verify the token and correctly log in, or at least get a 400 bad request type error, rather than a complete 404

Screenshots
image

Additional context
Request URL's are probably wrong.
Backend api routes for tokens are:

api-token-auth/
api-token-refresh/
api-token-verify/

from https://github.com/cozy-nyc/cozy-api/blob/master/apps/accounts/urls.py

However, frontend seems to call

/auth/token/
/auth/token/verify/

from https://github.com/cozy-nyc/cozy-nyc/blob/master/src/redux/modules/auth.js

Display thread image

If the thread's op has a image, display that on the thread block in the board page.

Error when access site via production

This error occurs when the frontend is being run without access to the API.

yarn run v1.19.1
$ concurrently --kill-others "yarn start-prod"
$ cross-env NODE_PATH=src NODE_ENV=production PORT=8080 APIHOST='https://api.cozy.nyc' node ./bin/server.js
[0] Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
[0] ----
[0] ==> โœ…  https://api.cozy.nyc is running, talking to API server on %s.
[0] ==> ๐Ÿ’ป  Open http://0.0.0.0:8080 in a browser to view the app.
[0] proxy error { Error: connect ECONNREFUSED 204.48.27.157:443
[0]     at Object._errnoException (util.js:1022:11)
[0]     at _exceptionWithHostPort (util.js:1044:20)
[0]     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
[0]   code: 'ECONNREFUSED',
[0]   errno: 'ECONNREFUSED',
[0]   syscall: 'connect',
[0]   address: '204.48.27.157',
[0]   port: 443 }
[0] GET / 200 40.637 ms - -
[0] GET /dist/main-fd82e1283f0db20fc3e5.css 200 5.412 ms - -
[0] GET /dist/main-fd82e1283f0db20fc3e5.js 200 2.533 ms - -
[0] proxy error { Error: connect ECONNREFUSED 204.48.27.157:443
[0]     at Object._errnoException (util.js:1022:11)
[0]     at _exceptionWithHostPort (util.js:1044:20)
[0]     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
[0]   code: 'ECONNREFUSED',
[0]   errno: 'ECONNREFUSED',
[0]   syscall: 'connect',
[0]   address: '204.48.27.157',
[0]   port: 443 }
[0] GET /dist/about-8f1583eb76f278cbbe2d.chunk.js 200 2.947 ms - -
[0] proxy error { Error: connect ECONNREFUSED 204.48.27.157:443
[0]     at Object._errnoException (util.js:1022:11)
[0]     at _exceptionWithHostPort (util.js:1044:20)
[0]     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
[0]   code: 'ECONNREFUSED',
[0]   errno: 'ECONNREFUSED',
[0]   syscall: 'connect',
[0]   address: '204.48.27.157',
[0]   port: 443 }
[0] POST /api/auth/token/verify/ 500 4.438 ms - -
[0] GET /dist/0a89072fbfe9c6e7e38d01808b003178.gif 200 2.312 ms - 538943
[0] proxy error { Error: connect ECONNREFUSED 204.48.27.157:443
[0]     at Object._errnoException (util.js:1022:11)
[0]     at _exceptionWithHostPort (util.js:1044:20)
[0]     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1198:14)
[0]   code: 'ECONNREFUSED',
[0]   errno: 'ECONNREFUSED',
[0]   syscall: 'connect',
[0]   address: '204.48.27.157',
[0]   port: 443 }
[0] POST /api/auth/token/verify/ 500 6.060 ms - -
[0] MOUNT ERROR:   TypeError: Converting circular structure to JSON
[0]   
[0]   - JSON.stringify
[0]   
[0]   - index.js:78 serialize
[0]     [cozy-nyc]/[serialize-javascript]/index.js:78:20
[0]   
[0]   - Html.js:63 Html
[0]     /var/www/cozy-nyc/src/helpers/Html.js:63:66
[0]   
[0]   - react-dom-server.node.production.min.js:28 d
[0]     [cozy-nyc]/[react-dom]/cjs/react-dom-server.node.production.min.js:28:492
[0]   
[0]   - react-dom-server.node.production.min.js:30 ua
[0]     [cozy-nyc]/[react-dom]/cjs/react-dom-server.node.production.min.js:30:494
[0]   
[0]   - react-dom-server.node.production.min.js:35 a.render
[0]     [cozy-nyc]/[react-dom]/cjs/react-dom-server.node.production.min.js:35:48
[0]   
[0]   - react-dom-server.node.production.min.js:34 a.read
[0]     [cozy-nyc]/[react-dom]/cjs/react-dom-server.node.production.min.js:34:288
[0]   
[0]   - react-dom-server.node.production.min.js:45 Object.renderToString
[0]     [cozy-nyc]/[react-dom]/cjs/react-dom-server.node.production.min.js:45:6
[0]   
[0]   - server.js:187 renderToString
[0]     /var/www/cozy-nyc/src/server.js:187:53
[0]   
[0]   - runtime.js:62 tryCatch
[0]     [cozy-nyc]/[runtime-corejs2]/[regenerator-runtime]/runtime.js:62:40
[0]   
[0] 
[0] events.js:183
[0]       throw er; // Unhandled 'error' event
[0]       ^
[0] 
[0] TypeError: Converting circular structure to JSON
[0]     at JSON.stringify (<anonymous>)
[0]     at serialize (/var/www/cozy-nyc/node_modules/serialize-javascript/index.js:78:20)
[0]     at Html (/var/www/cozy-nyc/src/helpers/Html.js:63:66)
[0]     at d (/var/www/cozy-nyc/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:28:492)
[0]     at ua (/var/www/cozy-nyc/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:30:494)
[0]     at a.render (/var/www/cozy-nyc/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:35:48)
[0]     at a.read (/var/www/cozy-nyc/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:34:288)
[0]     at b._read (/var/www/cozy-nyc/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:401)
[0]     at b.Readable.read (_stream_readable.js:442:10)
[0]     at resume_ (_stream_readable.js:822:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[0] yarn start-prod exited with code 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

This is most likely due to the API calls being made and returning with a 500. The frontend shouldn't require the backend to run. Exceptions need to be added to prevent the site from crashing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.