Skip to content
This repository was archived by the owner on Mar 19, 2021. It is now read-only.

Commit

Permalink
Switch to yarn berry and add method to list friends
Browse files Browse the repository at this point in the history
  • Loading branch information
seia-soto committed Feb 12, 2021
1 parent a06bedb commit e2c4f6e
Show file tree
Hide file tree
Showing 13 changed files with 1,943 additions and 1,349 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.vscode
profile.json

# Logs
Expand Down
55 changes: 55 additions & 0 deletions .yarn/releases/yarn-berry.cjs

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/bin/eslint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/bin/eslint.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/bin/eslint.js your application uses
module.exports = absRequire(`eslint/bin/eslint.js`);
20 changes: 20 additions & 0 deletions .yarn/sdks/eslint/lib/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env node

const {existsSync} = require(`fs`);
const {createRequire, createRequireFromPath} = require(`module`);
const {resolve} = require(`path`);

const relPnpApiPath = "../../../../.pnp.js";

const absPnpApiPath = resolve(__dirname, relPnpApiPath);
const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath);

if (existsSync(absPnpApiPath)) {
if (!process.versions.pnp) {
// Setup the environment to be able to require eslint/lib/api.js
require(absPnpApiPath).setup();
}
}

// Defer to the real eslint/lib/api.js your application uses
module.exports = absRequire(`eslint/lib/api.js`);
6 changes: 6 additions & 0 deletions .yarn/sdks/eslint/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "eslint",
"version": "7.19.0-pnpify",
"main": "./lib/api.js",
"type": "commonjs"
}
5 changes: 5 additions & 0 deletions .yarn/sdks/integrations.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file is automatically generated by PnPify.
# Manual changes will be lost!

integrations:
- vscode
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarnPath: ".yarn/releases/yarn-berry.cjs"
14 changes: 14 additions & 0 deletions example/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,30 @@ process.env.DEBUG = '*'
// eslint-disable-next-line
require = require('esm')(module)

const fs = require('fs')
const path = require('path')

const { Client, profiles } = require('../src')

const profile = {
...profiles.application.a297,
...profiles.locales.Korean
}
const profileLoc = path.join(__dirname, '../profile.json')

if (fs.existsSync(profileLoc)) {
const ctx = JSON.parse(fs.readFileSync(profileLoc))

profile.token = ctx.tokens.auth
profile.userId = ctx.user.user_id
profile.deviceId = ctx.deviceId
}

const app = new Client({ profile })

const start = async () => {
app.debug(await app.checkForUpdate())
app.debug(await app.getOnlineFriends())
}

start()
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "clubhouse-api",
"version": "1.0.4",
"version": "1.0.5",
"main": "src/index.js",
"author": "Seia-Soto <[email protected]>",
"license": "MIT",
Expand All @@ -12,6 +12,7 @@
"babel-eslint": "^10.1.0",
"eslint": "^7.19.0",
"eslint-config-standard": "^16.0.2",
"eslint-import-resolver-node": "^0.3.4",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^4.3.1"
Expand Down
16 changes: 12 additions & 4 deletions src/api/checkForUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,19 @@ import agent from '../structures/agent'
const checkForUpdate = async (profile, isTestFlight) => {
'use strict'

const response = await agent('/check_for_update', {
query: {
is_testflight: Number(!!isTestFlight)
const response = await agent(
'/check_for_update',
{
query: {
is_testflight: Number(!!isTestFlight)
}
},
{
...profile,
userId: '(null)',
token: undefined
}
}, profile)
)
const data = await response.json()

return data
Expand Down
4 changes: 2 additions & 2 deletions src/api/getOnlineFriend.js → src/api/getOnlineFriends.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import agent from '../structures/agent'

const getOnlineFriend = async profile => {
const getOnlineFriends = async profile => {
'use strict'

const response = await agent(
Expand All @@ -16,7 +16,7 @@ const getOnlineFriend = async profile => {
return data
}

export default getOnlineFriend
export default getOnlineFriends

export const specification = {
clubs: [
Expand Down
4 changes: 2 additions & 2 deletions src/api/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import checkForUpdate from './checkForUpdate'
import requestMobileAuth from './requestMobileAuth'
import completeMobileAuth from './completeMobileAuth'
import getOnlineFriend from './getOnlineFriend'
import getOnlineFriends from './getOnlineFriends'

export {
checkForUpdate,
requestMobileAuth,
completeMobileAuth,
getOnlineFriend
getOnlineFriends
}
Loading

0 comments on commit e2c4f6e

Please sign in to comment.