Giter VIP home page Giter VIP logo

factorio-prints's People

Contributors

acasperw avatar dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar factorioblueprints avatar hayden-corney avatar lknechtli avatar lukaselmer avatar pmaidens avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

factorio-prints's Issues

Unable to load blueprint with null tag

For some reason, it seems some blueprints have a null tag.

Example: Brian's Trains - https://www.factorio.school/view/-LaIPNgh8f16V8EwXXpW

When I try and load this page, it fails to display.

Checking the console, shows the stack trace.

TypeError: Cannot read property 'category' of null
    at SingleBlueprint.js:351

Checking the API response for this blueprint shows the following tags - https://www.factorio.school/api/blueprint/-LaIPNgh8f16V8EwXXpW

  "tags": [
    {
      "tag": {
        "category": "mods",
        "name": "ltn"
      }
    },
    {
      "tag": {
        "category": "train",
        "name": "junction"
      }
    },
    {
      "tag": {
        "category": "train",
        "name": "loading station"
      }
    },
    {
      "tag": {
        "category": "train",
        "name": "stacker"
      }
    },
    {
      "tag": {
        "category": "train",
        "name": "track"
      }
    },
    {
      "tag": {
        "category": "train",
        "name": "unloading station"
      }
    },
    {
      "tag": {
        "category": "version",
        "name": "0,17"
      }
    },
    {
      "tag": null
    }
  ]

I believe it is that final null tag that is causing this issue.

Logo

The site needs a logo. The favicon is currently the react logo and we could also replace the gears in the header with the new logo. I'm not experienced in it or else I would come up with some concepts myself but perhaps someone else here is capable of doing it or knows someone who could.

Fix image hosting.

Images are primarily in Imgur, and it seems that factorioprints.com got banned by Imgur.

Backup images are in Google Cloud Storage in gs://facorio-blueprints.appspot.com.

Likely next steps:

  • Migrate images from Google Cloud Storage to Cloudinary or alternative
  • Update reads to look at Cloudinary
  • Update writes to write to Cloudinary (and probably still Google as a backup)

Enhance in-site search results with google search results.

The in-site search results are limited. They only find blueprints where the search term is a substring of the title. Searching google for site:factorioprints.com/view searchterm often gives better results. It would be great to combine both techniques in a single search interface.

Github login broken

When attempting to log in with github, I authorize but once the dialog disappears nothing happens.

Add search functionality.

Now that images are hosted in imgur and the bigger grid views load summary data, page loads happen reasonably quickly.

Now that page loads are reasonably quick, Google seems to be indexing all pages well.

I think a decent implementation of search for term would just open up google results for site:factorioprints.com/view term. Google has their Custom Search Engine which is embeddable, but I'm not sure if that helps.

Initial load of the page is quite slow.

I'm noticing that on first loading the page (either on a new browser open or if I refresh the page) it is quite slow to load the items in the main section. It takes several seconds to load them. After that it seems to be fine. It seems like this is new behavior with the most recent update as I think I would have noticed this before.

I've attached a screenshot from Chrome with the network debugger open which shows that it seems to happen when the database.js request is made. I can repro this issue in IE

factorio-prints-slow-load
as well.

Pagination problem

Hello devs,
When using search function on website, pagination is not working properly. For example if I search by tag for "/train/junction", first page loads 2 items, seconds and third pages one item and fourth page - 3 items. I feel like many more items could be squeezed on same page, without randomly distributing them across multiple pages and forcing user to click "Next Page" a lot of times.

Screenshot from 2019-10-01 11-31-58

Swap the color styles of default and primary.

I'm mainly thinking about buttons, but this could apply to all elements with default and primary styles. Right now default buttons are bright orange and primary buttons are gray. Swapping the styles would cause the primary button to pop visually.

Save the current state of the /edit page in local storage.

Currently, the state of the /create page is stored in the browser's local storage at the key factorio-blueprint-create-form. This way, you can navigate to another route, come back, and not lose work. When editing a blueprint, we should also store state in local storage, at a key like factorio-blueprint-edit-form/${blueprintId}.

Optimize the amount of data downloaded.

The site uses pagination on the "most recent" view to improve rendering speed, but it still downloads the data for all summaries. This slows down the page load times noticeably.

Search is case sensitive

Searches seem to be case sensitive. I was trying to look up ore crushers, but got no results on "crusher". "Crusher" did give a few though.

Expected behavior: Searching should not care about upper/lowercase

Fix bug in search.

The database used by factorioprints is Firebase. Firebase allows a filter clause OR an order-by clause but not both.

The old strategy was to download ALL blueprint summaries, ordered, and do the filtering client side. This worked but got slower and consumed more bandwidth over time, until it got prohibitively expensive.

The current strategy is to order-by and paginate server side and filter client side. This makes it so that there are a different number of results per page, including some pages with zero results.

Iโ€™m working on migrating from Firebase to a relational database. But this is essentially a rewrite, and it would be good to explore other strategies.

