Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meteor 3.0 #115

Merged
merged 15 commits into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
bozhao:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
bozhao:[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
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