refs #53 Fix compile target
This commit is contained in:
parent
7dfa9e4704
commit
8cb14e0323
|
@ -1,5 +1,5 @@
|
|||
const readline = require('readline')
|
||||
const Mastodon = require( '../../lib/mastodon')
|
||||
const Mastodon = require('../../lib/src/mastodon')
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
|
@ -7,14 +7,19 @@ const rl = readline.createInterface({
|
|||
})
|
||||
|
||||
const SCOPES = 'read write follow'
|
||||
const BASE_URL = 'https://pleroma.io'
|
||||
const BASE_URL = 'https://mastodon.social'
|
||||
|
||||
let clientId
|
||||
let clientSecret
|
||||
|
||||
Mastodon.registerApp('Test App', {
|
||||
Mastodon.registerApp(
|
||||
'Test App',
|
||||
{
|
||||
scopes: SCOPES
|
||||
}, BASE_URL).then(appData => {
|
||||
},
|
||||
BASE_URL
|
||||
)
|
||||
.then(appData => {
|
||||
clientId = appData.clientId
|
||||
clientSecret = appData.clientSecret
|
||||
console.log('\nclient_id:')
|
||||
|
@ -30,7 +35,8 @@ Mastodon.registerApp('Test App', {
|
|||
rl.close()
|
||||
})
|
||||
})
|
||||
}).then(code => Mastodon.fetchAccessToken(clientId, clientSecret, code, BASE_URL))
|
||||
})
|
||||
.then(code => Mastodon.fetchAccessToken(clientId, clientSecret, code, BASE_URL))
|
||||
.then(tokenData => {
|
||||
console.log('\naccess_token:')
|
||||
console.log(tokenData.accessToken)
|
||||
|
@ -39,4 +45,3 @@ Mastodon.registerApp('Test App', {
|
|||
console.log()
|
||||
})
|
||||
.catch(err => console.error(err))
|
||||
|
||||
|
|
|
@ -1,16 +1,12 @@
|
|||
const Mastodon = require( '../../lib/mastodon')
|
||||
const Mastodon = require('../../lib/src/mastodon')
|
||||
|
||||
const BASE_URL = 'https://mstdn.jp'
|
||||
const BASE_URL = 'https://mastodon.social'
|
||||
|
||||
const access_token = '...'
|
||||
const access_token = process.env.MASTODON_ACCESS_TOKEN
|
||||
|
||||
const client = new Mastodon(
|
||||
access_token,
|
||||
BASE_URL + '/api/v1'
|
||||
)
|
||||
const client = new Mastodon(access_token, BASE_URL + '/api/v1')
|
||||
|
||||
client.get('/favourites')
|
||||
.then((res) => {
|
||||
client.get('/favourites').then(res => {
|
||||
console.log(res.headers)
|
||||
console.log(res.data)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// Please use this function after authorization.js
|
||||
// Now mastodon and pleroma don't have refersh token method.
|
||||
// So this example is failed.
|
||||
const Mastodon = require( '../../lib/mastodon')
|
||||
const Mastodon = require('../../lib/src/mastodon')
|
||||
|
||||
const BASE_URL = 'https://pleroma.io'
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Mastodon = require('../../lib/mastodon')
|
||||
const Mastodon = require('../../lib/src/mastodon')
|
||||
|
||||
const BASE_URL = 'https://mstdn.jp'
|
||||
const BASE_URL = 'https://mastodon.social'
|
||||
|
||||
const access_token = process.env.MASTODON_ACCESS_TOKEN
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
const Mastodon = require('../../lib/mastodon')
|
||||
const Mastodon = require('../../lib/src/mastodon')
|
||||
|
||||
const BASE_URL = 'https://mstdn.jp'
|
||||
const BASE_URL = 'https://mastodon.social'
|
||||
|
||||
const access_token = process.env.MASTODON_ACCESS_TOKEN
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const readline = require('readline')
|
||||
const Mastodon = require('../../lib/mastodon')
|
||||
const Mastodon = require('../../lib/src/mastodon')
|
||||
|
||||
const rl = readline.createInterface({
|
||||
input: process.stdin,
|
||||
|
@ -8,15 +8,13 @@ const rl = readline.createInterface({
|
|||
|
||||
const BASE_URL = 'https://mastodon.social'
|
||||
|
||||
const access_token = '...'
|
||||
const access_token = process.env.MASTODON_ACCESS_TOKEN
|
||||
|
||||
const client = new Mastodon(
|
||||
access_token,
|
||||
BASE_URL + '/api/v1'
|
||||
)
|
||||
const client = new Mastodon(access_token, BASE_URL + '/api/v1')
|
||||
new Promise(resolve => {
|
||||
rl.question('Toot: ', status => {
|
||||
client.post('/statuses', {
|
||||
client
|
||||
.post('/statuses', {
|
||||
status: status
|
||||
})
|
||||
.then(res => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
const Mastodon = require('../../lib/mastodon')
|
||||
const Mastodon = require('../../lib/src/mastodon')
|
||||
|
||||
const BASE_URL = 'wss://pleroma.io'
|
||||
|
||||
|
|
|
@ -1,16 +1,18 @@
|
|||
import Mastodon, { Status, Response } from 'megalodon'
|
||||
|
||||
const BASE_URL: string = 'https://mstdn.jp'
|
||||
declare var process: {
|
||||
env: {
|
||||
MASTODON_ACCESS_TOKEN: string
|
||||
}
|
||||
}
|
||||
|
||||
const access_token: string = '...'
|
||||
const BASE_URL: string = 'https://mastodon.social'
|
||||
|
||||
const client = new Mastodon(
|
||||
access_token,
|
||||
BASE_URL + '/api/v1'
|
||||
)
|
||||
const access_token: string = process.env.MASTODON_ACCESS_TOKEN
|
||||
|
||||
client.get<[Status]>('/favourites')
|
||||
.then((res: Response<[Status]>) => {
|
||||
const client = new Mastodon(access_token, BASE_URL + '/api/v1')
|
||||
|
||||
client.get<[Status]>('/favourites').then((res: Response<[Status]>) => {
|
||||
console.log(res.headers)
|
||||
console.log(res.data)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import Mastodon, { Instance } from 'megalodon'
|
||||
|
||||
const BASE_URL: string = 'http://mstdn.jp'
|
||||
const BASE_URL: string = 'http://mastodon.social'
|
||||
|
||||
Mastodon.get<Instance>('/api/v1/instance', {}, BASE_URL).then(res => {
|
||||
console.log(res)
|
||||
|
|
|
@ -1,13 +1,16 @@
|
|||
import Mastodon, { Status, Notification, StreamListener } from 'megalodon'
|
||||
|
||||
declare var process: {
|
||||
env: {
|
||||
MASTODON_ACCESS_TOKEN: string
|
||||
}
|
||||
}
|
||||
|
||||
const BASE_URL: string = 'https://mastodon.social'
|
||||
|
||||
const access_token: string = '...'
|
||||
const access_token: string = process.env.MASTODON_ACCESS_TOKEN
|
||||
|
||||
const client = new Mastodon(
|
||||
access_token,
|
||||
BASE_URL + '/api/v1'
|
||||
)
|
||||
const client = new Mastodon(access_token, BASE_URL + '/api/v1')
|
||||
|
||||
const stream: StreamListener = client.stream('/streaming/public')
|
||||
stream.on('connect', _ => {
|
||||
|
|
|
@ -1,8 +1,14 @@
|
|||
import Mastodon, { Status, Response } from 'megalodon'
|
||||
|
||||
declare var process: {
|
||||
env: {
|
||||
MASTODON_ACCESS_TOKEN: string
|
||||
}
|
||||
}
|
||||
|
||||
const BASE_URL: string = 'https://mastodon.social'
|
||||
|
||||
const access_token: string = '...'
|
||||
const access_token: string = process.env.MASTODON_ACCESS_TOKEN
|
||||
|
||||
const client = new Mastodon(access_token, BASE_URL + '/api/v1')
|
||||
|
||||
|
|
|
@ -6,17 +6,15 @@ const rl: readline.ReadLine = readline.createInterface({
|
|||
output: process.stdout
|
||||
})
|
||||
|
||||
const BASE_URL: string = 'https://mastodon.social'
|
||||
const BASE_URL: string = 'https://pleroma.io'
|
||||
|
||||
const access_token: string = '...'
|
||||
const access_token: string = process.env.PLEROMA_ACCESS_TOKEN as string
|
||||
|
||||
const client = new Mastodon(
|
||||
access_token,
|
||||
BASE_URL + '/api/v1'
|
||||
)
|
||||
const client = new Mastodon(access_token, BASE_URL + '/api/v1')
|
||||
new Promise(resolve => {
|
||||
rl.question('Toot: ', status => {
|
||||
client.post<Status>('/statuses', {
|
||||
client
|
||||
.post<Status>('/statuses', {
|
||||
status: status
|
||||
})
|
||||
.then((res: Response<Status>) => {
|
||||
|
|
|
@ -2,12 +2,11 @@ import Mastodon, { Status, Notification, WebSocket } from 'megalodon'
|
|||
|
||||
declare var process: {
|
||||
env: {
|
||||
PLEROMA_HOST: string
|
||||
PLEROMA_ACCESS_TOKEN: string
|
||||
}
|
||||
}
|
||||
|
||||
const BASE_URL: string = process.env.PLEROMA_HOST
|
||||
const BASE_URL: string = 'wss://pleroma.io'
|
||||
|
||||
const access_token: string = process.env.PLEROMA_ACCESS_TOKEN
|
||||
|
||||
|
|
|
@ -282,7 +282,7 @@ jsprim@^1.2.2:
|
|||
verror "1.10.0"
|
||||
|
||||
"megalodon@file:../..":
|
||||
version "0.8.2"
|
||||
version "0.9.0"
|
||||
dependencies:
|
||||
"@types/oauth" "^0.9.0"
|
||||
"@types/request" "^2.47.0"
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
"name": "megalodon",
|
||||
"version": "0.9.0",
|
||||
"description": "Mastodon API client for node.js",
|
||||
"main": "./lib/index.js",
|
||||
"typings": "./lib/index.d.ts",
|
||||
"main": "./lib/src/index.js",
|
||||
"typings": "./lib/src/index.d.ts",
|
||||
"scripts": {
|
||||
"build": "tsc -p ./",
|
||||
"lint": "eslint --ext .js,.ts src",
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
"rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
"removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
|
@ -59,6 +59,6 @@
|
|||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"include": ["src/*", "test/*"],
|
||||
"include": ["./src", "./test"],
|
||||
"exclude": ["node_modules", "example"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue