Code Monkey home page Code Monkey logo

factoriomods's Introduction

⚠️ This project is deprecated ⚠️

There is now an official mod portal at http://mods.factorio.com

Below is the old and obsolete README. You can still see the old app running here, but FactorioMods.com now redirects to the official portal.


Factorio Mods Build Status

FactorioMods.com it's an open source web app to host Factorio Mods, and make it easier for user and devs alike to share, find, download, and manage mods.

Trello board with tasks being worked, ideas, planning and stuff. For bug report use the Github issues.

Is FactorioMods a mod manager?

No, FactorioMods it's not a mod manager, after you download the mods, you have to install them yourself. However there is another open source app, FactorioModManager that allows you to do just that, and here is the forum post with instructions of how to use it.

Since these are both open source apps, it's just a matter of time until we can coordinate to use a common protocol to install mods in the same way that NexusModManager does it.

API to get mods

The API and the API documentation are a WIP, but some features are already working and some basic docs are already here:

The API lives in api.factoriomods.com, going there you can see list of available URLs (authors and users APIs not working yet)

You can get a list of mods by calling /mods or by calling /mods/{mod}. The first one returns an array, and the later, a single object. Or /mods?names=mod-name,mod-name2,another-mod

The structure of the mods given by the API is the following:

{
    "title": "Example Mod!",
    "name": "example-mod", // This is the name on the info.json file
    "url": "http://www.factoriomods.com/mods/example-mod",
    "description": "The summary of what the mod does.",
    "homepage": "", // Official site
    "contact": "", // Author contact information
    "author": "That guy", // Main author
    "categories": ["logistics-network", "map", "player"]
    "releases": [{
        "version": "0.1.2",
        "released_at": "2015-07-22T00:00:00.000Z",
        "game_versions": ["0.11.x", "0.12.x"], // This list of versions the mod works with. But it's actually a range, not a list
        "dependencies": [], // This should be the dependencies listed on info.json but it's empty for now
        "files": [{
            "name": "",
            "url": "http://www.factorioforums.com/forum/download/file.php?id=4726",
            "mirror": "http://s3.amazonaws.com/factoriomods/mod_files/attachments/000/000/222/original/example-mod.zip?1437683360"
        }]
    }, {
        "version": "0.1.1",
        "released_at": "2015-07-15T00:00:00.000Z",
        "game_versions": ["0.11.x"],
        "dependencies": [],
        "files": [{
            "name": "",
            "url": "http://www.factorioforums.com/forum/download/file.php?id=4484",
            "mirror": "http://s3.amazonaws.com/factoriomods/mod_files/attachments/000/000/206/original/example-mod.zip?1437014505"
        }]
    }]
}

Yes, the main URL is an external hotlink, bandwidth costs money, I'm cheap and poor. It that link it's broken you can use the mirror hosted on the project S3 bucket.

factoriomods:// protocol

The URIs look like the following:

factoriomods://eyJpZCI6NDYsInVybCI6Imh0dHA6Ly93d3cuZmFjdG9yaW9tb2RzLmNvbS9tb2RzL3VwZGF0ZWQtZ3JhcGhpY3MiLCJjYXRlZ29yaWVzIjpbInRleHR1cmUtcGFja3MiXSwiYXV0aG9ycyI6WyJ5LnBldHJlbWFubiJdLCJjb250YWN0IjoiIiwidGl0bGUiOiJVcGRhdGVkIEdyYXBoaWNzIiwibmFtZSI6InVwZGF0ZWQtZ3JhcGhpY3MiLCJkZXNjcmlwdGlvbiI6IlRoaXMgbW9kIHVwZGF0ZSBzb21lIGdyYXBoaWNzIHRvIG9mZmljaWFsIGFuZCB1bm9mZmljaWFsIGZhbmNpZXIgZ3JhcGhpY3MuXHJcblxyXG5JdCB1c2VzIGEgdGV4dHVyZSBwYWNrIHRvb2xraXQgSSd2ZSBtYWRlIHdoaWNoIHBlcm1pdCB0byB1cGRhdGUgYWxsIHVzZSBvZiBzcGVjaWZpYyBncmFwaGljcyB3aXRob3V0IGtub3dpbmcgd2hlcmUgdGhleSdyZSB1c2VkLiIsImhvbWVwYWdlIjoiIiwicmVsZWFzZXMiOlt7ImlkIjoyNDUsInZlcnNpb24iOiIwLjEyLjEiLCJyZWxlYXNlZF9hdCI6IjIwMTUtMDgtMDZUMDA6MDA6MDAuMDAwWiIsImdhbWVfdmVyc2lvbnMiOlsiMC4xMS54IiwiMC4xMi54Il0sImRlcGVuZGVuY2llcyI6W10sImZpbGVzIjpbeyJpZCI6MjUxLCJuYW1lIjoiIiwibWlycm9yIjpudWxsLCJ1cmwiOiJodHRwczovL2dpdGh1Yi5jb20vWVBldHJlbWFubi91cGRhdGVkLWdyYXBoaWNzL3JlbGVhc2VzL2Rvd25sb2FkL3VwZGF0ZWQtZ3JhcGhpY3NfMC4xMi4xL3VwZGF0ZWQtZ3JhcGhpY3NfMC4xMi4xLnppcCJ9XX1dfQ==

