Skip to content

Can't see shaders code #1595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
pavel-b-kr12 opened this issue Sep 2, 2020 · 23 comments · Fixed by #1690
Closed

Can't see shaders code #1595

pavel-b-kr12 opened this issue Sep 2, 2020 · 23 comments · Fixed by #1690
Labels
Good First Issue A beginner-friendly issue, great for first-time contributors Help Wanted Would love additional input or contributions! Priority:High Should be addressed soon but not critical Type:Task Tasks tied specifically to developer operations and maintenance

Comments

@pavel-b-kr12
Copy link

Nature of issue?

  • Found a bug

Details about the bug:

  • Web browser and version: all Chromium, FireFox, Opera tested
  • Operating System: Windows 10
  • Steps to reproduce this bug:

open any example with shaders e.g. https://editor.p5js.org/p5/sketches/3D:_shader_as_a_texture
navigate to shader file. Nothing appears.

@welcome
Copy link

welcome bot commented Sep 2, 2020

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

@catarak
Copy link
Member

catarak commented Sep 3, 2020

Thanks for reporting! It is not clear here, but these files are actually hosted externally to the web editor, and even though it appears they are empty, they are not (see #196). Since these are small text files, they probably should be hosted locally, and this would involve changing the fetch-examples script.

@catarak catarak added Good First Issue A beginner-friendly issue, great for first-time contributors Help Wanted Would love additional input or contributions! Priority:High Should be addressed soon but not critical Type:Task Tasks tied specifically to developer operations and maintenance labels Sep 3, 2020
@pavel-b-kr12
Copy link
Author

I think people goes to the examples to see that files (and play with them). Now they can't, without download it. But even after download, it is not possible to run examples without setup web server because files can't be loaded from local system because of cross-domain security restriction %\

@catarak
Copy link
Member

catarak commented Sep 9, 2020

@pavel-b-kr12 I hear you and I agree with you!

@ricknjacky
Copy link

@catarak I'd like to work on this issue, I'm new to the codebase can you please give me an insight as to what needs to be done?

@catarak
Copy link
Member

catarak commented Oct 8, 2020

@ricknjacky sure! The file server/scripts/examples.js pulls all of the p5.js examples from the p5.js website repository via the GitHub API and then uploads them to the web editor database. This is the file you'll need to edit. I would suggest the following approach:

  1. Get this project running locally on your computer
  2. Run the fetch-examples script, and make sure that it worked successfully by testing if you can run the p5.js examples on your local version of the web editor.
  3. Edit examples.js so that shader files (I think they are .vert and .frag files) are created as a file in a sketch in the same way that .js, .css, or .html files are, with their text content inserted directly into the MongoDB database, rather than linked via a url like .jpg or .mp3 files.

@ricknjacky
Copy link

image

Run the fetch-examples script, and make sure that it worked successfully by testing if you can run the p5.js examples on your local version of the web editor.

I get this error
@catarak please help me out here

@catarak
Copy link
Member

catarak commented Oct 9, 2020

@ricknjacky did you create a .env file with valid Github credentials?

@ricknjacky
Copy link

Yes I performed this command using
cp .env.example .env

i refereed the docs step by step here

@ricknjacky
Copy link

ricknjacky commented Oct 9, 2020

Wait, I didn't do the

(Optional) Update .env with necessary keys to enable certain app behaviors, i.e. add Github ID and Github Secret if you want to be able to log in with Github.
step

let me try once again

@ankitpal1029
Copy link

is this issue still open? i'd like to work on this.

@catarak
Copy link
Member

catarak commented Oct 26, 2020

@ankitpal1029 yes and go ahead and work on it!

@ankitpal1029
Copy link

@catarak sure I'll get right to setting up the project , I'm new to contributing to open source projects
Forgive me if I badger you with too many questions ⊙﹏⊙

@vulongphan
Copy link
Contributor

vulongphan commented Nov 6, 2020

@catarak @ricknjacky I had the same issue with running the fetch-examples script although I am sure I passed my correct github credentials (since I am able to login thru Github in my local development). I believe the error is emitted at line 78 (please see attached) and the problem should be within the options at line 51 (see attached), and more specifically I speculate that the issue is with the github api used in this case
Screen Shot 2020-11-06 at 7 12 02 PM

Could you please assess if my speculation is correct and how I can overcome this?

Thank you.

@catarak
Copy link
Member

catarak commented Nov 6, 2020

That's super weird! I don't know what to tell you since it is working for me, and the only difference is the GitHub credentials. Are you sure you're giving the right permissions to your GitHub app?

@vulongphan
Copy link
Contributor

vulongphan commented Nov 7, 2020

@catarak is it possible that you can tell me what permissions I need to grant my Github App? I have enabled the Contents option but there is still the error 401 - Bad Credentials. I have also searched for the permissions that I need to give my github app in order for it to access resources at /repos GitHub API endpoint but there is no useful document on this.
I was looking at the GET repository API here. I just dont know if I am heading in the right direction.

@catarak
Copy link
Member

catarak commented Nov 9, 2020

I would recommend trying to authenticate with the GitHub API outside of the context of the web editor to confirm your credentials work! You could write a small script to do this.

@vulongphan
Copy link
Contributor

Hi @catarak, I wrote a script to check my credentials and I realized that (yes, I should have realized earlier) the credentials I created previously are for a Github app, while the correct credentials should be for an Oauth App. Hence, I have been able to run the fetch-examples successfully. If @ricknjacky does not mind, could I work on this issue?

Also, do you think that we should update the installation guide with a note that the Github credentials should be for an Oauth app instead of a Github app so that the incoming contributors won't run into the same issue as me?

@catarak
Copy link
Member

catarak commented Nov 12, 2020

Also, do you think that we should update the installation guide with a note that the Github credentials should be for an Oauth app instead of a Github app so that the incoming contributors won't run into the same issue as me?

That makes sense to me! I think that there have been some changes to the GitHub API since I started this project, and maybe there wasn't a distinction between OAuth Apps and GitHub Apps then?

@vulongphan
Copy link
Contributor

@ricknjacky sure! The file server/scripts/examples.js pulls all of the p5.js examples from the p5.js website repository via the GitHub API and then uploads them to the web editor database. This is the file you'll need to edit. I would suggest the following approach:

  1. Get this project running locally on your computer
  2. Run the fetch-examples script, and make sure that it worked successfully by testing if you can run the p5.js examples on your local version of the web editor.
  3. Edit examples.js so that shader files (I think they are .vert and .frag files) are created as a file in a sketch in the same way that .js, .css, or .html files are, with their text content inserted directly into the MongoDB database, rather than linked via a url like .jpg or .mp3 files.

@catarak Is it fine if I work on this shaders code issue since there hasn't been any update?

@vulongphan
Copy link
Contributor

@catarak I am so sorry for mentioning you in many different issues and PRs. I think that is why you missed my comment on this issue. I just want to know if this issue still needs to be worked on and whether I can work on it.

Thank you!

@catarak
Copy link
Member

catarak commented Nov 17, 2020

No worries! Yes you can go ahead and work on this 😄

@vulongphan
Copy link
Contributor

@catarak I have been able to add text content to the .frag and .vert files. However, I am not sure if my solution is of the best coding practice. Could you please have a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good First Issue A beginner-friendly issue, great for first-time contributors Help Wanted Would love additional input or contributions! Priority:High Should be addressed soon but not critical Type:Task Tasks tied specifically to developer operations and maintenance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants