Revert "Specify base URL at <base> element"

This reverts commit f8844cb549.
This commit is contained in:
Pig Fang 2019-11-27 23:55:25 +08:00
parent c75f4429ac
commit 84afc32d84
27 changed files with 60 additions and 67 deletions

View File

@ -367,7 +367,7 @@ class AdminController extends Controller
'type' => 'a',
'class' => 'float-right',
'style' => 'warning',
'href' => $request->url().'?clear-cache',
'href' => '?clear-cache',
])
->addMessage(trans('options.cache.driver', ['driver' => config('cache.default')]), 'info');

View File

@ -98,7 +98,7 @@ export default {
}
},
avatarUrl(player) {
return `${document.baseURI}avatar/35/${player.tid_skin}`
return `${blessing.base_url}/avatar/35/${player.tid_skin}`
},
},
}

View File

@ -23,7 +23,7 @@
<div>
<img
class="captcha"
:src="`${baseUrl}auth/captcha?v=${time}`"
:src="`${baseUrl}/auth/captcha?v=${time}`"
alt="CAPTCHA"
:title="$t('auth.change-captcha')"
data-placement="top"
@ -45,7 +45,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {

View File

@ -72,10 +72,10 @@ export default {
},
computed: {
previewLink() {
return `${document.baseURI}preview/${this.tid}.png`
return `${blessing.base_url}/preview/${this.tid}.png`
},
linkToSkinlib() {
return `${document.baseURI}skinlib/show/${this.tid}`
return `${blessing.base_url}/skinlib/show/${this.tid}`
},
},
methods: {

View File

@ -55,10 +55,10 @@ export default {
},
computed: {
urlToDetail() {
return `${document.baseURI}skinlib/show/${this.tid}`
return `${blessing.base_url}/skinlib/show/${this.tid}`
},
urlToPreview() {
return `${document.baseURI}preview/${this.tid}.png`
return `${blessing.base_url}/preview/${this.tid}.png`
},
likeActionText() {
if (this.anonymous) {

View File

@ -8,11 +8,11 @@ const init: RequestInit = {
}
export async function checkForUpdates(): Promise<void> {
const response = await fetch(`${document.baseURI}admin/update/check`, init)
const response = await fetch(`${blessing.base_url}/admin/update/check`, init)
if (response.ok) {
const data = await response.json()
const el = document.querySelector(`[href="${document.baseURI}admin/update"] p`)
const el = document.querySelector(`[href="${blessing.base_url}/admin/update"] p`)
if (data.available && el) {
el.innerHTML += '<span class="right badge badge-primary">New</span>'
}
@ -20,11 +20,11 @@ export async function checkForUpdates(): Promise<void> {
}
export async function checkForPluginUpdates(): Promise<void> {
const response = await fetch(`${document.baseURI}admin/plugins/market/check`, init)
const response = await fetch(`${blessing.base_url}/admin/plugins/market/check`, init)
if (response.ok) {
const data = await response.json()
const el = document.querySelector(`[href="${document.baseURI}admin/plugins/market"] p`)
const el = document.querySelector(`[href="${blessing.base_url}/admin/plugins/market"] p`)
if (data.available && el) {
const length = data.plugins.length as number
el.innerHTML += `<span class="right badge badge-success">${length}</span>`

View File

@ -6,12 +6,12 @@ import $ from 'jquery'
// @ts-ignore
declare let __webpack_public_path__: string
const url = new URL(document.baseURI)
const url = new URL(blessing.base_url)
url.port = '8080'
__webpack_public_path__ = process.env.NODE_ENV === 'development'
? url.toString()
: `${document.baseURI}app/`
: `${blessing.base_url}/app/`
// @ts-ignore
window.$ = window.jQuery = $ // eslint-disable-line

View File

@ -12,7 +12,7 @@ export async function logout() {
}
const { message } = await post('/auth/logout')
setTimeout(() => (window.location.href = document.baseURI), 1000)
setTimeout(() => (window.location.href = blessing.base_url), 1000)
Message.success(message)
}

View File

@ -79,9 +79,7 @@ export function get(url: string, params = empty): Promise<any> {
const qs = queryStringify(params)
return walkFetch(
new Request(`${document.baseURI.slice(0, -1)}${url}${qs && `?${qs}`}`, init),
)
return walkFetch(new Request(`${blessing.base_url}${url}${qs && `?${qs}`}`, init))
}
function nonGet(method: string, url: string, data: any): Promise<any> {
@ -93,7 +91,7 @@ function nonGet(method: string, url: string, data: any): Promise<any> {
const isFormData = data instanceof FormData
const request = new Request(`${document.baseURI.slice(0, -1)}${url}`, {
const request = new Request(`${blessing.base_url}${url}`, {
body: isFormData ? data : JSON.stringify(data),
method: method.toUpperCase(),
...init,

View File

@ -22,7 +22,7 @@
</span>
<span v-else-if="props.column.field === 'uid'">
<a
:href="`${baseUrl}admin/users?uid=${props.row.uid}`"
:href="`${baseUrl}/admin/users?uid=${props.row.uid}`"
:title="$t('admin.inspectHisOwner')"
data-toggle="tooltip"
data-placement="right"
@ -34,15 +34,15 @@
<span v-else-if="props.column.field === 'preview'">
<a
v-if="props.row.tid_skin"
:href="`${baseUrl}skinlib/show/${props.row.tid_skin}`"
:href="`${baseUrl}/skinlib/show/${props.row.tid_skin}`"
>
<img :src="`${baseUrl}preview/64/${props.row.tid_skin}.png`" width="64">
<img :src="`${baseUrl}/preview/64/${props.row.tid_skin}.png`" width="64">
</a>
<a
v-if="props.row.tid_cape"
:href="`${baseUrl}skinlib/show/${props.row.tid_cape}`"
:href="`${baseUrl}/skinlib/show/${props.row.tid_cape}`"
>
<img :src="`${baseUrl}preview/64/${props.row.tid_cape}.png`" width="64">
<img :src="`${baseUrl}/preview/64/${props.row.tid_cape}.png`" width="64">
</a>
</span>
<span v-else-if="props.column.field === 'operations'">
@ -133,7 +133,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {

View File

@ -16,7 +16,7 @@
<a
v-t="'admin.configurePlugin'"
class="text-primary"
:href="`${baseUrl}admin/plugins/config/${props.row.name}`"
:href="`${baseUrl}/admin/plugins/config/${props.row.name}`"
/> |
</template>
<a
@ -94,7 +94,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {

View File

@ -16,7 +16,7 @@
<template #table-row="props">
<span v-if="props.column.field === 'tid'">
{{ props.formattedRow[props.column.field] }}
<a :href="`${baseUrl}skinlib/show/${props.row.tid}`">{{ $t('report.check') }}</a>
<a :href="`${baseUrl}/skinlib/show/${props.row.tid}`">{{ $t('report.check') }}</a>
<a href="#" @click="deleteTexture(props.row)">
{{ $t('report.delete') }}
</a>
@ -66,7 +66,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {

View File

@ -77,7 +77,7 @@ export default {
return
}
await this.$alert(this.$t('admin.updateCompleted'), { type: 'success' })
window.location = document.baseURI
window.location = blessing.base_url
},
async polling() {
const percentage = await this.$http.get(

View File

@ -113,7 +113,7 @@ export default {
}
},
playersLink(user) {
return `${document.baseURI}admin/players?uid=${user.uid}`
return `${blessing.base_url}/admin/players?uid=${user.uid}`
},
},
mixins: [

View File

@ -27,7 +27,7 @@
</div>
<div class="d-flex justify-content-between">
<a v-t="'auth.forgot.login-link'" :href="`${baseUrl}auth/login`" class="text-center" />
<a v-t="'auth.forgot.login-link'" :href="`${baseUrl}/auth/login`" class="text-center" />
<button
class="btn btn-primary"
type="submit"
@ -57,7 +57,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data: () => ({

View File

@ -42,7 +42,7 @@
{{ $t('auth.keep') }}
</label>
</div>
<a v-t="'auth.forgot-link'" :href="`${baseUrl}auth/forgot`" />
<a v-t="'auth.forgot-link'" :href="`${baseUrl}/auth/forgot`" />
</div>
<button
@ -73,7 +73,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {

View File

@ -101,7 +101,7 @@
</div>
<div class="d-flex justify-content-between mb-3">
<a v-t="'auth.login-link'" :href="`${baseUrl}auth/login`" class="text-center" />
<a v-t="'auth.login-link'" :href="`${baseUrl}/auth/login`" class="text-center" />
<div>
<button
class="btn btn-primary"
@ -133,7 +133,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data: () => ({
@ -171,7 +171,7 @@ export default {
if (code === 0) {
this.$message.success(message)
setTimeout(() => {
window.location = `${document.baseURI}user`
window.location = `${blessing.base_url}/user`
}, 1000)
} else {
this.infoMsg = ''

View File

@ -91,7 +91,7 @@ export default {
)
if (code === 0) {
this.$message.success(message)
window.location = `${document.baseURI}auth/login`
window.location = `${blessing.base_url}/auth/login`
} else {
this.infoMsg = ''
this.warningMsg = message

View File

@ -121,7 +121,7 @@
<td v-t="'skinlib.show.uploader'" />
<td v-if="uploaderNickName !== null">
<a
:href="`${baseUrl}skinlib?filter=${type === 'cape' ? 'cape' : 'skin'}&uploader=${uploader}`"
:href="`${baseUrl}/skinlib?filter=${type === 'cape' ? 'cape' : 'skin'}&uploader=${uploader}`"
>{{ uploaderNickName }}</a>
</td>
<td v-else><span v-t="'general.unexistent-user'" /></td>
@ -187,7 +187,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {
@ -220,7 +220,7 @@ export default {
return this.public ? 'skinlib.setAsPrivate' : 'skinlib.setAsPublic'
},
textureUrl() {
return `${this.baseUrl}textures/${this.hash}`
return `${this.baseUrl}/textures/${this.hash}`
},
},
beforeMount() {
@ -248,7 +248,7 @@ export default {
},
download() {
const a = document.createElement('a')
a.href = `${this.baseUrl}raw/${this.tid}.png`
a.href = `${this.baseUrl}/raw/${this.tid}.png`
a.download = `${this.name}.png`
const event = new MouseEvent('click')
a.dispatchEvent(event)
@ -345,7 +345,7 @@ export default {
)
if (code === 0) {
this.$message.success(message)
setTimeout(() => (window.location = `${this.baseUrl}skinlib`), 1000)
setTimeout(() => (window.location = `${this.baseUrl}/skinlib`), 1000)
} else {
this.$message.warning(message)
}

View File

@ -189,7 +189,7 @@ export default {
if (code === 0) {
this.$message.success(message)
setTimeout(() => {
window.location = `${document.baseURI}skinlib/show/${tid}`
window.location = `${blessing.base_url}/skinlib/show/${tid}`
}, 1000)
} else {
this.$message.error(message)

View File

@ -65,7 +65,7 @@ export default {
this.pending = false
if (code === 0) {
await this.$alert(message)
window.location.href = `${document.baseURI}user`
window.location.href = `${blessing.base_url}/user`
} else {
this.message = message
}

View File

@ -32,7 +32,7 @@
<li class="nav-item d-none d-md-block">
<a
v-t="'user.closet.upload'"
:href="`${baseUrl}skinlib/upload`"
:href="`${baseUrl}/skinlib/upload`"
class="nav-link"
/>
</li>
@ -195,7 +195,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data: () => ({
@ -212,8 +212,8 @@ export default {
model: 'steve',
selectedCape: 0,
capeUrl: '',
linkToSkin: `${document.baseURI}skinlib?filter=skin`,
linkToCape: `${document.baseURI}skinlib?filter=cape`,
linkToSkin: `${blessing.base_url}/skinlib?filter=skin`,
linkToCape: `${blessing.base_url}/skinlib?filter=cape`,
}),
created() {
this.search = debounce(this.loadCloset, 350)

View File

@ -82,10 +82,10 @@
<div id="preview-2d">
<p>
{{ $t('general.skin') }}
<a v-if="preview2d.skin" :href="`${baseUrl}skinlib/show/${preview2d.skin}`">
<a v-if="preview2d.skin" :href="`${baseUrl}/skinlib/show/${preview2d.skin}`">
<img
class="skin2d"
:src="`${baseUrl}preview/64/${preview2d.skin}.png`"
:src="`${baseUrl}/preview/64/${preview2d.skin}.png`"
>
</a>
<span v-else v-t="'user.player.texture-empty'" class="skin2d" />
@ -93,10 +93,10 @@
<p>
{{ $t('general.cape') }}
<a v-if="preview2d.cape" :href="`${baseUrl}skinlib/show/${preview2d.cape}`">
<a v-if="preview2d.cape" :href="`${baseUrl}/skinlib/show/${preview2d.cape}`">
<img
class="skin2d"
:src="`${baseUrl}preview/64/${preview2d.cape}.png`"
:src="`${baseUrl}/preview/64/${preview2d.cape}.png`"
>
</a>
<span v-else v-t="'user.player.texture-empty'" class="skin2d" />
@ -172,7 +172,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {
@ -214,7 +214,7 @@ export default {
if (player.tid_skin) {
const { data: skin } = await this.$http.get(`/skinlib/info/${player.tid_skin}`)
this.skinUrl = `${this.baseUrl}textures/${skin.hash}`
this.skinUrl = `${this.baseUrl}/textures/${skin.hash}`
this.model = skin.type
} else {
this.skinUrl = ''
@ -222,7 +222,7 @@ export default {
}
if (player.tid_cape) {
const { data: cape } = await this.$http.get(`/skinlib/info/${player.tid_cape}`)
this.capeUrl = `${this.baseUrl}textures/${cape.hash}`
this.capeUrl = `${this.baseUrl}/textures/${cape.hash}`
} else {
this.capeUrl = ''
}

View File

@ -265,7 +265,7 @@ export default {
)
if (code === 0) {
await this.$alert(message)
return (window.location = `${document.baseURI}auth/login`)
return (window.location = `${blessing.base_url}/auth/login`)
}
return this.$alert(message, { type: 'warning' })
},
@ -304,7 +304,7 @@ export default {
)
if (code === 0) {
await this.$message.success(message)
return (window.location = `${document.baseURI}auth/login`)
return (window.location = `${blessing.base_url}/auth/login`)
}
return this.$alert(message, { type: 'warning' })
},
@ -317,7 +317,7 @@ export default {
)
if (code === 0) {
await this.$alert(message, { type: 'success' })
window.location = `${document.baseURI}auth/login`
window.location = `${blessing.base_url}/auth/login`
} else {
return this.$alert(message, { type: 'warning' })
}

View File

@ -10,7 +10,7 @@
<template #table-row="props">
<span v-if="props.column.field === 'tid'">
{{ props.formattedRow[props.column.field] }}
<a :href="`${baseUrl}skinlib/show/${props.row.tid}`">
<a :href="`${baseUrl}/skinlib/show/${props.row.tid}`">
<i class="fa fa-share" />
</a>
</span>
@ -43,7 +43,7 @@ export default {
props: {
baseUrl: {
type: String,
default: document.baseURI,
default: blessing.base_url,
},
},
data() {

View File

@ -8,10 +8,6 @@ import {
Switch,
} from 'element-ui'
Object.defineProperty(document, 'baseURI', {
get: () => '/',
})
window.blessing = {
base_url: '',
site_name: 'Blessing Skin',

View File

@ -1,4 +1,3 @@
<base href="{{ url('/') }}">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">