If it seems familiar, it's because it's a Base64 encoded JSON string, the same JSON string returned by the API /mods and /mods/{mod}. Just check whether it's an array or a single object, and install it.

One thing consider is that the user can click a link to install an specific version, and when he does, the same mod is encoded, but instead of a list of all versions in the #releases attribute, it has just the version the user wants to install.

If the user just clicks install, the version to be installed is to be selected by the mod manager.

How do I submit mods?

Just create an account on the site. After that you'll be able to go to /mods/new and create new mods.

If you already published a mod on the Factorio forums, there is high chance that the mod it's already on the DB. To claim the mod as your own and get management rights, after you register just send me a PM me on the forum and I'll transfer you the mod. I'm working on automating this step, but I want to ask for permission to create an automated bot for the forum first.

How to get it up and running locally

If you want to contribute you'll probably need to run it locally

git clone https://github.com/Zequez/FactorioMods
bundle

At this point you'll need to configure a Postgres server.

rake db:setup
rake fake_data

That might take a while, specially because rake fake_data actually scraps posts from the Factorio forum.

After that you just have to

rails s

And you're on! ...probably... didn't actually test it from scratch on a different computer, you might need to install some things, I'm sure you'll figure it out!

Running tests

bundle exec spring rspec # for one time
guard # for continuous development

And you can check if everything it's working on Travis.

Planned features

I just dump all the ideas on the project Trello board

Copyright / License

Copyright © Ezequiel Adrian Schwartzman. All Rights Reserved.

Licensed under the CPAL-1.0 (the same license that Reddit uses, seemed like a good license for open sourcing web apps).

factoriomods's People

Contributors

willglynn avatar zequez avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

factoriomods's Issues

Entry consistency

Currently for a majority of mods, the info fields do not match up. That beeing the fields in the /mods json index and the info.json in the actual file.

For all current cases, look into https://travis-ci.org/Berserker66/FactorioManager/builds/82317559 and search for AssertionError.

It would be nice if added files are checked for actually beeing .zip's with info.json and enter the mod info automatically into factoriomods.com, as far as available. (I know for example categories would be missing).

Right now there are also 3 files:

broken_mods = {"5dim mod", "Air Filtering", "canInsert"}

That are not valid .zip's with an info.json, therefore fail on automated installs.

