Skip to content

Commit

Permalink
Add user agent to request
Browse files Browse the repository at this point in the history
  • Loading branch information
StorytellerCZ committed Aug 12, 2023
1 parent 9e1599d commit 23eb947
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
4 changes: 4 additions & 0 deletions accounts-line/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# Changelog
## 1.3.1 - 2023-08-12
* Updated dependencies on other packages
* Fix `notice.ts` reference in package settings

## 1.3.0 - 2022-12-21
* Typescript re-write
* Add `zodern:types` for type support
Expand Down
11 changes: 6 additions & 5 deletions accounts-line/package.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
/* global Package */
Package.describe({
name: 'storyteller:accounts-line',
summary: 'Login service for LINE accounts',
version: '1.3.0',
version: '1.3.1',
git: 'https://github.com/StorytellerCZ/meteor-accounts-line'
});

Package.onUse(api => {
api.versionsFrom('2.3');
api.versionsFrom('2.3.6');
api.use(['ecmascript', 'typescript']);
api.use('zodern:types@1.0.9')
api.use('accounts-base', ['client', 'server']);
// Export Accounts (etc) to packages using this one.
api.imply('accounts-base', ['client', 'server']);
api.use('accounts-oauth', ['client', 'server']);
api.use('storyteller:line-oauth@1.2.2');
api.imply('storyteller:line-oauth@1.2.2');
api.use('storyteller:line-oauth@1.4.0');
api.imply('storyteller:line-oauth@1.4.0');

// If users use accounts-ui but not facebook-config-ui, give them a tip.
api.use(['accounts-ui', 'storyteller:line-config-ui@1.1.2'], ['client', 'server'], { weak: true });
api.use(['accounts-ui', 'storyteller:line-config-ui@1.2.0'], ['client', 'server'], { weak: true });
api.addFiles('notice.ts');

api.addFiles('line.ts');
Expand Down
3 changes: 2 additions & 1 deletion line-config-ui/package.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global Package */
Package.describe({
name: 'storyteller:line-config-ui',
summary: 'Blaze configuration templates for LINE OAuth.',
Expand All @@ -6,7 +7,7 @@ Package.describe({
});

Package.onUse(api => {
api.versionsFrom('2.3');
api.versionsFrom('2.3.6');
api.use('zodern:types@1.0.9', 'server')
api.use(['ecmascript', 'typescript'], 'client');
api.use('templating@1.4.2', 'client');
Expand Down
3 changes: 3 additions & 0 deletions line-oauth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Changelog
## 1.4.0 - 2023-08-12
* Added Meteor user agent to request

## 1.3.2 - 2022-12-21
* Improve access token function to be more like Meteor's implementation

Expand Down
6 changes: 6 additions & 0 deletions line-oauth/line_server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { fetch } from 'meteor/fetch'
import { URLSearchParams } from 'meteor/url'
import { ServiceConfiguration } from 'meteor/service-configuration'
import { OAuth } from 'meteor/oauth'
import { Meteor } from 'meteor/meteor'

const jsonwebtoken = Npm.require('jsonwebtoken')
Line = {}
Expand Down Expand Up @@ -29,6 +30,10 @@ OAuth.registerService('line', 2, null, async (query) => {
return data
})

let userAgent = "Meteor"
if (Meteor.release)
userAgent += '/${Meteor.release}'

const getAccessToken = async (query) => {
const config = await ServiceConfiguration.configurations.findOneAsync({
service: 'line'
Expand All @@ -45,6 +50,7 @@ const getAccessToken = async (query) => {
method: 'POST',
headers: {
Accept: 'application/json',
"User-Agent": userAgent,
'Content-Type': 'application/x-www-form-urlencoded'
},
body: content,
Expand Down
3 changes: 2 additions & 1 deletion line-oauth/package.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* global Package */
Package.describe({
name: 'storyteller:line-oauth',
summary: 'LINE OAuth flow',
version: '1.3.2',
version: '1.4.0',
git: 'https://github.com/StorytellerCZ/meteor-accounts-line'
});

Expand Down

0 comments on commit 23eb947

Please sign in to comment.