You've already forked AstralRinth
forked from didirus/AstralRinth
Oauth 2 Flow UI (#1440)
* adjust existing sign-in flow * test fetching of oauth client * allow for apiversion override * getAuthUrl refactor * Adjust auth to accept complex url redirections * introduce scopes * accept oauth flow * rename login/oauth to authorize * conform to labrinth spec and oauth2 spec * use cute icons for scope items * applications pages * Modal for copy client secret on creation * rip out old state * add authorizations * add flow error state and implement feedback * implement error notifications on error * Client secret modal flow aligned with PAT copy * Authorized scopes now aligned with Authorize screen * Fix spelling and capitalization * change redirect uris to include the input field * refactor 2fa flow to be more stable * visual adjustments for authorizations * Fix empty field submission bug * Add file upload for application icon * Change shape of editing/create application * replace icon with Avatar component * Refactor authorization card styling * UI feedback * clean up spacing, styling * Create a "Developer" section of user settings * Fix spacing and scope access * app description and url implementations * clean up imports * Update authorization endpoint * Update placeholder URL in applications.vue * Remove app information from authorization page * Remove max scopes from application settings * Fix import statement and update label styles * Replace useless headers * Update pages/auth/authorize.vue Co-authored-by: Calum H. <contact@mineblock11.dev> * Update pages/auth/authorize.vue Co-authored-by: Calum H. <contact@mineblock11.dev> * Finish PR --------- Co-authored-by: Calum H. <contact@mineblock11.dev> Co-authored-by: Jai A <jaiagr+gpg@pm.me>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
export const useBaseFetch = async (url, options = {}, skipAuth = false) => {
|
||||
const config = useRuntimeConfig()
|
||||
const base = process.server ? config.apiBaseUrl : config.public.apiBaseUrl
|
||||
let base = process.server ? config.apiBaseUrl : config.public.apiBaseUrl
|
||||
|
||||
if (!options.headers) {
|
||||
options.headers = {}
|
||||
@@ -16,5 +16,21 @@ export const useBaseFetch = async (url, options = {}, skipAuth = false) => {
|
||||
options.headers.Authorization = auth.value.token
|
||||
}
|
||||
|
||||
if (options.apiVersion || options.internal) {
|
||||
// Base may end in /vD/ or /vD. We would need to replace the digit with the new version number
|
||||
// and keep the trailing slash if it exists
|
||||
const baseVersion = base.match(/\/v\d\//)
|
||||
|
||||
const replaceStr = options.internal ? `/_internal/` : `/v${options.apiVersion}/`
|
||||
|
||||
if (baseVersion) {
|
||||
base = base.replace(baseVersion[0], replaceStr)
|
||||
} else {
|
||||
base = base.replace(/\/v\d$/, replaceStr)
|
||||
}
|
||||
|
||||
delete options.apiVersion
|
||||
}
|
||||
|
||||
return await $fetch(`${base}${url}`, options)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user