Skip to content

Commit

Permalink
fix base_url
Browse files Browse the repository at this point in the history
  • Loading branch information
Tai7sy committed Jun 21, 2020
1 parent 2f8daa8 commit e4df82f
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 18 deletions.
19 changes: 11 additions & 8 deletions dist/index.php

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions php/composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "OneDriveFly",
"name": "tai7sy/onedrive-fly",
"description": "OneDrive index anywhere",
"license": "MIT",
"type": "project",
"require": {
"php": "^7.0.0",
"ext-json": "*",
"ext-curl": "*",
"classpreloader/classpreloader": "^4.0",
"classpreloader/console": "^3.0",
"classpreloader/classpreloader": "~4.0.1",
"classpreloader/console": "~3.0.1",
"doctrine/cache": "~1.6.2",
"symfony/http-foundation": "~3.3"
},
Expand All @@ -30,7 +30,7 @@
"post-root-package-install": [
"@php -r \"file_exists('config.php') || copy('config.example.php', 'config.php');\""
],
"post-autoload-dump": "php vendor/bin/classpreloader compile --config=scripts/preloader.php --output=../dist/vendor.php && php scripts/dist.php",
"post-autoload-dump": "classpreloader compile --config=scripts/preloader.php --output=../dist/vendor.php && php scripts/dist.php",
"build": "composer dump-autoload --optimize"
},
"repositories": {
Expand Down
12 changes: 6 additions & 6 deletions php/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,8 @@ function render($account, $path, $files)
.select-language{position:absolute;right:5px}
.title{text-align:center;margin:2rem 0;letter-spacing:2px}
.title a{color:#333;text-decoration:none}
.list-wrapper{width:80%;margin:0 auto 40px;position:relative;box-shadow:0 0 32px 0 rgba(0,0,0,.1)}
.list-container{position:relative;overflow:hidden;border-radius:15px}
.list-wrapper{width:80%;margin:0 auto 40px;position:relative;box-shadow: 0 0 12px 0 rgba(0,0,0,.1);}
.list-container{position:relative;overflow:hidden;border-radius:0}
.list-header-container{position:relative}
.list-header-container a.back-link{color:#000;display:inline-block;position:absolute;font-size:16px;margin:20px 10px;padding:10px 10px;vertical-align:middle;text-decoration:none}
.list-container,.list-header-container,.list-wrapper,a.back-link:hover,body{color:#24292e}
Expand Down Expand Up @@ -934,7 +934,7 @@ function loadResources(type,src,callback){var script=document.createElement(type
<?php } ?>
<ion-icon name="folder"></ion-icon>
<a id="filename_<?php echo $index; ?>"
href="<?php echo htmlspecialchars(path_format($path['relative'] . '/' . $file['name'] . '/')); ?>"><?php echo htmlspecialchars(urldecode($file['name'])); ?></a>
href="<?php echo htmlspecialchars(path_format($base_url . '/' . $path['relative'] . '/' . $file['name'] . '/')); ?>"><?php echo htmlspecialchars(urldecode($file['name'])); ?></a>
</td>
<td class="updated_at"><?php echo time_format($file['lastModifiedDateTime']); ?></td>
<td class="size"><?php echo size_format($file['size']); ?></td>
Expand Down Expand Up @@ -997,9 +997,9 @@ function loadResources(type,src,callback){var script=document.createElement(type
<?php } ?>
<a id="filename_<?php echo $index; ?>"
class="filename"
href="<?php echo htmlspecialchars(path_format($path['relative'] . '/' . $file['name'])); ?>?preview"
href="<?php echo htmlspecialchars(path_format($base_url . '/' . $path['relative'] . '/' . $file['name'])); ?>?preview"
target=_blank><?php echo htmlspecialchars(urldecode($file['name'])); ?></a>
<a href="<?php echo htmlspecialchars(path_format($path['relative'] . '/' . $file['name'])); ?>">
<a href="<?php echo htmlspecialchars(path_format($base_url . '/' . $path['relative'] . '/' . $file['name'])); ?>">
<ion-icon name="download"></ion-icon>
</a>
</td>
Expand Down Expand Up @@ -1254,7 +1254,7 @@ class="closeModel"><?php echo trans('Close'); ?></a>
<script type="text/javascript" src="//cdn.bootcss.com/spark-md5/3.0.0/spark-md5.min.js"></script>
<?php } ?>
<script type="text/javascript">
var root = '/';
var root = '<?php echo $base_url; ?>';

function path_format(path) {
path = '/' + path + '/';
Expand Down
9 changes: 9 additions & 0 deletions php/platforms/Normal/Normal.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@ public static function request()
{
if (!self::$request) {
self::$request = Request::createFromGlobals();
if(self::$request->get('s')){
$new_uri = self::$request->getBaseUrl() . self::$request->get('s');
if(!empty($_SERVER['UNENCODED_URL'])){
$_SERVER['UNENCODED_URL'] = $new_uri;
}else{
$_SERVER['REQUEST_URI'] = $new_uri;
}
self::$request = Request::createFromGlobals();
}
}
return self::$request;
}
Expand Down

0 comments on commit e4df82f

Please sign in to comment.