...
 
Commits (4)
GAB_SOCIAL_ACCESS_TOKEN = your_access_token
\ No newline at end of file
GAB_SOCIAL_INSTANCE_URL = https://gab.com
GAB_SOCIAL_ACCESS_TOKEN = your_access_key
TWINT_DB_PATH = ./
\ No newline at end of file
......@@ -44,6 +44,22 @@ To get an access token:
npx masto-cli --uri=https://<your-server> --email=<your email> --password=<your password>
```
## Configuring your environment
The `.env.sample` file should be copied to `.env` and configured as needed.
### GAB_SOCIAL_INSTANCE_URL
The URL of the Gab Social or Mastodon server to which you want to post.
### GAB_SOCIAL_ACCESS_TOKEN
The API Access Token required to post as you at GAB_SOCIAL_INSTANCE_URL.
### TWINT_DB_PATH
The directory in which you'll have `twint` storing database files.
## Getting tweets
Run `twint` to scrape a Twitter user's timeline into a local sqlite3 database. This is how the system fetches new tweets posted by the tracked Twitter user.
......
// config.js
// Copyright 2019 Gab AI, Inc.
'use strict';
const path = require('path');
const rootPath = path.normalize(__dirname + '/..');
const env = process.env.NODE_ENV || 'development';
let config = {
development: {
dbPath: rootPath,
instanceUrl: 'https://develop.gab.com'
},
test: {
dbPath: rootPath,
instanceUrl: 'https://develop.gab.com'
},
production: {
dbPath: rootPath,
instanceUrl: 'https://gab.com'
}
};
module.exports = config[env];
\ No newline at end of file
......@@ -8,8 +8,6 @@ require('dotenv').config();
const path = require('path');
const argv = require('argv');
module.config = require(path.join(__dirname, 'config', 'config'));
/*
* argv processing
*/
......@@ -45,10 +43,11 @@ if (!module.args.options.username) {
process.stderr.write('must specify Twitter username to track\n');
process.exit(1);
}
if (!module.config.dbPath) {
process.stderr.write('must specify config.dbPath\n');
process.exit(1);
}
module.config = {
dbPath: process.env.TWINT_DB_PATH || './',
instanceUrl: process.env.GAB_SOCIAL_INSTANCE_URL || 'https://gab.com'
};
const Masto = require('masto');
const sqlite3 = require('sqlite3');
......@@ -129,6 +128,9 @@ module.updateTweets = ( ) => {
}
return resolve();
});
})
.then(( ) => {
return module.updateTweets();
});
};
......@@ -179,7 +181,7 @@ Masto.Masto
if (err) {
return reject(err);
}
console.log('disconnecting from sqlite3 db', {
console.log('disconnected from sqlite3 db', {
dbFilename: module.dbFilename
});
});
......