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AItE,EAAOsE,IAE1B,IAAIJ,EAASF,EAAKhE,OAAOnB,aAAY,IAAKwF,EAAIE,KAAK,KACnDC,OAAOC,SAAS3B,KAAOoB,CACzB,GAGF,EAACpE,CAAA,CAxN+B,CAAS4E,KCRtBC,EAAc,SAAAC,GAAA,SAAAD,IAAA,OAAAC,EAAApG,MAAA,KAAAL,YAAA,KAAAT,EAAAiH,EAAAC,GAAA,IAAArE,EAAAoE,EAAA/H,UAUhC,OAVgC2D,EACjCC,OAAA,SAAOC,GACLmE,EAAAhI,UAAM4D,OAAM1D,KAAC,KAAA2D,GACbY,KAAKwD,SAAS7D,EAAEC,MAAMC,MAAM,YAC9B,EAACX,EACDuE,QAAA,WACE,OACE9D,EAAA,OAAK4B,UAAU,kBAGnB,EAAC+B,CAAA,CAVgC,CAASI,KCK5CpE,IAAAA,aAAiBd,IAAI,8BAA8B,WACjDc,IAAAA,OAAW,mBAAqB,CAC9BqE,KAAM,mBACNC,UAAWnF,GAGba,IAAAA,OAAW,mBAAqB,CAC9BqE,KAAM,0BACNC,UAAWN,IAEbO,EAAAA,EAAAA,QAAOH,IAAAA,UAAoB,YAAY,SAAUI,GAC3CxE,IAAAA,QAAYC,OAAQD,IAAAA,QAAYC,KAAK2C,KAASlC,KAAKT,KAAK2C,KAe9D,GACF,G","sources":["webpack://@foskym/flarum-oauth-center/webpack/bootstrap","webpack://@foskym/flarum-oauth-center/webpack/runtime/compat get default export","webpack://@foskym/flarum-oauth-center/webpack/runtime/define property getters","webpack://@foskym/flarum-oauth-center/webpack/runtime/hasOwnProperty shorthand","webpack://@foskym/flarum-oauth-center/webpack/runtime/make namespace object","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/extenders']\"","webpack://@foskym/flarum-oauth-center/./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","webpack://@foskym/flarum-oauth-center/./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/Model']\"","webpack://@foskym/flarum-oauth-center/./src/common/models/Client.js","webpack://@foskym/flarum-oauth-center/./src/common/models/Scope.js","webpack://@foskym/flarum-oauth-center/./src/common/extend.js","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['forum/app']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/extend']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['forum/components/UserPage']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/components/LinkButton']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/components/Page']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['forum/components/IndexPage']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['forum/components/LogInModal']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/utils/extractText']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/components/Tooltip']\"","webpack://@foskym/flarum-oauth-center/external root \"flarum.core.compat['common/components/Button']\"","webpack://@foskym/flarum-oauth-center/./src/forum/components/oauth/AuthorizePage.js","webpack://@foskym/flarum-oauth-center/./src/forum/components/user/AuthorizedPage.js","webpack://@foskym/flarum-oauth-center/./src/forum/index.js"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extenders'];","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n return _setPrototypeOf(o, p);\n}","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/Model'];","import Model from 'flarum/common/Model';\n\nexport default class Client extends Model {\n client_id = Model.attribute('client_id');\n client_secret = Model.attribute('client_secret');\n redirect_uri = Model.attribute('redirect_uri');\n grant_types = Model.attribute('grant_types');\n scope = Model.attribute('scope');\n user_id = Model.attribute('user_id');\n client_name = Model.attribute('client_name');\n client_icon = Model.attribute('client_icon');\n client_desc = Model.attribute('client_desc');\n client_home = Model.attribute('client_home');\n}\n","import Model from 'flarum/common/Model';\n\nexport default class Scope extends Model {\n scope = Model.attribute('scope');\n resource_path = Model.attribute('resource_path');\n method = Model.attribute('method');\n is_default = Model.attribute('is_default');\n scope_name = Model.attribute('scope_name');\n scope_icon = Model.attribute('scope_icon');\n scope_desc = Model.attribute('scope_desc');\n}\n","import Extend from 'flarum/common/extenders';\nimport Client from \"./models/Client\";\nimport Scope from \"./models/Scope\";\n\nexport default [\n new Extend.Store()\n .add('oauth-clients', Client)\n .add('oauth-scopes', Scope),\n];\n","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/app'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/extend'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/UserPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/LinkButton'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Page'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/IndexPage'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['forum/components/LogInModal'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/utils/extractText'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Tooltip'];","const __WEBPACK_NAMESPACE_OBJECT__ = flarum.core.compat['common/components/Button'];","import app from 'flarum/forum/app';\nimport {extend} from 'flarum/common/extend';\nimport Page from 'flarum/common/components/Page';\nimport IndexPage from 'flarum/forum/components/IndexPage';\nimport LogInModal from 'flarum/forum/components/LogInModal';\nimport extractText from 'flarum/common/utils/extractText';\nimport Tooltip from 'flarum/common/components/Tooltip';\nimport Button from 'flarum/common/components/Button';\n\nexport default class AuthorizePage extends IndexPage {\n params = [];\n client = null;\n scopes = null;\n client_scope = [];\n loading = true;\n is_authorized = false;\n submit_loading = false;\n\n oninit(vnode) {\n super.oninit(vnode);\n if (!app.session.user) {\n setTimeout(() => app.modal.show(LogInModal), 500);\n }\n\n const params = m.route.param();\n\n if (params.client_id == null || params.response_type == null || params.redirect_uri == null) {\n m.route.set('/');\n } else {\n this.params = params;\n app.store.find('oauth-clients', params.client_id).then(client => {\n if (client.length === 0) {\n m.route.set('/');\n } else {\n this.client = client[0];\n let uris = null;\n if (this.client.redirect_uri().indexOf(' ') > -1) {\n uris = this.client.redirect_uri().split(' ');\n } else {\n uris = [this.client.redirect_uri()];\n }\n\n if (app.forum.attribute('foskym-oauth-center.require_exact_redirect_uri') && uris.indexOf(params.redirect_uri) == -1) {\n m.route.set('/');\n }\n if (app.forum.attribute('foskym-oauth-center.allow_implicit') && params.response_type == 'token') {\n m.route.set('/');\n }\n if (app.forum.attribute('foskym-oauth-center.enforce_state') && params.enforce_state == null) {\n m.route.set('/');\n }\n\n app.store.find('oauth-scopes').then((scopes) => {\n this.scopes = scopes\n let scope = params.scope;\n\n if (params.scope == null) {\n scope = this.client.scope();\n }\n\n let scopes_temp = [];\n if (scope == null) {\n scopes_temp = [];\n } else if (scope.indexOf(' ') > -1) {\n scopes_temp = scope.split(' ');\n } else {\n scopes_temp = [scope];\n }\n\n let default_scopes = [];\n this.scopes.map(scope => {\n let index = scopes_temp.indexOf(scope.scope());\n if (index > -1) {\n scopes_temp[index] = scope;\n } else {\n scopes_temp.slice(index, 1);\n }\n if (scope.is_default() === 1) {\n default_scopes.push(scope);\n }\n });\n\n scopes_temp = scopes_temp.concat(default_scopes);\n\n this.client_scope = scopes_temp.filter((scope, index) => scopes_temp.indexOf(scope) === index);\n console.log(this.client_scope);\n this.loading = false;\n m.redraw();\n });\n\n\n }\n });\n }\n }\n\n setTitle() {\n app.setTitle(extractText(app.translator.trans('foskym-oauth-center.forum.page.title.authorize')));\n app.setTitleCount(0);\n }\n\n view() {\n if (!this.client) {\n return '';\n }\n return (\n !this.loading && <div className=\"AuthorizePage\">\n <div className=\"container\">\n <div class=\"oauth-area\">\n <div class=\"oauth-main\">\n <div class=\"oauth-box oauth-header\">\n <h2>{app.forum.attribute('title')}</h2>\n <p>\n {app.translator.trans('foskym-oauth-center.forum.authorize.access')} <a\n href={this.client.client_home()} target=\"_blank\">{this.client.client_name()}</a>\n </p>\n\n </div>\n <div class=\"oauth-box oauth-body\">\n\n <div class=\"oauth-top\">\n <img src={app.forum.attribute('faviconUrl')}/>\n <i class=\"fas fa-exchange-alt fa-2x\"></i>\n <Tooltip text={this.client.client_desc()}>\n <img src={this.client.client_icon()}/>\n </Tooltip>\n </div>\n <div class=\"oauth-scope-area\">\n {\n this.client_scope.length > 0 && this.client_scope.map(scope => {\n let scope_info = null;\n this.scopes.map(s => {\n if (s.scope() === scope.scope()) {\n scope_info = s;\n }\n });\n if (scope_info == null) {\n return '';\n }\n return (\n <div class=\"oauth-scope\">\n <div class=\"oauth-scope-left\">\n {\n (scope_info.scope_icon().indexOf('fa-') > -1) ?\n <i class={\"oauth-scope-object fa-2x \" + scope_info.scope_icon()}\n style=\"margin-left:2px;color:#000\"></i> :\n <img class=\"oauth-scope-object\" src={scope_info.scope_icon()} style=\"width:32px\"/>\n }\n </div>\n <div class=\"oauth-scope-body\">\n <h6 class=\"oauth-scope-heading\">\n {scope_info.scope_name()}\n </h6>\n <small>\n {\n scope_info.scope_desc()\n .replace('{client_name}', this.client.client_name())\n .replace('{user}', app.session.user.attribute('displayName'))\n }\n </small>\n </div>\n </div>\n );\n })\n }\n </div>\n <form class=\"oauth-form\" method=\"post\" id=\"form\" onsubmit={this.onsubmit.bind(this)}>\n {/* <input type=\"hidden\" name=\"response_type\" value={this.params.response_type}/>\n <input type=\"hidden\" name=\"client_id\" value={this.params.client_id}/>\n <input type=\"hidden\" name=\"redirect_uri\"\n value={this.params.redirect_uri}/>\n <input type=\"hidden\" name=\"state\" value={this.params.state}/>\n <input type=\"hidden\" name=\"scope\" value={this.params.scope}/>*/}\n <input type=\"hidden\" name=\"is_authorized\" value={this.is_authorized}/>\n <div style=\"display: flex; margin-top: 15px\" class=\"oauth-form-item\">\n <Button className=\"Button\" type=\"submit\" style=\"width: 50%;\" onclick={this.deny.bind(this)}\n loading={this.submit_loading}>\n {app.translator.trans('foskym-oauth-center.forum.authorize.deny')}\n </Button>\n <Button className=\"Button Button--primary\" type=\"submit\" style=\"width: 50%;\"\n onclick={this.agree.bind(this)} loading={this.submit_loading}>\n {app.translator.trans('foskym-oauth-center.forum.authorize.agree')}\n </Button>\n </div>\n </form>\n\n\n </div>\n </div>\n </div>\n </div>\n </div>\n );\n }\n deny(e) {\n this.is_authorized = false;\n }\n agree(e) {\n this.is_authorized = true;\n }\n\n onsubmit(e) {\n e.preventDefault();\n this.submit_loading = true;\n app.request({\n method: 'POST',\n url: '/oauth/authorize',\n body: {\n response_type: this.params.response_type,\n client_id: this.params.client_id,\n redirect_uri: this.params.redirect_uri,\n state: this.params.state,\n scope: this.params.scope,\n is_authorized: this.is_authorized,\n }\n }).then((params) => {\n let arr = []\n for (let k in params) {\n arr.push(`${k}=${params[k]}`)\n }\n let url = `${this.params.redirect_uri }?${arr.join('&')}`;\n window.location.href = url;\n });\n\n // Some form handling logic here\n }\n}\n","import UserPage from 'flarum/forum/components/UserPage';\nexport default class AuthorizedPage extends UserPage {\n oninit(vnode) {\n super.oninit(vnode);\n this.loadUser(m.route.param('username'));\n }\n content() {\n return (\n <div className=\"AuthorizedPage\">\n </div>\n );\n }\n}\n","import app from 'flarum/forum/app';\nimport {extend} from 'flarum/common/extend';\nimport UserPage from 'flarum/forum/components/UserPage';\nimport LinkButton from 'flarum/common/components/LinkButton';\nimport AuthorizePage from \"./components/oauth/AuthorizePage\";\nimport AuthorizedPage from \"./components/user/AuthorizedPage\";\napp.initializers.add('foskym/flarum-oauth-center', () => {\n app.routes['oauth.authorize'] = {\n path: '/oauth/authorize',\n component: AuthorizePage\n };\n\n app.routes['user.authorized'] = {\n path: '/u/:username/authorized',\n component: AuthorizedPage\n };\n extend(UserPage.prototype, 'navItems', function (items) {\n if (app.session.user && app.session.user.id() === this.user.id()) {\n // items.add(\n // 'authorized',\n // LinkButton.component(\n // {\n // href: app.route('user.authorized', { username: this.user.username() }),\n // icon: 'fas fa-user-friends',\n // },\n // [\n // app.translator.trans('foskym-oauth-center.forum.page.label.authorized'),\n // ]\n // ),\n // -110\n // );\n }\n });\n});\n"],"names":["__webpack_require__","module","getter","__esModule","d","a","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","flarum","core","compat","_setPrototypeOf","p","setPrototypeOf","bind","__proto__","_inheritsLoose","subClass","superClass","create","constructor","Client","_Model","_this","_len","arguments","length","args","Array","_key","apply","concat","client_id","Model","client_secret","redirect_uri","grant_types","scope","user_id","client_name","client_icon","client_desc","client_home","Scope","resource_path","method","is_default","scope_name","scope_icon","scope_desc","Extend","add","AuthorizePage","_IndexPage","params","client","scopes","client_scope","loading","is_authorized","submit_loading","_proto","oninit","vnode","_this2","app","user","setTimeout","show","LogInModal","m","route","param","response_type","set","this","find","then","uris","indexOf","split","attribute","enforce_state","scopes_temp","default_scopes","map","index","slice","push","filter","console","log","redraw","setTitle","extractText","trans","view","_this3","className","class","href","target","src","Tooltip","text","scope_info","s","style","replace","id","onsubmit","type","name","Button","onclick","deny","agree","e","_this4","preventDefault","url","body","state","arr","k","join","window","location","IndexPage","AuthorizedPage","_UserPage","loadUser","content","UserPage","path","component","extend","items"],"sourceRoot":""}