mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-02-02 06:06:41 +01:00
Enable relative path hosting
This commit is contained in:
parent
a5865825da
commit
91419b3243
4 changed files with 6 additions and 5 deletions
|
@ -111,7 +111,7 @@ function App() {
|
||||||
if (code) {
|
if (code) {
|
||||||
console.log({ code });
|
console.log({ code });
|
||||||
// Clear the code from the URL
|
// 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 clientID = store.session.get('clientID');
|
||||||
const clientSecret = store.session.get('clientSecret');
|
const clientSecret = store.session.get('clientSecret');
|
||||||
|
|
|
@ -143,7 +143,7 @@ function Accounts({ onClose }) {
|
||||||
accounts.splice(i, 1);
|
accounts.splice(i, 1);
|
||||||
store.local.setJSON('accounts', accounts);
|
store.local.setJSON('accounts', accounts);
|
||||||
// location.reload();
|
// location.reload();
|
||||||
location.href = '/';
|
location.href = location.pathname || '/';
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<Icon icon="exit" />
|
<Icon icon="exit" />
|
||||||
|
|
|
@ -4,8 +4,8 @@ const { VITE_CLIENT_NAME: CLIENT_NAME, VITE_WEBSITE: WEBSITE } = import.meta
|
||||||
export async function registerApplication({ instanceURL }) {
|
export async function registerApplication({ instanceURL }) {
|
||||||
const registrationParams = new URLSearchParams({
|
const registrationParams = new URLSearchParams({
|
||||||
client_name: CLIENT_NAME,
|
client_name: CLIENT_NAME,
|
||||||
redirect_uris: location.origin,
|
|
||||||
scopes: 'read write follow',
|
scopes: 'read write follow',
|
||||||
|
redirect_uris: location.origin + location.pathname,
|
||||||
website: WEBSITE,
|
website: WEBSITE,
|
||||||
});
|
});
|
||||||
const registrationResponse = await fetch(
|
const registrationResponse = await fetch(
|
||||||
|
@ -27,7 +27,7 @@ export async function getAuthorizationURL({ instanceURL, client_id }) {
|
||||||
const authorizationParams = new URLSearchParams({
|
const authorizationParams = new URLSearchParams({
|
||||||
client_id,
|
client_id,
|
||||||
scope: 'read write follow',
|
scope: 'read write follow',
|
||||||
redirect_uri: location.origin,
|
redirect_uri: location.origin + location.pathname,
|
||||||
// redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
// redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||||
response_type: 'code',
|
response_type: 'code',
|
||||||
});
|
});
|
||||||
|
@ -44,7 +44,7 @@ export async function getAccessToken({
|
||||||
const params = new URLSearchParams({
|
const params = new URLSearchParams({
|
||||||
client_id,
|
client_id,
|
||||||
client_secret,
|
client_secret,
|
||||||
redirect_uri: location.origin,
|
redirect_uri: location.origin + location.pathname,
|
||||||
grant_type: 'authorization_code',
|
grant_type: 'authorization_code',
|
||||||
code,
|
code,
|
||||||
scope: 'read write follow',
|
scope: 'read write follow',
|
||||||
|
|
|
@ -25,6 +25,7 @@ const rollbarCode = fs.readFileSync(
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
base: './',
|
||||||
mode: NODE_ENV,
|
mode: NODE_ENV,
|
||||||
define: {
|
define: {
|
||||||
__BUILD_TIME__: JSON.stringify(now),
|
__BUILD_TIME__: JSON.stringify(now),
|
||||||
|
|
Loading…
Reference in a new issue