コード例 #1
0
exports.newPost = function(req, res) {
  var now = new Date();

  LiveJournal.xmlrpc.setAuth(auth.buildHeader(req));

  LiveJournal.xmlrpc.postevent({
    auth_method: 'oauth',

    security: req.body.security || 'private',
    
    event: req.body.event || '',

    year: now.getFullYear(),
    mon: now.getMonth() + 1,
    day: now.getDate(),

    hour: now.getHours(),
    min: now.getMinutes(),

    props: { opt_preformatted: true }
  }, function(err, post) {

    console.log(err, post);

    res.json(post);
  });
};
コード例 #2
0
exports.login = function(req, res) {
  LiveJournal.xmlrpc.setAuth(buildHeader(req));

  LiveJournal.xmlrpc.login({
    getpickws: 1,
    getpickwurls: 1,
    auth_method: 'oauth'
  }, function(err, profile) {

    if (process.env.LOCAL) {
      console.warn('Doing fake login');

      return res.json({
        username: '******',
        defaultpicurl: 'http://l-userpic.livejournal.com/124065093/71916408'
      });
    }

    if (err) {
      console.error(err);
    }

    if (profile) {
      return res.json(profile);
    }

    return res.json({ message: err });
  });
};
コード例 #3
0
exports.editPost = function(req, res) {
  var now = new Date();

  LiveJournal.xmlrpc.setAuth(auth.buildHeader(req));

  LiveJournal.xmlrpc.editevent({
    auth_method: 'oauth',

    security: req.body.security || 'private',

    event: req.body.event || '',
    itemid: req.body.itemid,

    props: { opt_preformatted: true }
  }, function(err, post) {

    console.log(err, post);

    res.json(post);
  });
};