Skip to content

Commit

Permalink
Merge pull request #115 from Meteor-Community-Packages/release/3.0
Browse files Browse the repository at this point in the history
Meteor 3.0
  • Loading branch information
StorytellerCZ authored Jul 16, 2024
2 parents 4fb7c25 + 0ce638c commit abb940b
Show file tree
Hide file tree
Showing 11 changed files with 4,030 additions and 1,719 deletions.
9 changes: 9 additions & 0 deletions .all-contributorsrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@
"doc",
"maintenance"
]
},
{
"login": "jankapunkt",
"name": "Jan Küster",
"avatar_url": "https://avatars.githubusercontent.com/u/1135285?v=4",
"profile": "https://jankuester.com/",
"contributions": [
"maintenance"
]
}
],
"contributorsPerLine": 7
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
name: "Lint checking app"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '14'
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Run lint
Expand Down
116 changes: 59 additions & 57 deletions .versions
Original file line number Diff line number Diff line change
@@ -1,57 +1,59 @@
accounts-base@2.2.11
accounts-oauth@1.4.4
allow-deny@1.1.1
babel-compiler@7.10.5
babel-runtime@1.5.1
base64@1.0.12
binary-heap@1.0.11
boilerplate-generator@1.7.2
bozhao:link-accounts@2.9.0
callback-hook@1.5.1
check@1.4.1
ddp@1.4.1
ddp-client@2.6.2
ddp-common@1.4.1
ddp-rate-limiter@1.2.1
ddp-server@2.7.1
diff-sequence@1.1.2
dynamic-import@0.7.3
ecmascript@0.16.8
ecmascript-runtime@0.8.1
ecmascript-runtime-client@0.12.1
ecmascript-runtime-server@0.11.0
ejson@1.1.3
fetch@0.1.4
geojson-utils@1.0.11
id-map@1.1.1
inter-process-messaging@0.1.1
localstorage@1.2.0
logging@1.3.4
meteor@1.11.5
minimongo@1.9.4
modern-browsers@0.1.10
modules@0.20.0
modules-runtime@0.13.1
mongo@1.16.10
mongo-decimal@0.1.3
mongo-dev-server@1.1.0
mongo-id@1.0.8
npm-mongo@4.17.2
oauth@2.2.1
ordered-dict@1.1.0
promise@0.12.2
random@1.2.1
rate-limit@1.1.1
react-fast-refresh@0.2.8
reactive-var@1.0.12
reload@1.3.1
retry@1.1.0
routepolicy@1.1.1
service-configuration@1.3.4
socket-stream-client@0.5.2
tracker@1.3.3
typescript@4.9.5
underscore@1.6.1
url@1.3.2
webapp@1.13.8
webapp-hashing@1.1.1
accounts-base@3.0.0
accounts-oauth@1.4.5
allow-deny@2.0.0
babel-compiler@7.11.0
babel-runtime@1.5.2
base64@1.0.13
binary-heap@1.0.12
boilerplate-generator@2.0.0
bozhao:link-accounts@3.0.0
callback-hook@1.6.0
check@1.4.2
core-runtime@1.0.0
ddp@1.4.2
ddp-client@3.0.0
ddp-common@1.4.3
ddp-rate-limiter@1.2.2
ddp-server@3.0.0
diff-sequence@1.1.3
dynamic-import@0.7.4
ecmascript@0.16.9
ecmascript-runtime@0.8.2
ecmascript-runtime-client@0.12.2
ecmascript-runtime-server@0.11.1
ejson@1.1.4
facts-base@1.0.2
fetch@0.1.5
geojson-utils@1.0.12
id-map@1.2.0
inter-process-messaging@0.1.2
localstorage@1.2.1
logging@1.3.5
meteor@2.0.0
minimongo@2.0.0
modern-browsers@0.1.11
modules@0.20.1
modules-runtime@0.13.2
mongo@2.0.0
mongo-decimal@0.1.4-beta300.7
mongo-dev-server@1.1.1
mongo-id@1.0.9
npm-mongo@4.16.2
oauth@3.0.0
ordered-dict@1.2.0
promise@1.0.0
random@1.2.2
rate-limit@1.1.2
react-fast-refresh@0.2.9
reactive-var@1.0.13
reload@1.3.2
retry@1.1.1
routepolicy@1.1.2
service-configuration@1.3.5
socket-stream-client@0.5.3
tracker@1.3.4
typescript@5.4.3
underscore@1.6.4
url@1.3.3
webapp@2.0.0
webapp-hashing@1.1.2
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog


