Indonesia has introduced curbs on social media in a bid to prevent the spread of hoaxes, some calling for violent post-election attacks, and quell two days of protests in the capital.