Error when creating or editing blueprints

Clicking on "Save" to post a blueprint or edit an existing one causes this error to appear in the console.

2.9498f724.chunk.js?__WB_REVISION__=daaa88dbd2cb512d975c:2 Uncaught RangeError: Maximum call stack size exceeded
    at main.ba448488.chunk.js?__WB_REVISION__=b560ff689b817ca5ab08:1
    at ma.convertEncodedTextToObject (main.ba448488.chunk.js?__WB_REVISION__=b560ff689b817ca5ab08:1)
    at ma.get decodedObject [as decodedObject] (main.ba448488.chunk.js?__WB_REVISION__=b560ff689b817ca5ab08:1)
    at ir.validateWarnings (main.ba448488.chunk.js?__WB_REVISION__=b560ff689b817ca5ab08:1)
    at handleCreateBlueprint (main.ba448488.chunk.js?__WB_REVISION__=b560ff689b817ca5ab08:1)
    at Object.u (2.9498f724.chunk.js?__WB_REVISION__=daaa88dbd2cb512d975c:2)
    at d (2.9498f724.chunk.js?__WB_REVISION__=daaa88dbd2cb512d975c:2)
    at 2.9498f724.chunk.js?__WB_REVISION__=daaa88dbd2cb512d975c:2
    at T (2.9498f724.chunk.js?__WB_REVISION__=daaa88dbd2cb512d975c:2)
    at P (2.9498f724.chunk.js?__WB_REVISION__=daaa88dbd2cb512d975c:2)

I have no idea what that means so I've tried a couple of things before calling for help.
Switching browsers (Chrome, Firefox, Edge and Brave), disabling AdBlock and similar extensions, restarting my laptop, and even switching devices didn't work, and no other human being seems to have such issues as of my knowledge.
Other people did post their creations after I've encountered this error so it seems that it's specific to me

Fix img preview from imgur.com

Hi there.
If you have edite code for img for preview, or all imges from imgur.com. Lets change a protocol from https:// on http:/ thats all.
imgur com

Front End Optimizations

There are a number of issues to be solved by having a speedier load time. It allows search engines to index better and user experience is improved. I ran an audit using lighthouse which gave insight into the performance, progressiveness, and other statistics. You can see the results of my run here.

Lighthouse even offers specific categories needing improvement. The one we're interested in is performance.

Note: All the times in lighthouse are inflated due to the auditing taking extra time

As you can see, the page takes 6200ms to begin displaying significant content. This load time has been referenced in several other issues #18 discussing SEO, #16 for using server side rendering to decrease user load times. This is a very important issue that needs to be resolved using either the server side discussed in #16 or by other means, such as caching.

We can cache by caching all static resources: Imgur images, font-awesome, bootstrap, react, the base html page, and base user pages. Or we can install a service-worker This is the better option to manage caching and retrieving resources in parallel with page loading.

Another option rather than caching font-awesome we could switch to icomoon which allows selecting only the icons we need and caching it with versioning or times tamps, so if we need to add more we just increment the version.

Removing unused CSS rules would be beneficial too. As mentioned above icomoon would be good, because 98% of the CSS rules in font-awesome go unused on the homepage and user pages. 90% of the CSS rules with bootstrap go unused so perhaps some customizing of CSS rules with our current bootstrap version would be useful. For example we can remove glyph-icons if we are going to use an external icon library.

These are all tips in the right direction. Priority wise our best bet is caching, for this we would need to setup a service-worker to handle requesting resources from either the internet or the cache. A lot of pre-made service-workers exist and they could be useful, or we could simply build our own from scratch. Next we should switch to icomoon, this is a simple thing to do and is simply a matter of selecting only the icons we need. Hopefully simply implementing these will removing the need for more complicated options to improve speed.

Add pre-defined categories

Each blueprint could have one or more pre-defined categories.

Suggestions:

-Fluid handling
-Compact
-Combinator
-Belt driven
-Bot driven
-Trains
-Power production

"Authorization failed" when trying to fetch database

I am trying to see firebase data, and according to instructions in CONTRIBUTING.md run the following commands:

git clone [email protected]:FactorioBlueprints/factorio-prints.git
cd factorio-prints

firebase login
firebase database:get / > factorio-blueprints-export.json

But I receive the following error:

Error: Authorization failed. This account is missing the following required permissions on project facorio-blueprints:

  firebase.projects.get
  firebasedatabase.instances.get

Could you say, what I am doing wrong?

Add OpenSearch descriptor

It would be nice to have the search of factorio.school available as a search engine in the browser.

All you need to do is to make a static xml file available and add an entry to the <head> section. Also it must be possible to search via a query parameter.

You can compare githubs opensearch descriptor.