## v.3.0.0
* Removed deprecated providers
* Minimum support version is Meteor 3.0

## v. 2.9.0
* Added `storyteller:accounts-seznam`

Expand Down
28 changes: 24 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Called after user is unlinking the service. The hook will receive object with th
1. Piggyback on existing Meteor oauth login system. Use login handler.

2. We do not allow link different account from same service for now. For example, you
could not link with 2 different github accounts.
could not link with 2 different Github accounts.

3. Save the linked service info on user.services, instead of creating new field
on user object. This allow user logins the application from linked services.
on user object. This allows user logins the application from linked services.

4. Don't create a temporary user account and then merge it.

Expand All @@ -81,7 +81,7 @@ Called after user is unlinking the service. The hook will receive object with th
* mrt:accounts-vk
* mikepol:accounts-ok
* mikepol:accounts-mailru
* jonperl:accounts-linkedin (depracated) / pauli:linkedin-oauth
* pauli:linkedin-oauth
* garbolino:accounts-soundcloud
* alexbeauchemin:accounts-twitch
* nicolaiwadstrom:meteor-angellist
Expand All @@ -95,7 +95,27 @@ Called after user is unlinking the service. The hook will receive object with th
* lindoelio:accounts-office365 / ermlab:accounts-office365
* quave:accounts-apple / bigowl:accounts-apple
* freedombase:web3-login
* lichthagel:accounts-discord / storyteller:accounts-discord
* storyteller:accounts-discord

## License
MIT

