Plugin compatible with runtime changes to API KEY
Version bumped to 1.3.0. Backward compatible with environment variable. Updated instructions in the README.
This commit is contained in:
parent
4117f64e2e
commit
49ab10ab7f
31
README.md
31
README.md
|
@ -1,25 +1,36 @@
|
||||||
Discourse Steam Login
|
Discourse Steam Login
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
1. Add your STEAM WEB API KEY obtainable from [steamcommunity.com/dev/apikey](http://steamcommunity.com/dev/apikey). E.g. domain name: `forum.example.org`
|
1. SSH into your server and edit your Discourse Docker configuration file (e.g. `nano /var/discourse/containers/app.yml`) and make the following changes:
|
||||||
|
|
||||||
2. SSH into your server.
|
* Add a `git clone` of this repository to the plugin list under `hooks:` below the Discourse Docker Manager plugin like so: `- git clone https://github.com/defaye/discourse-steam-login.git`.
|
||||||
|
|
||||||
3. `cd /var/discourse`
|
|
||||||
|
|
||||||
4. Open `containers/app.yml` and make the following changes:
|
2. Check the [validity][4] of your file if you must. Then exit and save changes. (E.g. `ctrl + x, y, enter`)
|
||||||
|
|
||||||
1. Add the API key to your Discourse Docker configuration file located at `/var/discourse/containers/app.yml`. It needs to go under `env:` in the format ` STEAM_WEB_API_KEY: SOMEKEY`
|
3. Run the rebuild script to apply the changes (e.g. `/var/discourse/launcher rebuild app`).
|
||||||
|
|
||||||
2. Add the git clone of this plugin to the plugin list under `hooks:` below the Discourse Docker Manager plugin like so: `- git clone https://github.com/defaye/discourse-steam-login.git`
|
4. Acquire your STEAM WEB API KEY obtainable from [steamcommunity.com/dev/apikey](http://steamcommunity.com/dev/apikey) (example domain name: `forum.example.org`). Login to your *admin* account and go to: *Plugins* — *Steam authenticator* — and save your key in the `discourse steam login api key` field.
|
||||||
|
|
||||||
3. Exit and save changes
|
5. You're done! You should now be able to login via Steam. Please consider starring [my repository][1] if you use github. The more stars it receives, the more [TLC][3] and time I will spend in maintaining it.
|
||||||
|
|
||||||
5. Run `./launcher rebuild app` to apply the changes.
|
|
||||||
|
|
||||||
6. You're done! Please consider starring [my repository][1] if you use github. The more attention it gets, the more I will give back to it.
|
Bugs
|
||||||
|
----
|
||||||
|
|
||||||
|
Please ask well-formed, well-written questions at the [meta.discourse.org page][2]. If you think there is a bug, **prove it** in an issue *or do not open one*. This may come across as blunt but it really does need to be quite explicit or otherwise these instructions will be ignored and you will waste my time.
|
||||||
|
|
||||||
|
|
||||||
|
Troubleshooting
|
||||||
|
---------------
|
||||||
|
For backwards compatibility with versions `< 1.3.0`, the plugin will default to the environment variable `STEAM_WEB_API_KEY` if no key is found in the plugin's site setting.
|
||||||
|
|
||||||
|
If you are setting up discourse for the first time or are able to re-build the app, you can set the API KEY at runtime under `env:` section of your configuration file in the format ` STEAM_WEB_API_KEY: 'YOURKEY'`.
|
||||||
|
|
||||||
|
If you are not using docker and do not have access to admin (and have somehow managed to only permit Steam login (you are cool by the way)), you might be able to redeem the situation by setting the environment variable manually in your server (e.g `export STEAM__WEB_API_KEY=YOURKEY`).
|
||||||
|
|
||||||
7. Please ask well-formed, well-written questions at the [meta.discourse.org page][2]. If you think there is a bug, then go to some effort to prove it if you intend to open an issue, or I will not take you seriously.
|
|
||||||
|
|
||||||
[1]:https://github.com/defaye/discourse-steam-login
|
[1]:https://github.com/defaye/discourse-steam-login
|
||||||
[2]:https://meta.discourse.org/t/steam-login-authentication-plugin/18153
|
[2]:https://meta.discourse.org/t/steam-login-authentication-plugin/18153
|
||||||
|
[3]:https://en.wiktionary.org/wiki/tender_loving_care
|
||||||
|
[4]:http://www.yamllint.com/
|
||||||
|
|
|
@ -42,7 +42,7 @@ module OmniAuth
|
||||||
private
|
private
|
||||||
|
|
||||||
def raw_info
|
def raw_info
|
||||||
@raw_info ||= options.api_key ? MultiJson.decode(Net::HTTP.get(player_profile_uri)) : {}
|
@raw_info ||= options.api_key.call ? MultiJson.decode(Net::HTTP.get(player_profile_uri)) : {}
|
||||||
end
|
end
|
||||||
|
|
||||||
def player
|
def player
|
||||||
|
@ -54,11 +54,11 @@ module OmniAuth
|
||||||
end
|
end
|
||||||
|
|
||||||
def player_profile_uri
|
def player_profile_uri
|
||||||
URI.parse("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=#{options.api_key}&steamids=#{steam_id}")
|
URI.parse("http://api.steampowered.com/ISteamUser/GetPlayerSummaries/v0002/?key=#{options.api_key.call}&steamids=#{steam_id}")
|
||||||
end
|
end
|
||||||
|
|
||||||
def friend_list_url
|
def friend_list_url
|
||||||
URI.parse("http://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=#{options.api_key}&steamid=#{steam_id}&relationship=friend")
|
URI.parse("http://api.steampowered.com/ISteamUser/GetFriendList/v0001/?key=#{options.api_key.call}&steamid=#{steam_id}&relationship=friend")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# name: Steam authenticator
|
# name: Steam authenticator
|
||||||
# about: Authenticate with Discourse via Steam
|
# about: Authenticate with Discourse via Steam
|
||||||
# version: 1.2
|
# version: 1.3.0
|
||||||
# author: Jonathan de Faye
|
# author: Jonathan de Faye
|
||||||
# url: https://github.com/defaye/discourse-steam-login
|
# url: https://github.com/defaye/discourse-steam-login
|
||||||
|
|
||||||
|
@ -17,8 +17,8 @@ class SteamAuthenticator < ::Auth::Authenticator
|
||||||
end
|
end
|
||||||
|
|
||||||
def register_middleware(omniauth)
|
def register_middleware(omniauth)
|
||||||
omniauth.provider :steam, SiteSetting.discourse_steam_login_api_key.present? ?
|
omniauth.provider :steam, lambda { return SiteSetting.discourse_steam_login_api_key.present? ?
|
||||||
SiteSetting.discourse_steam_login_api_key : ENV['STEAM_WEB_API_KEY']
|
SiteSetting.discourse_steam_login_api_key : ENV['STEAM_WEB_API_KEY'] }
|
||||||
end
|
end
|
||||||
|
|
||||||
def after_create_account(user, auth)
|
def after_create_account(user, auth)
|
||||||
|
|
Loading…
Reference in New Issue