Security Issues

  • Site is not served over HTTPS
  • Account recovery page exposes account enumeration vulnerability (It says when an account doesn't exist, it should behave the same as if you had entered a valid account)
  • Account recovery email should send a code which is to be entered on the page following the enter your email address page (Users should not be encouraged to click links in emails and then enter their password)

To be honest I find Ruby really hard to read so I'm unable to review this site in full, but if there's one thing I've learnt from working on authentication / authorisation systems it's that they are far from trivial.

I would strongly recommend moving over to a well-known OpenID Connect provider such as Google. These days sites (Especially small ones such as this which don't have security teams and robust review processes) should not be expecting users to entrust them with their credentials.

I would be happy to advise on integrating with an OpenID Connect provider, although it would have to be general language-independent advice I'm afraid.

Ban .rar files

rar archives are a proprietary format with awful compression ratios, and there's just no reason to ever use them, especially given the large number of much better archive and compression formats.

Add mod thumbnail URI to REST data

Currently I'm forced to scrape the actual mod page for a thumbnail image to display in my manager. Would be nice to just have that link thrown in with the rest of the data returned with the mod info.

var match = Regex.Match(modPageSrc, "<div class=\'mod-image\'>.+?<img src=\"(?<ImgUri>.+?)\" />.+?</div>", RegexOptions.Compiled);
https://db.tt/iDrQYBfj

"&" on filenames are converterd to "_"

As title suggests, "&" on filenames are converterd to "_". If someone downloads the .zip and places them in the correct folder, upon launch they're greeted with an error due to this.

Download Consistency

Building a mod manager, with the aim of automatically updating mods before launching into factorio. Problem I'm running into, is that the files are inconsistent. You get download links from the api, that can link to practically anything. I can check the returned file to be zip and contains the info.json file, but if that doesn't exist, the file is worthless to an automated process. In my opinion the mods should be consistently factorio zip files, either by the website checking contributions to be that when the link is added, or by hosting the file on FactorioMods.

With the current mods, I mostly get zip files, but also stuff like "5dim pack.rar" "XxrcAy6" and "file.php"

Transfer Mod Authorship?

There doesn't seem to be a good way to handle what happens when a mod is taken over by a new author. I could re-submit a mod, but then you have duplicates of the same name, which is confusing.

Case in point, Marathon mod. The database lists it as for 0.11x, and with the old author. But it should be listed as 0.12x, and with the old and new author: http://www.factorioforums.com/forum/viewtopic.php?f=91&t=13567

Add Method To Count Pages

I would like a method that allows me to count the number of pages available, so I do not have to guess while my app is loading the mod list.

Download checksum

Simply would be nice if for the url/mirror targets there was a checksum in the api (preferably sha or md5 - as those are guaranteed to exist in python), to validate a downloaded file.

First / Last version flipped on webview

Example: http://www.factoriomods.com/mods/landfill

For me it states:

Factorio version: v0.11.x-0.12.x
Author: Rseding91
First version: 2.1.5 (5 months ago)
Last version: 2.1.4 (8 months ago)

But it should list the newest version (2.1.5) as "Last" aka Latest version. Preferably change the text to Latest as to eradicate any possible confusion like so:

Factorio version: v0.11.x-0.12.x
Author: Rseding91
Latest version: 2.1.5 (5 months ago)
First version: 2.1.4 (8 months ago)

factoriomods uri is truncated.

As an example, for the galactic trade mod: this is the decoded string:

'{"id":52,"url":"http://www.factoriomods.com/mods/galactic-trade-mod","categories":["gameplay"],"author":"coopmaster","contact":"[email protected]","title":"Galactic Trade Mod","name":"GalacticTrade","description":"This mod adds the ability to buy and sell items in the game at market prices. You unlock the chest by researching market trading which comes after electronics.","homepage":"","releases":[{"id":279,"version":"0.6.5","released_at":"2015-09-22T00:00:00.000Z","game_versions":["0.12.x"],"dependencies":[],"files":[{"id":293,"name":"","mirror":null,"url":"https://drive.google.com/open?id=0B-yFva9bu-RVRDlCWEZ0ZmNkOVE"},{"id":292,"name":"","mirror":null,"url":"http://www.factorioforums.com/forum/download/file.php?id=6083"}]},{"id":274,"version":"0.6.4","released_at":"2015-09-20T00:00:00.000Z","game_versions":["0.12.x"],"dependencies":[],"files":[{"id":287,"name":"","mirror":null,"url":"http://www.factorioforums.com/forum/download/file.php?id=6024"},{"id":286,"name":"","mirror":null,"url":"https://drive.google.com/open?id=0B-yFva9bu-RVblJEU0FkM01MZUk"}]},{"id":270,"version":"0.6.2","released_at":"2015-09-15T00:00:00.000Z","game_versions":["0.12.x"],"dependencies":[],"files":[{"id":279,"name":"","mirror":null,"url":"https://drive.google.com/open?id=0B-yFva9bu-RVdWNXSGxjaWxyT2s"}]},{"id":266,"version":"0.6.1","released_at":"2015-09-10T00:00:00.000Z","game_versions":["0.12.x"],"dependencies":[],"files":[{"id":273,"name":"","mirror":null,"url":"https://drive.google.com/open?id=0B-yFva9bu-RVSDFpc0ZMZ3RiQmM"}]},{"id":69,"versi'

As you can see, it simply ends midway and does not yield a proper json object.

Instead of encoding all this information, I'd recommend just linking to an url on factoriomods.com, that then yields the json data.

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.