## Contributors

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tbody>
<tr>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yubozhao"><img src="https://avatars1.githubusercontent.com/u/670949?s=460&v=4?s=100" width="100px;" alt="Yu Bozhao"/><br /><sub><b>Yu Bozhao</b></sub></a><br /><a href="https://github.com/Meteor-Community-Packages/template-package/commits?author=yubozhao" title="Code">💻</a> <a href="https://github.com/Meteor-Community-Packages/template-package/commits?author=yubozhao" title="Documentation">📖</a> <a href="#maintenance-yubozhao" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/StorytellerCZ"><img src="https://avatars2.githubusercontent.com/u/1715235?v=4?s=100" width="100px;" alt="Jan Dvorak"/><br /><sub><b>Jan Dvorak</b></sub></a><br /><a href="https://github.com/Meteor-Community-Packages/template-package/commits?author=StorytellerCZ" title="Code">💻</a> <a href="https://github.com/Meteor-Community-Packages/template-package/commits?author=StorytellerCZ" title="Documentation">📖</a> <a href="#maintenance-StorytellerCZ" title="Maintenance">🚧</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://jankuester.com/"><img src="https://avatars.githubusercontent.com/u/1135285?v=4?s=100" width="100px;" alt="Jan Küster"/><br /><sub><b>Jan Küster</b></sub></a><br /><a href="#maintenance-jankapunkt" title="Maintenance">🚧</a></td>
</tr>
</tbody>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->
12 changes: 3 additions & 9 deletions community-services/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,8 @@ Meteor.linkWithDiscord = function (options, callback) {
if (!Meteor.userId()) {
throw new Meteor.Error(402, 'Please login to an existing account before link.')
}
if (!Package['lichthagel:accounts-discord'] && !Package['storyteller:accounts-discord']) {
throw new Meteor.Error(403, 'Please include lichthagel:accounts-discord or storyteller:accounts-discord package')
}
// TODO deprecate lichthagel:accounts-discord as it has not been updated in years and is not ready for Meteor 3
if (Package['lichthagel:accounts-discord']) {
console.warn('lichthagel:accounts-discord has not been updated in years and has been deprecated in bozhao:link-accounts, please upgrade to storyteller:accounts-discord.')
if (!Package['storyteller:accounts-discord']) {
throw new Meteor.Error(403, 'Please include storyteller:accounts-discord package')
}

if (!callback && typeof options === 'function') {
Expand All @@ -19,9 +15,7 @@ Meteor.linkWithDiscord = function (options, callback) {
}

const credentialRequestCompleteCallback = Accounts.oauth.linkCredentialRequestCompleteHandler(callback)
if (Package['lichthagel:discord-oauth']) {
Package['lichthagel:discord-oauth'].Discord.requestCredential(options, credentialRequestCompleteCallback)
}

if (Package['storyteller:discord-oauth']) {
Package['storyteller:discord-oauth'].Discord.requestCredential(options, credentialRequestCompleteCallback)
}
Expand Down
11 changes: 0 additions & 11 deletions community-services/linkedin.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,6 @@ Meteor.linkWithLinkedIn = function (options, callback) {
throw new Meteor.Error(403, 'Please include pauli:linkedin-oauth package')
}

// Deprecation of jonperl:linkedin
if (Package['jonperl:linkedin']) {
console.warn('jonperl:linkedin has been deprecated in meteor linked accounts in favor of pauli:linkedin-oauth to keep up with linkedin api changes')
}
if (!Package['jonperl:linkedin'] && !Package['pauli:linkedin-oauth']) {
throw new Meteor.Error(403, 'Please include pauli:linkedin-oauth package')
}
// End of deprecation messages

if (!callback && typeof options === 'function') {
callback = options
options = null
Expand All @@ -27,7 +18,5 @@ Meteor.linkWithLinkedIn = function (options, callback) {
const credentialRequestCompleteCallback = Accounts.oauth.linkCredentialRequestCompleteHandler(callback)
if (Package['pauli:linkedin-oauth']) {
Package['pauli:linkedin-oauth'].Linkedin.requestCredential(options, credentialRequestCompleteCallback)
} else if (Package['jonperl:linkedin']) {
Package['jonperl:linkedin'].LinkedIn.requestCredential(options, credentialRequestCompleteCallback)
}
}
19 changes: 11 additions & 8 deletions link_accounts_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Accounts.registerLoginHandler(async function (options) {
credentialSecret: Match.OneOf(null, String)
})

const result = OAuth.retrieveCredential(
const result = await OAuth.retrieveCredential(
options.link.credentialToken,
options.link.credentialSecret
)
Expand Down Expand Up @@ -71,7 +71,7 @@ Meteor.methods({
},
'bozhao:linkAccountsWeb3': async function (address) {
check(address, String)
const user = Meteor.users.findOne({ 'services.web3.address': address })
const user = await Meteor.users.findOneAsync({ 'services.web3.address': address })
if (user) throw new Meteor.Error('500', 'This address is already assigned!')
return await Accounts.LinkUserFromExternalService(
'web3',
Expand Down Expand Up @@ -105,7 +105,7 @@ Accounts.LinkUserFromExternalService = async function (
throw new Meteor.Error("'id' missing from service data for: " + serviceName)
}

const user = Meteor.user()
const user = await Meteor.userAsync()

if (!user) {
return new Meteor.Error('User not found for LinkUserFromExternalService')
Expand Down Expand Up @@ -168,12 +168,14 @@ Accounts.LinkUserFromExternalService = async function (
}

// On link hook
Accounts._onLink.forEach((callback) => {
Accounts._onLink.forEachAsync(async (callback) => {
const user = await Meteor.userAsync()

// eslint-disable-next-line n/no-callback-literal
callback({
type: serviceName,
serviceData,
user: Meteor.user(),
user,
serviceOptions: options
})
return true
Expand All @@ -191,7 +193,7 @@ Accounts.unlinkService = async function (userId, serviceName, cb) {
if (typeof serviceName !== 'string') {
throw new Meteor.Error('Service name must be string')
}
const user = Meteor.users.findOne({ _id: userId })
const user = await Meteor.users.findOneAsync({ _id: userId })
if (serviceName === 'resume' || serviceName === 'password') {
throw new Meteor.Error(
'Internal services cannot be unlinked: ' + serviceName
Expand All @@ -211,9 +213,10 @@ Accounts.unlinkService = async function (userId, serviceName, cb) {
}
)
// On unlink hook
Accounts._onUnlink.forEach((callback) => {
Accounts._onUnlink.forEachAsync(async (callback) => {
const user = await Meteor.userAsync()
// eslint-disable-next-line n/no-callback-literal
callback({ type: serviceName, user: Meteor.user() })
callback({ type: serviceName, user })
return true
})
} else {
Expand Down
Loading

0 comments on commit abb940b

Please sign in to comment.