0a.io-Meteor

0a.io-Meteor

The source code of 0a.io (2.0). Handcrafted on top of the awesome Meteor.js. (0a.io 3.0 is now on Jekyll (0a.io 4.2.0 is now on Haskell!))

#Behold! Here is the source code of 0a.io

0a.io is known as an N dimensional object created by commingling 0s and 1s with unicorn potions. It is basically the place whereon I publish explanatory articles (or just anything I at some moment felt like penning). It is handcrafted with Meteor.

Feel free to experiment with it, customize it and launch it as your very own Meteor application. Attribution in any form is appreciated, but not required :)

#Installing Meteor For OS X or Linux:

curl https://install.meteor.com/ | sh

For Windows:
the Meteor dev team is currently working on the official installation on Windows. Meanwhile, you can check out the unofficial guide for getting Meteor running natively on Windows.

#Running 0a locally Cd to the app's direcotry, and just do

Meteor

#Deploying your customized version of 0a arunoda's Meteor Up is an interesting tool for deploying meteor application.

#Registering/Logging in

To register as a new user or login in, go to /twitterlogin . At the current moment 0a.io only uses Twitter login. To add in more logins, you can read it up in Meteor's doc here.

To use the Twitter login, you would first need to have a Twitter application, which can be created here. Note: if you want to use it for a meteor app running locally, put "http://127.0.0.1:3000/" (or the IPv4 address you are using) as the website in your Twitter app. (Or else you would receive internal server error when you try to log in). Twitter has got some stupid validation regex that will prevent you from putting "http://localhost:3000/" or "http://localhost/" as the website.

After you have created your twitter app, just configure the twitter login using the API key and API secret by clicking on the config button at /twitterlogin .

#Making a user an admin

The first user to log in would automatically become the admin. To update the adminship of a user, you would need to do it yourself in a MongoDB shell.
To run a MongoDB shell, cd into your app directory, and do this:

Meteor mongo

Or if you are in production server, do this instead:

Mongo 0a //or the name of your app

Inside the MonogoDB shell, you can see all the registered users by doing

db.users.find()

To make a user an admin, do this:

db.users.update({ "_id" : USERID},{$set:{admin:1}});

Replace USERID with the _id of the user whom you want to make as admin.

#Writing or publishing an article Right now the admin panel is located at /archy
It is a simple one. It allows you to publish, unpublish, create, edit, or delete article.

#Adding/editing changelog Currently you would have to do it in a MongoDB shell. Read Making a user an admin session if you are not sure how to run a MongoDB Shell.

To add an entry, just do a db.changelog.insert:

db.changelog.insert({ "date" : ISODate(), "description" : "meow meow meow", "version" : "1.0" })

To edit an entry, just do a db.changelog.update with $set.

db.changelog.update({ "version" : "1.0" },{$set:{"description":"nyan nyan"}})

To remove an entry, simply do a db.changelog.remove

db.changelog.remove({ "version" : "1.0" })

To learn more about Mongo shell methods, you can read the MongoDB docs here.

#Known issue in 0a: For some reasons, ReactiveTable would throw an exception when it is being re-rendered.

Exception in template helper: TypeError: Cannot read property 'get' of undefined
    at Object.Template.reactiveTable.helpers.isVisible
    ......

This bug appears to have existed for quite some time in ReactiveTable. I have yet looked into its source code so I'm not exactly sure what is causing it. Although an exception is thrown, it doesn't seem to be causing problem significant enough to be noticed by the users.

#About the future of 0a (this application, not the website 0a.io) Right now 0a may appear to be merely a simple app for single-person content creating & presenting.
I'm actually planning to write it into a CMS for building social network website. It will be nothing like the others. (Or at least that is what I would try to make it into.)
I'm thinking of naming it after one of the most fascinating object in the univerise, Quasar. And of source, it will be open-source :)