Enable relative path hosting

pull/223/head
Lim Chee Aun 2023-08-30 17:46:22 +08:00
rodzic a5865825da
commit 91419b3243
4 zmienionych plików z 6 dodań i 5 usunięć

Wyświetl plik

@ -111,7 +111,7 @@ function App() {
if (code) {
console.log({ code });
// Clear the code from the URL
window.history.replaceState({}, document.title, '/');
window.history.replaceState({}, document.title, location.pathname || '/');
const clientID = store.session.get('clientID');
const clientSecret = store.session.get('clientSecret');

Wyświetl plik

@ -143,7 +143,7 @@ function Accounts({ onClose }) {
accounts.splice(i, 1);
store.local.setJSON('accounts', accounts);
// location.reload();
location.href = '/';
location.href = location.pathname || '/';
}}
>
<Icon icon="exit" />

Wyświetl plik

@ -4,8 +4,8 @@ const { VITE_CLIENT_NAME: CLIENT_NAME, VITE_WEBSITE: WEBSITE } = import.meta
export async function registerApplication({ instanceURL }) {
const registrationParams = new URLSearchParams({
client_name: CLIENT_NAME,
redirect_uris: location.origin,
scopes: 'read write follow',
redirect_uris: location.origin + location.pathname,
website: WEBSITE,
});
const registrationResponse = await fetch(
@ -27,7 +27,7 @@ export async function getAuthorizationURL({ instanceURL, client_id }) {
const authorizationParams = new URLSearchParams({
client_id,
scope: 'read write follow',
redirect_uri: location.origin,
redirect_uri: location.origin + location.pathname,
// redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
response_type: 'code',
});
@ -44,7 +44,7 @@ export async function getAccessToken({
const params = new URLSearchParams({
client_id,
client_secret,
redirect_uri: location.origin,
redirect_uri: location.origin + location.pathname,
grant_type: 'authorization_code',
code,
scope: 'read write follow',

Wyświetl plik

@ -25,6 +25,7 @@ const rollbarCode = fs.readFileSync(
// https://vitejs.dev/config/
export default defineConfig({
base: './',
mode: NODE_ENV,
define: {
__BUILD_TIME__: JSON.stringify(now),