<OpenSearchDescription>
<ShortName>GitHub</ShortName>
<Description>Search GitHub</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16" height="16" type="image/x-icon">https://github.com/favicon.ico</Image>
<Url type="text/html" method="get" template="https://github.com/search?q={searchTerms}&ref=opensearch"/>
<moz:SearchForm>https://github.com/search</moz:SearchForm>
</OpenSearchDescription>
<head>
<link rel="search" type="application/opensearchdescription+xml" href="/opensearch.xml" title="GitHub">
</head>

From https://en.wikipedia.org/wiki/OpenSearch

OpenSearch Description Documents must be served with the application/opensearchdescription+xm

Regarding the section that Firefox has deprecated OpenSearch on wikipedia, see the original post

We also want to clarify that this announcement and the dates we specified only cover our plan for AMO [addons.mozilla.org]. As long as Firefox supports OpenSearch, those features in the browser will remain unchanged.

StandardJS

I feel the need to convert the project over to standardjs. If you don't know what that is, it's not as scary as it sounds. StandardJS summarized is the code style standard for Javascript. It is there to simply remove all issues and inconsistancies between multiple people working on a project. It offers a lot of methods to be implemented, they can all be seen here.

Converting is easy, simply implement one of the methods mentioned above then run eslint . --fix which will automatically fix any issues that clash with the standard.

Enhance the tag suggestion logic to recognize 0.16 and 0.17 features.

Blueprints from 0.15 through 0.17 are backwards compatible and sometimes they're hard to tell apart. When creating a blueprint, the site currently suggests 0.15 in some situations where it's possible to tell that it's definitely a 0.16 or 0.17 blueprint.

  • Blueprint contains entities for artillery, artillery wagon, buffer chest.
  • Blueprint contains recipes for the above entities, or for artillery shells.
  • Train stops contain names.
  • Splitters contain filters.
  • etc.

Upgrade-planner type functionality to convert blueprints.

Now that the site supports converting blueprints from 0.14 to 0.15 and displaying the json representation along the way, it should be possible to also convert blueprints along the way in the style of upgrade-planner. For example, we could take a 4-to-4 balancer make with blue belts and convert it to yellow belts. Conceptually, it's just a text replacement in the json, substituting "transport-belt" for "express-transport-belt", and then compressing the blueprint to base64 again.

Temporary fix for images

I don't want to railroad #29 , so I will say it here.

I know this is a dick move, but... Couldn't we just make it so that we do NOT send the referer header?

I tried with an extension that BLOCKS such header, and all of the images load up with no issue.

Maybe as a temporary solution?

Main page layout, too much wasted space.

I think this is probably cured by using the imgur api and switching to a square version of the images, but the current layout ends up having too much wasted space, because all of the individual display boxes default to the size of the largest one.

It looks like we already do a onHover display of a larger version, so it might not be bad to just downsize the image displayed in the listing.

Add dynamic blueprint preview image.

A nice feature during blueprint submission would be validation of the blueprint string as well as then rendering a preview similar to the preview in the in-game blueprint. A list of components alongside a topdown view of each tile and entity would be the best. If not, simply a list of components in the singleblueprint screen would be the minimum for this feature.

"Real Server"

As to this comment. Essentially, running an actual backend instead of using firebase's.

Reasons to do it:

  • Verify blueprint strings and other information (also prevent spamming)
  • Could fix issues like #5
  • Will help expansion of new features that could require a backend (read contents of blueprint string?)
  • Less load on client (can do more on server)

Reasons not to:

  • If server-side rendering was one of the considerations (my personal favorite is EJS...), that would be scraping a lot of the existing react content
  • Have to handle logins and databases ourselves. This could mean express+passport+mongo (or whatever combo you choose), but it becomes much more of a hassle (in terms of code, it might be easier to for devs to test since there's no worry about modifying the production database).
  • Transfer firebase data (wouldn't be too hard in JSON format, but transferring users is a larger pain since you'd need to transfer the users over, map their firebase-id to their new id, and insert that into the old blueprints when adding those)

TL;DR

Pros: Client runs faster, more control over what we can do, clearer separation between server and client

Cons: Risk scraping a lot of the JS if a lot would be moved to backend, more hassle in terms of databases & logins

Add tagging.

I'm thinking a blueprint should be allowed to have several tags, and you can search by several tags. You can choose from predefined tags, so that we don't have lots of variants of similar ideas. They can be arranged in a hierarchy. Searching for power for example could return results for all of power, power/solar, and power/steam.

Allow users to sign up with email/password.

Firebase has an api for username/password, so the app doesn't have to store passwords in any form. In addition to email/password, the form should take a custom display name so that the user's real name isn't revealed.

Indicate which mod was used to create each blueprint.

Now that we're parsing the contents of each blueprint, I can see that blueprint books created by different mods have differences in their content. It's possible that an export from one plugin won't import cleanly into another plugin. It would be good to look for the differences between the data and indicate to the user a guess about which mod was used to create the blueprint.

We could also consider displaying the decoded data to the user, or just logging it to the console as a json object.

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.