🌻👗 Updated with Glitch
parent
0d2f38af37
commit
011a02a41a
|
@ -1,4 +0,0 @@
|
|||
<?php $configs = '
|
||||
{
|
||||
}
|
||||
';
|
|
@ -0,0 +1,19 @@
|
|||
{"name":"Gemshin32x.ico","date":"2021-09-10T10:04:04.786Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2FGemshin32x.ico","type":"image/x-icon","size":2238,"imageWidth":32,"imageHeight":64,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2FGemshin32x.ico","thumbnailWidth":32,"thumbnailHeight":64,"uuid":"fRzDhp94hES3VGD4"}
|
||||
{"name":"favicon.ico","date":"2021-09-10T10:05:16.106Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","type":"image/x-icon","size":2238,"imageWidth":32,"imageHeight":64,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","thumbnailWidth":32,"thumbnailHeight":64,"uuid":"AeiSowroVduBYoev"}
|
||||
{"name":"favicon.ic","date":"2021-09-10T10:07:01.165Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ic","type":"","size":2238,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Fthumbnails%2Ffavicon.ic","thumbnailWidth":210,"thumbnailHeight":210,"uuid":"2f6d8stm44ljLxmu"}
|
||||
{"uuid":"2f6d8stm44ljLxmu","deleted":true}
|
||||
{"uuid":"fRzDhp94hES3VGD4","deleted":true}
|
||||
{"uuid":"AeiSowroVduBYoev","deleted":true}
|
||||
{"name":"favicon.ic","date":"2021-09-10T10:07:24.661Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ic","type":"","size":2238,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Fthumbnails%2Ffavicon.ic","thumbnailWidth":210,"thumbnailHeight":210,"uuid":"1wKtA5ek8KRDHeCm"}
|
||||
{"uuid":"1wKtA5ek8KRDHeCm","deleted":true}
|
||||
{"name":"favicon.ic","date":"2021-09-10T10:07:50.198Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ic","type":"","size":2238,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Fthumbnails%2Ffavicon.ic","thumbnailWidth":210,"thumbnailHeight":210,"uuid":"KkqYCrT5h2qV6R4u"}
|
||||
{"uuid":"KkqYCrT5h2qV6R4u","deleted":true}
|
||||
{"name":"favicon.ico","date":"2021-09-10T10:08:50.241Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","type":"image/x-icon","size":2238,"imageWidth":32,"imageHeight":64,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","thumbnailWidth":32,"thumbnailHeight":64,"uuid":"Tbxpmpsd7iogHrA8"}
|
||||
{"uuid":"Tbxpmpsd7iogHrA8","deleted":true}
|
||||
{"name":"favicon.ico","date":"2021-09-10T10:09:25.141Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","type":"image/x-icon","size":2238,"imageWidth":32,"imageHeight":64,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","thumbnailWidth":32,"thumbnailHeight":64,"uuid":"pfqKpyi43K8B7f07"}
|
||||
{"name":"favicon.php","date":"2021-09-10T10:10:12.455Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.php","type":"","size":2238,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Fthumbnails%2Ffavicon.php","thumbnailWidth":210,"thumbnailHeight":210,"uuid":"2jJTl6baTINMDRkK"}
|
||||
{"uuid":"2jJTl6baTINMDRkK","deleted":true}
|
||||
{"uuid":"pfqKpyi43K8B7f07","deleted":true}
|
||||
{"name":"favicon.ico","date":"2021-09-10T11:56:17.862Z","url":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","type":"image/x-icon","size":2238,"imageWidth":32,"imageHeight":64,"thumbnail":"https://cdn.glitch.com/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","thumbnailWidth":32,"thumbnailHeight":64,"uuid":"byl6zxO9h4QOFt0N"}
|
||||
{"uuid":"byl6zxO9h4QOFt0N","deleted":true}
|
||||
{"name":"favicon.ico","date":"2021-10-29T14:15:08.384Z","url":"https://cdn.glitch.me/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","type":"image/x-icon","size":4286,"imageWidth":32,"imageHeight":32,"thumbnail":"https://cdn.glitch.me/56780e99-9afe-4d79-9ff3-93d5eed7f45c%2Ffavicon.ico","thumbnailWidth":32,"thumbnailHeight":32,"uuid":"kYbWeyFwMyK10fT0"}
|
|
@ -1,113 +0,0 @@
|
|||
|
||||
// Hosts Array
|
||||
// 服务器数组
|
||||
const H = [
|
||||
'https://herooneindex.herokuapp.com/',
|
||||
'https://onemanager.glitch.me/',
|
||||
'https://onemanager-php.vercel.app/'
|
||||
]
|
||||
|
||||
// View Type
|
||||
// 1 , only first host,
|
||||
// 只第一条Host记录有用
|
||||
// 2 , view top 2 host as odd/even days,
|
||||
// 只有前两条记录有效,分别单双日运行
|
||||
// 3 , view random host
|
||||
// 所有记录随机访问
|
||||
const T = 1
|
||||
|
||||
// CF proxy all, true/false
|
||||
// 一切给CF代理,true或false
|
||||
const CFproxy = true
|
||||
|
||||
// Used in cloudflare workers
|
||||
// // // // // //
|
||||
|
||||
addEventListener('fetch', event => {
|
||||
let url=new URL(event.request.url);
|
||||
if (url.protocol == 'http:') {
|
||||
// force HTTPS
|
||||
url.protocol = 'https:'
|
||||
event.respondWith( Response.redirect(url.href) )
|
||||
} else {
|
||||
let host = null;
|
||||
if (T===1) {
|
||||
host = H[0];
|
||||
}
|
||||
if (T===2) {
|
||||
host = H[new Date().getDate()%2];
|
||||
}
|
||||
if (T===3) {
|
||||
let n = H.length;
|
||||
host = H[Math.round(Math.random()*n*10)%n];
|
||||
}
|
||||
//console.log(host)
|
||||
if (host.substr(0, 7)!='http://'&&host.substr(0, 8)!='https://') host = 'http://' + host;
|
||||
|
||||
let response = fetchAndApply(host, event.request);
|
||||
|
||||
event.respondWith( response );
|
||||
}
|
||||
})
|
||||
|
||||
async function fetchAndApply(host, request) {
|
||||
let f_url = new URL(request.url);
|
||||
let a_url = new URL(host);
|
||||
let replace_path = a_url.pathname;
|
||||
if (replace_path.substr(replace_path.length-1)!='/') replace_path += '/';
|
||||
let replaced_path = '/';
|
||||
let query = f_url.search;
|
||||
let path = f_url.pathname;
|
||||
if (host.substr(host.length-1)=='/') path = path.substr(1);
|
||||
f_url.href = host + path + query;
|
||||
|
||||
let response = null;
|
||||
if (!CFproxy) {
|
||||
response = await fetch(f_url, request);
|
||||
} else {
|
||||
let method = request.method;
|
||||
let body = request.body;
|
||||
let request_headers = request.headers;
|
||||
let new_request_headers = new Headers(request_headers);
|
||||
new_request_headers.set('Host', f_url.host);
|
||||
new_request_headers.set('Referer', request.url);
|
||||
response = await fetch(f_url.href, {
|
||||
/*cf: {
|
||||
cacheEverything: true,
|
||||
cacheTtl: 1000,
|
||||
mirage: true,
|
||||
polish: "on",
|
||||
minify: {
|
||||
javascript: true,
|
||||
css: true,
|
||||
html: true,
|
||||
}
|
||||
},*/
|
||||
method: method,
|
||||
body: body,
|
||||
headers: new_request_headers
|
||||
});
|
||||
}
|
||||
|
||||
let out_headers = new Headers(response.headers);
|
||||
if (out_headers.get('Content-Disposition')=='attachment') out_headers.delete('Content-Disposition');
|
||||
let out_body = null;
|
||||
let contentType = out_headers.get('Content-Type');
|
||||
if (contentType.includes("application/text")) {
|
||||
out_body = await response.text();
|
||||
while (replace_path!='/'&&out_body.includes(replace_path)) out_body = out_body.replace(replace_path, replaced_path);
|
||||
} else if (contentType.includes("text/html")) {
|
||||
//f_url.href +
|
||||
out_body = await response.text();
|
||||
while (replace_path!='/'&&out_body.includes(replace_path)) out_body = out_body.replace(replace_path, replaced_path);
|
||||
} else {
|
||||
out_body = await response.body;
|
||||
}
|
||||
|
||||
let out_response = new Response(out_body, {
|
||||
status: response.status,
|
||||
headers: out_headers
|
||||
})
|
||||
|
||||
return out_response;
|
||||
}
|
|
@ -0,0 +1,674 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
state the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
download page of MCGenshin
|
||||
Copyright (C) 2021 null
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program does terminal interaction, make it output a short
|
||||
notice like this when it starts in an interactive mode:
|
||||
|
||||
mcgenshindl Copyright (C) 2021 null
|
||||
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, your program's commands
|
||||
might be different; for a GUI interface, you would use an "about box".
|
||||
|
||||
You should also get your employer (if you work as a programmer) or school,
|
||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||
For more information on this, and how to apply and follow the GNU GPL, see
|
||||
<https://www.gnu.org/licenses/>.
|
||||
|
||||
The GNU General Public License does not permit incorporating your program
|
||||
into proprietary programs. If your program is a subroutine library, you
|
||||
may consider it more useful to permit linking proprietary applications with
|
||||
the library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License. But first, please read
|
||||
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
14
app.json
14
app.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "OneManager",
|
||||
"description": "Deploy OneManager to heroku",
|
||||
"website": "https://github.com/qkqpttgf/OneManager-php",
|
||||
"repository": "https://github.com/qkqpttgf/OneManager-php",
|
||||
"success_url": "/"
|
||||
}
|
||||
{
|
||||
"name": "OneManager",
|
||||
"description": "Deploy OneManager to heroku",
|
||||
"website": "https://github.com/qkqpttgf/OneManager-php",
|
||||
"repository": "https://github.com/qkqpttgf/OneManager-php",
|
||||
"success_url": "/"
|
||||
}
|
||||
|
|
5752
common.php
5752
common.php
File diff suppressed because it is too large
Load Diff
1738
disk/Aliyundrive.php
1738
disk/Aliyundrive.php
File diff suppressed because it is too large
Load Diff
2128
disk/Onedrive.php
2128
disk/Onedrive.php
File diff suppressed because it is too large
Load Diff
|
@ -1,26 +1,26 @@
|
|||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class OnedriveCN extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
|
||||
$this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
|
||||
}
|
||||
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
|
||||
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/me/drive/root';
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class OnedriveCN extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
|
||||
$this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
|
||||
}
|
||||
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
|
||||
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/me/drive/root';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,67 +1,67 @@
|
|||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class Sharelink extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
$this->api_url = getConfig('shareapiurl', $tag);
|
||||
$res = $this->get_access_token(1);
|
||||
//$this->ext_api_url = '/me/drive/root';
|
||||
$this->DownurlStrName = '@content.downloadUrl';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'shareurl' ];
|
||||
}
|
||||
|
||||
protected function get_access_token($refresh_token) {
|
||||
if (!($this->access_token = getcache('access_token', $this->disktag))) {
|
||||
$shareurl = getConfig('shareurl', $this->disktag);
|
||||
if (!($this->sharecookie = getcache('sharecookie', $this->disktag))) {
|
||||
$res = curl('GET', $shareurl, '', [], 1);
|
||||
error_log1(json_encode($res, JSON_PRETTY_PRINT));
|
||||
if (isset($res['returnhead']['Set-Cookie'])) $this->sharecookie = $res['returnhead']['Set-Cookie'];
|
||||
if (isset($res['returnhead']['set-cookie'])) $this->sharecookie = $res['returnhead']['set-cookie'];
|
||||
if ($this->sharecookie=='') {
|
||||
$this->error = $res;
|
||||
return false;
|
||||
}
|
||||
savecache('sharecookie', $this->sharecookie, $this->disktag);
|
||||
}
|
||||
$tmp1 = splitlast($shareurl, '/')[0];
|
||||
$account = splitlast($tmp1, '/')[1];
|
||||
$domain = splitlast($shareurl, '/:')[0];
|
||||
$response = curl('POST',
|
||||
$domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE",
|
||||
'{"parameters":{"__metadata":{"type":"SP.RenderListDataParameters"},"RenderOptions":136967,"AllowMultipleValueFilterForTaxonomyFields":true,"AddRequiredFields":true}}',
|
||||
[ 'Accept' => 'application/json;odata=verbose', 'Content-Type' => 'application/json;odata=verbose', 'origin' => $domain, 'Cookie' => $this->sharecookie ]
|
||||
);
|
||||
if ($response['stat']==200) $ret = json_decode($response['body'], true);
|
||||
$this->access_token = splitlast($ret['ListSchema']['.driveAccessToken'],'=')[1];
|
||||
$this->api_url = $ret['ListSchema']['.driveUrl'].'/root';
|
||||
if (!$this->access_token) {
|
||||
error_log1($domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE");
|
||||
error_log1('failed to get share access_token. response' . json_encode($ret));
|
||||
//$response['body'] = json_encode(json_decode($response['body']), JSON_PRETTY_PRINT);
|
||||
$response['body'] .= '<br>' .json_decode($response['body'], true)['error']['message']['value'];
|
||||
$response['body'] .= '<br>failed to get shareurl access_token.';
|
||||
$this->error = $response;
|
||||
return false;
|
||||
//throw new Exception($response['stat'].', failed to get share access_token.'.$response['body']);
|
||||
}
|
||||
//$tmp = $ret;
|
||||
//$tmp['access_token'] = '******';
|
||||
//error_log1('['.$this->disktag.'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
savecache('access_token', $this->access_token, $this->disktag);
|
||||
$tmp1 = null;
|
||||
if (getConfig('shareapiurl', $this->disktag)!=$this->api_url) $tmp1['shareapiurl'] = $this->api_url;
|
||||
//if (getConfig('sharecookie', $this->disktag)!=$this->sharecookie) $tmp1['sharecookie'] = $this->sharecookie;
|
||||
if (!!$tmp1) setConfig($tmp1, $this->disktag);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class Sharelink extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
$this->api_url = getConfig('shareapiurl', $tag);
|
||||
$res = $this->get_access_token(1);
|
||||
//$this->ext_api_url = '/me/drive/root';
|
||||
$this->DownurlStrName = '@content.downloadUrl';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'shareurl' ];
|
||||
}
|
||||
|
||||
protected function get_access_token($refresh_token) {
|
||||
if (!($this->access_token = getcache('access_token', $this->disktag))) {
|
||||
$shareurl = getConfig('shareurl', $this->disktag);
|
||||
if (!($this->sharecookie = getcache('sharecookie', $this->disktag))) {
|
||||
$res = curl('GET', $shareurl, '', [], 1);
|
||||
error_log1(json_encode($res, JSON_PRETTY_PRINT));
|
||||
if (isset($res['returnhead']['Set-Cookie'])) $this->sharecookie = $res['returnhead']['Set-Cookie'];
|
||||
if (isset($res['returnhead']['set-cookie'])) $this->sharecookie = $res['returnhead']['set-cookie'];
|
||||
if ($this->sharecookie=='') {
|
||||
$this->error = $res;
|
||||
return false;
|
||||
}
|
||||
savecache('sharecookie', $this->sharecookie, $this->disktag);
|
||||
}
|
||||
$tmp1 = splitlast($shareurl, '/')[0];
|
||||
$account = splitlast($tmp1, '/')[1];
|
||||
$domain = splitlast($shareurl, '/:')[0];
|
||||
$response = curl('POST',
|
||||
$domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE",
|
||||
'{"parameters":{"__metadata":{"type":"SP.RenderListDataParameters"},"RenderOptions":136967,"AllowMultipleValueFilterForTaxonomyFields":true,"AddRequiredFields":true}}',
|
||||
[ 'Accept' => 'application/json;odata=verbose', 'Content-Type' => 'application/json;odata=verbose', 'origin' => $domain, 'Cookie' => $this->sharecookie ]
|
||||
);
|
||||
if ($response['stat']==200) $ret = json_decode($response['body'], true);
|
||||
$this->access_token = splitlast($ret['ListSchema']['.driveAccessToken'],'=')[1];
|
||||
$this->api_url = $ret['ListSchema']['.driveUrl'].'/root';
|
||||
if (!$this->access_token) {
|
||||
error_log1($domain . "/personal/" . $account . "/_api/web/GetListUsingPath(DecodedUrl=@a1)/RenderListDataAsStream?@a1='" . urlencode("/personal/" . $account . "/Documents") . "'&RootFolder=" . urlencode("/personal/" . $account . "/Documents/") . "&TryNewExperienceSingle=TRUE");
|
||||
error_log1('failed to get share access_token. response' . json_encode($ret));
|
||||
//$response['body'] = json_encode(json_decode($response['body']), JSON_PRETTY_PRINT);
|
||||
$response['body'] .= '<br>' .json_decode($response['body'], true)['error']['message']['value'];
|
||||
$response['body'] .= '<br>failed to get shareurl access_token.';
|
||||
$this->error = $response;
|
||||
return false;
|
||||
//throw new Exception($response['stat'].', failed to get share access_token.'.$response['body']);
|
||||
}
|
||||
//$tmp = $ret;
|
||||
//$tmp['access_token'] = '******';
|
||||
//error_log1('['.$this->disktag.'] Get access token:'.json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
savecache('access_token', $this->access_token, $this->disktag);
|
||||
$tmp1 = null;
|
||||
if (getConfig('shareapiurl', $this->disktag)!=$this->api_url) $tmp1['shareapiurl'] = $this->api_url;
|
||||
//if (getConfig('sharecookie', $this->disktag)!=$this->sharecookie) $tmp1['sharecookie'] = $this->sharecookie;
|
||||
if (!!$tmp1) setConfig($tmp1, $this->disktag);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class Sharepoint extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '734ef928-d74c-4555-8d1b-d942fa0a1a41';
|
||||
$this->client_secret = '_I5gOpmG5vTC2Ts_K._wCW4nN1km~4Pk52';
|
||||
}
|
||||
$this->oauth_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://graph.microsoft.com/v1.0';
|
||||
$this->scope = 'https://graph.microsoft.com/Files.ReadWrite.All https://graph.microsoft.com/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'sharepointSite', 'siteid' ];
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class Sharepoint extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '734ef928-d74c-4555-8d1b-d942fa0a1a41';
|
||||
$this->client_secret = '_I5gOpmG5vTC2Ts_K._wCW4nN1km~4Pk52';
|
||||
}
|
||||
$this->oauth_url = 'https://login.microsoftonline.com/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://graph.microsoft.com/v1.0';
|
||||
$this->scope = 'https://graph.microsoft.com/Files.ReadWrite.All https://graph.microsoft.com/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'sharepointSite', 'siteid' ];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class SharepointCN extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
|
||||
$this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
|
||||
}
|
||||
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
|
||||
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'sharepointSite', 'siteid' ];
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (!class_exists('Onedrive')) require 'Onedrive.php';
|
||||
|
||||
class SharepointCN extends Onedrive {
|
||||
|
||||
function __construct($tag) {
|
||||
$this->disktag = $tag;
|
||||
$this->redirect_uri = 'https://scfonedrive.github.io';
|
||||
if (getConfig('client_id', $tag) && getConfig('client_secret', $tag)) {
|
||||
$this->client_id = getConfig('client_id', $tag);
|
||||
$this->client_secret = getConfig('client_secret', $tag);
|
||||
} else {
|
||||
$this->client_id = '31f3bed5-b9d9-4173-86a4-72c73d278617';
|
||||
$this->client_secret = 'P5-ZNtFK-tT90J.We_-DcsuB8uV7AfjL8Y';
|
||||
}
|
||||
$this->oauth_url = 'https://login.partner.microsoftonline.cn/common/oauth2/v2.0/';
|
||||
$this->api_url = 'https://microsoftgraph.chinacloudapi.cn/v1.0';
|
||||
$this->scope = 'https://microsoftgraph.chinacloudapi.cn/Files.ReadWrite.All https://microsoftgraph.chinacloudapi.cn/Sites.ReadWrite.All offline_access';
|
||||
$res = $this->get_access_token(getConfig('refresh_token', $tag));
|
||||
|
||||
$this->client_secret = urlencode($this->client_secret);
|
||||
$this->scope = urlencode($this->scope);
|
||||
$this->DownurlStrName = '@microsoft.graph.downloadUrl';
|
||||
$this->ext_api_url = '/sites/' . getConfig('siteid', $tag) . '/drive/root';
|
||||
}
|
||||
|
||||
public function ext_show_innerenv()
|
||||
{
|
||||
return [ 'sharepointSite', 'siteid' ];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ error_reporting(0);
|
|||
include 'vendor/autoload.php';
|
||||
include 'conststr.php';
|
||||
include 'common.php';
|
||||
|
||||
header("Strict-Transport-Security: max-age=63072000; includeSubdomains; preload");
|
||||
//echo '<pre>'. json_encode($_SERVER, JSON_PRETTY_PRINT).'</pre>';
|
||||
//echo '<pre>'. json_encode($_ENV, JSON_PRETTY_PRINT).'</pre>';
|
||||
if (isset($_SERVER['USER'])&&$_SERVER['USER']==='qcloud') {
|
||||
|
@ -108,7 +108,7 @@ function handler($event, $context)
|
|||
|
||||
$re = main($path);
|
||||
|
||||
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['isBase64Encoded']?base64_decode($re['body']):$re['body']);
|
||||
return new RingCentral\Psr7\Response($re['statusCode'], $re['headers'], $re['body']);
|
||||
|
||||
} elseif ($_SERVER['_APP_SHARE_DIR']=='/var/share/CFF/processrouter') {
|
||||
// Huawei FG
|
||||
|
|
|
@ -37,23 +37,14 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['region'] = $context['region'];
|
||||
$_SERVER['service_name'] = $context['service']['name'];
|
||||
$_SERVER['function_name'] = $context['function']['name'];
|
||||
//$path = str_replace('%5D', ']', str_replace('%5B', '[', $event['path']));//%5B
|
||||
//$path = $event['path'];
|
||||
$path = $event['requestURI'];
|
||||
if (strpos($path, '?')) $path = substr($path, 0, strpos($path, '?'));
|
||||
$tmp = urldecode($event['requestURI']);
|
||||
$path = $event['path'];
|
||||
$tmp = $event['requestURI'];
|
||||
if (strpos($tmp, '?')) $tmp = substr($tmp, 0, strpos($tmp, '?'));
|
||||
if ($path=='/'||$path=='') {
|
||||
$_SERVER['base_path'] = $tmp;
|
||||
} else {
|
||||
$tmp = str_replace('&', '&', $tmp);
|
||||
while ($tmp!=urldecode($tmp)) $tmp = urldecode($tmp);
|
||||
$tmp1 = urldecode($event['path']);
|
||||
while ($tmp1!=urldecode($tmp1)) $tmp1 = urldecode($tmp1);
|
||||
$_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($tmp1)+1);
|
||||
//$_SERVER['base_path'] = substr($tmp, 0, strlen(urldecode($event['path'])));
|
||||
$_SERVER['base_path'] = substr($tmp, 0, strlen($tmp)-strlen($path)+1);
|
||||
}
|
||||
$_SERVER['base_path'] = spurlencode($_SERVER['base_path'], '/');
|
||||
|
||||
if (substr($path,-1)=='/') $path=substr($path,0,-1);
|
||||
$_SERVER['is_guestup_path'] = is_guestup_path($path);
|
||||
|
@ -69,10 +60,8 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['REQUEST_SCHEME'] = $event['headers']['X-Forwarded-Proto'][0];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'][0])[2];
|
||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'][0];
|
||||
$_SERVER['FC_SERVER_PATH'] = '/var/fc/runtime/php7.2';
|
||||
return $path;
|
||||
//return spurlencode($path, '/');
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
|
|
|
@ -50,7 +50,6 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['Referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['If-Modified-Since'];
|
||||
$_SERVER['BCE_CFC_RUNTIME_NAME'] = 'php7';
|
||||
return $path;
|
||||
}
|
||||
|
|
|
@ -1,360 +1,360 @@
|
|||
<?php
|
||||
// https://devcenter.heroku.com/articles/platform-api-reference#build-create
|
||||
|
||||
function getpath()
|
||||
{
|
||||
if (getConfig('function_name') && getConfig('APIKey')) {
|
||||
$APIKey = getConfig('APIKey');
|
||||
$res = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('function_name'), '', $APIKey);
|
||||
$response = json_decode($res['body'], true);
|
||||
if (isset($response['build_stack'])) {
|
||||
$tmp['HerokuappId'] = $response['id'];
|
||||
$tmp['function_name'] = null;
|
||||
} else {
|
||||
error_log1('Something error' . 'Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT));
|
||||
//return message('Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT), 'Something error', 500);
|
||||
}
|
||||
$response = json_decode(setHerokuConfig($tmp, $tmp['HerokuappId'], $APIKey)['body'], true);
|
||||
$title = 'Change function_name to HerokuappId';
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$stat = 500;
|
||||
error_log1('Change function_name to HerokuappId' . $html);
|
||||
} else {
|
||||
$html = getconstStr('Wait') . ' 5s, jump to index.
|
||||
<meta http-equiv="refresh" content="5;URL=/">';
|
||||
$stat = 201;
|
||||
}
|
||||
//return message($html, $title, $stat);
|
||||
}
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
||||
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
$_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_X_FORWARDED_PROTO'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
$_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
|
||||
else $path = $_SERVER['REQUEST_URI'];
|
||||
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
|
||||
return substr($path, 1);
|
||||
//return spurlencode($path, '/');
|
||||
}
|
||||
|
||||
function getGET()
|
||||
{
|
||||
//error_log1('POST:' . json_encode($_POST));
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
//error_log1('RAW:' . $tmpdata);
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
//error_log1('PHPINPUT:' . $tmpdata);
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
foreach ($postbody as $postvalues) {
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
//error_log1('POSTformPHPINPUT:' . json_encode($_POST));
|
||||
}
|
||||
}
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) {
|
||||
$getstr = substr($_SERVER['REQUEST_URI'], $p+1);
|
||||
$getstrarr = explode("&",$getstr);
|
||||
foreach ($getstrarr as $getvalues) {
|
||||
if ($getvalues != '') {
|
||||
$pos = strpos($getvalues, "=");
|
||||
//echo $pos;
|
||||
if ($pos > 0) {
|
||||
$getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
|
||||
} else {
|
||||
$getarry[urldecode($getvalues)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($getarry)) {
|
||||
return $getarry;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$env = json_decode(getenv($disktag), true);
|
||||
if (isset($env[$str])) {
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (isBase64Env($str)) return base64y_decode(getenv($str));
|
||||
else return getenv($str);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
if ($disktag!='') $diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tmp[$newtag] = getConfig($v);
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = null;
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = null;
|
||||
}
|
||||
}
|
||||
foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
|
||||
|
||||
return setHerokuConfig($tmp, getConfig('HerokuappId'), getConfig('APIKey'));
|
||||
error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
global $constStr;
|
||||
if ($_GET['install1']) {
|
||||
if ($_POST['admin']!='') {
|
||||
$tmp['admin'] = $_POST['admin'];
|
||||
//$tmp['language'] = $_POST['language'];
|
||||
$tmp['timezone'] = $_COOKIE['timezone'];
|
||||
$APIKey = getConfig('APIKey');
|
||||
if ($APIKey=='') {
|
||||
$APIKey = $_POST['APIKey'];
|
||||
$tmp['APIKey'] = $APIKey;
|
||||
}
|
||||
$HerokuappId = getConfig('HerokuappId');
|
||||
if ($HerokuappId=='') {
|
||||
$function_name = getConfig('function_name');
|
||||
if ($function_name=='') {
|
||||
$tmp1 = substr($_SERVER['HTTP_HOST'], 0, strrpos($_SERVER['HTTP_HOST'], '.'));
|
||||
$maindomain = substr($tmp1, strrpos($tmp1, '.')+1);
|
||||
if ($maindomain=='herokuapp') $function_name = substr($tmp1, 0, strrpos($tmp1, '.'));
|
||||
else return message('Please visit from xxxx.herokuapp.com', '', 500);
|
||||
$res = HerokuAPI('GET', 'https://api.heroku.com/apps/' . $function_name, '', $APIKey);
|
||||
$response = json_decode($res['body'], true);
|
||||
if (isset($response['build_stack'])) {
|
||||
$HerokuappId = $response['id'];
|
||||
} else {
|
||||
return message('Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT), 'Something error', 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
$tmp['HerokuappId'] = $HerokuappId;
|
||||
$response = json_decode(setHerokuConfig($tmp, $HerokuappId, $APIKey)['body'], true);
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
} else {
|
||||
return output('Jump
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
|
||||
}
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
}
|
||||
if ($_GET['install0']) {
|
||||
$html .= '
|
||||
<form action="?install1" method="post" onsubmit="return notnull(this);">
|
||||
language:<br>';
|
||||
foreach ($constStr['languages'] as $key1 => $value1) {
|
||||
$html .= '
|
||||
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
|
||||
}
|
||||
if (getConfig('APIKey')=='') $html .= '
|
||||
<a href="https://dashboard.heroku.com/account" target="_blank">'.getconstStr('Create').' API Key</a><br>
|
||||
<label>API Key:<input name="APIKey" type="text" placeholder="" size=""></label><br>';
|
||||
$html .= '
|
||||
<label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
|
||||
$html .= '
|
||||
<input type="submit" value="'.getconstStr('Submit').'">
|
||||
</form>
|
||||
<script>
|
||||
var nowtime= new Date();
|
||||
var timezone = 0-nowtime.getTimezoneOffset()/60;
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie="timezone="+timezone+"; path=/; "+expires;
|
||||
function changelanguage(str)
|
||||
{
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.admin.value==\'\') {
|
||||
alert(\'input admin\');
|
||||
return false;
|
||||
}';
|
||||
if (getConfig('APIKey')=='') $html .= '
|
||||
if (t.APIKey.value==\'\') {
|
||||
alert(\'input API Key\');
|
||||
return false;
|
||||
}';
|
||||
$html .= '
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
$title = getconstStr('SelectLanguage');
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
function HerokuAPI($method, $url, $data = '', $apikey)
|
||||
{
|
||||
if ($method=='PATCH'||$method=='POST') {
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
$headers['Authorization'] = 'Bearer ' . $apikey;
|
||||
$headers['Accept'] = 'application/vnd.heroku+json; version=3';
|
||||
//if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
|
||||
//if (!isset($headers['Referer'])) $headers['Referer'] = $url;
|
||||
$sendHeaders = array();
|
||||
foreach ($headers as $headerName => $headerVal) {
|
||||
$sendHeaders[] = $headerName . ': ' . $headerVal;
|
||||
}
|
||||
error_log1($method . $url . $data . $apikey);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders);
|
||||
$response['body'] = curl_exec($ch);
|
||||
$response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
error_log1($response['stat'].'
|
||||
'.$response['body'].'
|
||||
');
|
||||
return $response;
|
||||
}
|
||||
|
||||
function getHerokuConfig($HerokuappId, $apikey)
|
||||
{
|
||||
return HerokuAPI('GET', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', '', $apikey);
|
||||
}
|
||||
|
||||
function setHerokuConfig($env, $HerokuappId, $apikey)
|
||||
{
|
||||
$data = json_encode($env);
|
||||
if (substr($data, 0, 1)=='{') return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', $data, $apikey);
|
||||
}
|
||||
|
||||
function updateHerokuapp($HerokuappId, $apikey, $source)
|
||||
{
|
||||
$tmp['source_blob']['url'] = $source;
|
||||
$data = json_encode($tmp);
|
||||
$response = HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
|
||||
$result = json_decode( $response['body'], true );
|
||||
$result['DplStatus'] = $result['id'];
|
||||
$response['body'] = json_encode($result);
|
||||
return $response;
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
{
|
||||
return isset($response['id'])&&isset($response['message']);
|
||||
}
|
||||
|
||||
function api_error_msg($response)
|
||||
{
|
||||
return $response['id'] . '<br>
|
||||
' . $response['message'] . '<br><br>
|
||||
function_name:' . $_SERVER['function_name'] . '<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
}
|
||||
|
||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
|
||||
{
|
||||
//'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
|
||||
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
|
||||
return updateHerokuapp(getConfig('HerokuappId'), getConfig('APIKey'), $source);
|
||||
}
|
||||
|
||||
function setConfigResponse($response)
|
||||
{
|
||||
return json_decode( $response['body'], true );
|
||||
}
|
||||
|
||||
function WaitFunction($buildId = '') {
|
||||
// GET /apps/{app_id_or_name}/builds/{build_id}
|
||||
if ($buildId=='1') return true;
|
||||
$response = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('HerokuappId') . '/builds/' . $buildId, '', getConfig('APIKey'));
|
||||
if ($response['stat']==200) {
|
||||
$result = json_decode($response['body'], true);
|
||||
if ($result['status']=="succeeded") return true;
|
||||
else return false;
|
||||
} else {
|
||||
$response['body'] .= $url;
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
// https://devcenter.heroku.com/articles/platform-api-reference#build-create
|
||||
|
||||
function getpath()
|
||||
{
|
||||
if (getConfig('function_name') && getConfig('APIKey')) {
|
||||
$APIKey = getConfig('APIKey');
|
||||
$res = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('function_name'), '', $APIKey);
|
||||
$response = json_decode($res['body'], true);
|
||||
if (isset($response['build_stack'])) {
|
||||
$tmp['HerokuappId'] = $response['id'];
|
||||
$tmp['function_name'] = null;
|
||||
} else {
|
||||
error_log1('Something error' . 'Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT));
|
||||
//return message('Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT), 'Something error', 500);
|
||||
}
|
||||
$response = json_decode(setHerokuConfig($tmp, $tmp['HerokuappId'], $APIKey)['body'], true);
|
||||
$title = 'Change function_name to HerokuappId';
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$stat = 500;
|
||||
error_log1('Change function_name to HerokuappId' . $html);
|
||||
} else {
|
||||
$html = getconstStr('Wait') . ' 5s, jump to index.
|
||||
<meta http-equiv="refresh" content="5;URL=/">';
|
||||
$stat = 201;
|
||||
}
|
||||
//return message($html, $title, $stat);
|
||||
}
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
||||
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
$_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_X_FORWARDED_PROTO'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
$_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
|
||||
else $path = $_SERVER['REQUEST_URI'];
|
||||
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
|
||||
return substr($path, 1);
|
||||
//return spurlencode($path, '/');
|
||||
}
|
||||
|
||||
function getGET()
|
||||
{
|
||||
//error_log1('POST:' . json_encode($_POST));
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
//error_log1('RAW:' . $tmpdata);
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
//error_log1('PHPINPUT:' . $tmpdata);
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
foreach ($postbody as $postvalues) {
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
//error_log1('POSTformPHPINPUT:' . json_encode($_POST));
|
||||
}
|
||||
}
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) {
|
||||
$getstr = substr($_SERVER['REQUEST_URI'], $p+1);
|
||||
$getstrarr = explode("&",$getstr);
|
||||
foreach ($getstrarr as $getvalues) {
|
||||
if ($getvalues != '') {
|
||||
$pos = strpos($getvalues, "=");
|
||||
//echo $pos;
|
||||
if ($pos > 0) {
|
||||
$getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
|
||||
} else {
|
||||
$getarry[urldecode($getvalues)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($getarry)) {
|
||||
return $getarry;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$env = json_decode(getenv($disktag), true);
|
||||
if (isset($env[$str])) {
|
||||
if (isBase64Env($str)) return base64y_decode($env[$str]);
|
||||
else return $env[$str];
|
||||
}
|
||||
} else {
|
||||
if (isBase64Env($str)) return base64y_decode(getenv($str));
|
||||
else return getenv($str);
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$disktags = explode("|",getConfig('disktag'));
|
||||
if ($disktag!='') $diskconfig = json_decode(getenv($disktag), true);
|
||||
$tmp = [];
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $tmp[$k] = base64y_encode($v);
|
||||
else $tmp[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $diskconfig[$k] = base64y_encode($v);
|
||||
else $diskconfig[$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$tmp[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$tmp[$newtag] = getConfig($v);
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
$tmp[$k] = json_encode($v);
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
|
||||
ksort($diskconfig);
|
||||
$tmp[$disktag] = json_encode($diskconfig);
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$tmp['disktag'] = implode('|', $tags);
|
||||
$tmp[$arr['disktag_newname']] = getConfig($arr['disktag_rename']);
|
||||
$tmp[$arr['disktag_rename']] = null;
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $tmp['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $tmp['disktag'] = null;
|
||||
}
|
||||
}
|
||||
foreach ($tmp as $key => $val) if ($val=='') $tmp[$key]=null;
|
||||
|
||||
return setHerokuConfig($tmp, getConfig('HerokuappId'), getConfig('APIKey'));
|
||||
error_log1(json_encode($arr, JSON_PRETTY_PRINT) . ' => tmp:' . json_encode($tmp, JSON_PRETTY_PRINT));
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
global $constStr;
|
||||
if ($_GET['install1']) {
|
||||
if ($_POST['admin']!='') {
|
||||
$tmp['admin'] = $_POST['admin'];
|
||||
//$tmp['language'] = $_POST['language'];
|
||||
$tmp['timezone'] = $_COOKIE['timezone'];
|
||||
$APIKey = getConfig('APIKey');
|
||||
if ($APIKey=='') {
|
||||
$APIKey = $_POST['APIKey'];
|
||||
$tmp['APIKey'] = $APIKey;
|
||||
}
|
||||
$HerokuappId = getConfig('HerokuappId');
|
||||
if ($HerokuappId=='') {
|
||||
$function_name = getConfig('function_name');
|
||||
if ($function_name=='') {
|
||||
$tmp1 = substr($_SERVER['HTTP_HOST'], 0, strrpos($_SERVER['HTTP_HOST'], '.'));
|
||||
$maindomain = substr($tmp1, strrpos($tmp1, '.')+1);
|
||||
if ($maindomain=='herokuapp') $function_name = substr($tmp1, 0, strrpos($tmp1, '.'));
|
||||
else return message('Please visit from xxxx.herokuapp.com', '', 500);
|
||||
$res = HerokuAPI('GET', 'https://api.heroku.com/apps/' . $function_name, '', $APIKey);
|
||||
$response = json_decode($res['body'], true);
|
||||
if (isset($response['build_stack'])) {
|
||||
$HerokuappId = $response['id'];
|
||||
} else {
|
||||
return message('Get Heroku app id: ' . json_encode($res, JSON_PRETTY_PRINT), 'Something error', 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
$tmp['HerokuappId'] = $HerokuappId;
|
||||
$response = json_decode(setHerokuConfig($tmp, $HerokuappId, $APIKey)['body'], true);
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
} else {
|
||||
return output('Jump
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
|
||||
}
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
}
|
||||
if ($_GET['install0']) {
|
||||
$html .= '
|
||||
<form action="?install1" method="post" onsubmit="return notnull(this);">
|
||||
language:<br>';
|
||||
foreach ($constStr['languages'] as $key1 => $value1) {
|
||||
$html .= '
|
||||
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
|
||||
}
|
||||
if (getConfig('APIKey')=='') $html .= '
|
||||
<a href="https://dashboard.heroku.com/account" target="_blank">'.getconstStr('Create').' API Key</a><br>
|
||||
<label>API Key:<input name="APIKey" type="text" placeholder="" size=""></label><br>';
|
||||
$html .= '
|
||||
<label>Set admin password:<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"></label><br>';
|
||||
$html .= '
|
||||
<input type="submit" value="'.getconstStr('Submit').'">
|
||||
</form>
|
||||
<script>
|
||||
var nowtime= new Date();
|
||||
var timezone = 0-nowtime.getTimezoneOffset()/60;
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie="timezone="+timezone+"; path=/; "+expires;
|
||||
function changelanguage(str)
|
||||
{
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.admin.value==\'\') {
|
||||
alert(\'input admin\');
|
||||
return false;
|
||||
}';
|
||||
if (getConfig('APIKey')=='') $html .= '
|
||||
if (t.APIKey.value==\'\') {
|
||||
alert(\'input API Key\');
|
||||
return false;
|
||||
}';
|
||||
$html .= '
|
||||
return true;
|
||||
}
|
||||
</script>';
|
||||
$title = getconstStr('SelectLanguage');
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
function HerokuAPI($method, $url, $data = '', $apikey)
|
||||
{
|
||||
if ($method=='PATCH'||$method=='POST') {
|
||||
$headers['Content-Type'] = 'application/json';
|
||||
}
|
||||
$headers['Authorization'] = 'Bearer ' . $apikey;
|
||||
$headers['Accept'] = 'application/vnd.heroku+json; version=3';
|
||||
//if (!isset($headers['Accept'])) $headers['Accept'] = '*/*';
|
||||
//if (!isset($headers['Referer'])) $headers['Referer'] = $url;
|
||||
$sendHeaders = array();
|
||||
foreach ($headers as $headerName => $headerVal) {
|
||||
$sendHeaders[] = $headerName . ': ' . $headerVal;
|
||||
}
|
||||
error_log1($method . $url . $data . $apikey);
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_CUSTOMREQUEST,$method);
|
||||
curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 5);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
|
||||
curl_setopt($ch, CURLOPT_HTTPHEADER, $sendHeaders);
|
||||
$response['body'] = curl_exec($ch);
|
||||
$response['stat'] = curl_getinfo($ch,CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
error_log1($response['stat'].'
|
||||
'.$response['body'].'
|
||||
');
|
||||
return $response;
|
||||
}
|
||||
|
||||
function getHerokuConfig($HerokuappId, $apikey)
|
||||
{
|
||||
return HerokuAPI('GET', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', '', $apikey);
|
||||
}
|
||||
|
||||
function setHerokuConfig($env, $HerokuappId, $apikey)
|
||||
{
|
||||
$data = json_encode($env);
|
||||
if (substr($data, 0, 1)=='{') return HerokuAPI('PATCH', 'https://api.heroku.com/apps/' . $HerokuappId . '/config-vars', $data, $apikey);
|
||||
}
|
||||
|
||||
function updateHerokuapp($HerokuappId, $apikey, $source)
|
||||
{
|
||||
$tmp['source_blob']['url'] = $source;
|
||||
$data = json_encode($tmp);
|
||||
$response = HerokuAPI('POST', 'https://api.heroku.com/apps/' . $HerokuappId . '/builds', $data, $apikey);
|
||||
$result = json_decode( $response['body'], true );
|
||||
$result['DplStatus'] = $result['id'];
|
||||
$response['body'] = json_encode($result);
|
||||
return $response;
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
{
|
||||
return isset($response['id'])&&isset($response['message']);
|
||||
}
|
||||
|
||||
function api_error_msg($response)
|
||||
{
|
||||
return $response['id'] . '<br>
|
||||
' . $response['message'] . '<br><br>
|
||||
function_name:' . $_SERVER['function_name'] . '<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
}
|
||||
|
||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
|
||||
{
|
||||
//'https://github.com/qkqpttgf/OneManager-php/tarball/master/';
|
||||
$source = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
|
||||
return updateHerokuapp(getConfig('HerokuappId'), getConfig('APIKey'), $source);
|
||||
}
|
||||
|
||||
function setConfigResponse($response)
|
||||
{
|
||||
return json_decode( $response['body'], true );
|
||||
}
|
||||
|
||||
function WaitFunction($buildId = '') {
|
||||
// GET /apps/{app_id_or_name}/builds/{build_id}
|
||||
if ($buildId=='1') return true;
|
||||
$response = HerokuAPI('GET', 'https://api.heroku.com/apps/' . getConfig('HerokuappId') . '/builds/' . $buildId, '', getConfig('APIKey'));
|
||||
if ($response['stat']==200) {
|
||||
$result = json_decode($response['body'], true);
|
||||
if ($result['status']=="succeeded") return true;
|
||||
else return false;
|
||||
} else {
|
||||
$response['body'] .= $url;
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ function GetPathSetting($event, $context)
|
|||
$host_name = $event['headers']['host'];
|
||||
$_SERVER['HTTP_HOST'] = $host_name;
|
||||
$path = path_format($event['pathParameters'][''].'/');
|
||||
$path = str_replace('+', '%2B', $path);
|
||||
$_SERVER['base_path'] = path_format($event['path'].'/');
|
||||
if ( $_SERVER['base_path'] == $path ) {
|
||||
$_SERVER['base_path'] = '/';
|
||||
|
@ -72,7 +71,6 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
return $path;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ function GetPathSetting($event, $context)
|
|||
$host_name = $event['headers']['host'];
|
||||
$_SERVER['HTTP_HOST'] = $host_name;
|
||||
$path = path_format($event['pathParameters'][''].'/');
|
||||
$path = str_replace('+', '%2B', $path);
|
||||
$_SERVER['base_path'] = path_format($event['path'].'/');
|
||||
if ( $_SERVER['base_path'] == $path ) {
|
||||
$_SERVER['base_path'] = '/';
|
||||
|
@ -72,7 +71,6 @@ function GetPathSetting($event, $context)
|
|||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
|
||||
$_SERVER['_APP_SHARE_DIR'] = '/var/share/CFF/processrouter';
|
||||
return $path;
|
||||
}
|
||||
|
|
|
@ -1,391 +1,391 @@
|
|||
<?php
|
||||
|
||||
function getpath()
|
||||
{
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
|
||||
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
|
||||
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
|
||||
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
|
||||
}
|
||||
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
|
||||
}
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/app') $_SERVER['base_path'] = '/';
|
||||
else $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
|
||||
else $path = $_SERVER['REQUEST_URI'];
|
||||
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
|
||||
return $path;
|
||||
//return substr($path, 1);
|
||||
//return spurlencode($path, '/');
|
||||
}
|
||||
|
||||
function getGET()
|
||||
{
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
foreach ($postbody as $postvalues) {
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) {
|
||||
$getstr = substr($_SERVER['REQUEST_URI'], $p+1);
|
||||
$getstrarr = explode("&",$getstr);
|
||||
foreach ($getstrarr as $getvalues) {
|
||||
if ($getvalues != '') {
|
||||
$pos = strpos($getvalues, "=");
|
||||
//echo $pos;
|
||||
if ($pos > 0) {
|
||||
$getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
|
||||
} else {
|
||||
$getarry[urldecode($getvalues)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($getarry)) {
|
||||
return $getarry;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $slash;
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') {
|
||||
$envs = json_decode($configs, true);
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
if (isset($envs[$disktag][$str])) {
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]);
|
||||
else return $envs[$disktag][$str];
|
||||
}
|
||||
} else {
|
||||
if (isset($envs[$str])) {
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$str]);
|
||||
else return $envs[$str];
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $slash;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $envs = json_decode($configs, true);
|
||||
$disktags = explode("|", getConfig('disktag'));
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
else $envs[$disktag][$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$envs[$newtag] = $envs[$v];
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
//$tmpdisk = json_decode($v, true);
|
||||
//var_dump($tmpdisk);
|
||||
//error_log(json_encode($tmpdisk));
|
||||
//if ($tmpdisk===null)
|
||||
$envs[$k] = $v;
|
||||
//else $envs[$k] = $tmpdisk;
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
$diskconfig = $envs[$disktag];
|
||||
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
|
||||
ksort($diskconfig);
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$envs['disktag'] = implode('|', $tags);
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
unset($envs[$arr['disktag_rename']]);
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
//ksort($envs);
|
||||
sortConfig($envs);
|
||||
|
||||
//echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>';
|
||||
$prestr = '<?php $configs = \'' . PHP_EOL;
|
||||
$aftstr = PHP_EOL . '\';';
|
||||
$response = file_put_contents($configPath, $prestr . json_encode($envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
if ($response>0) return json_encode( [ 'response' => 'success' ] );
|
||||
return json_encode( [ 'message' => 'Failed to write config.', 'code' => 'failed' ] );
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
global $constStr;
|
||||
if ($_GET['install2']) {
|
||||
if ($_POST['admin']!='') {
|
||||
$tmp['admin'] = $_POST['admin'];
|
||||
//$tmp['language'] = $_COOKIE['language'];
|
||||
$tmp['timezone'] = $_COOKIE['timezone'];
|
||||
$response = setConfigResponse( setConfig($tmp) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
} else {
|
||||
return output('Jump
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($_GET['install1']) {
|
||||
if (!ConfigWriteable()) {
|
||||
$html .= getconstStr('MakesuerWriteable');
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
/*if (!RewriteEngineOn()) {
|
||||
$html .= getconstStr('MakesuerRewriteOn');
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}*/
|
||||
$html .= '<button id="checkrewritebtn" onclick="checkrewrite();">'.getconstStr('MakesuerRewriteOn').'</button>
|
||||
<div id="formdiv" style="display: none">
|
||||
<form action="?install2" method="post" onsubmit="return notnull(this);">
|
||||
<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"><br>
|
||||
<input id="submitbtn" type="submit" value="'.getconstStr('Submit').'" disabled>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
var nowtime= new Date();
|
||||
var timezone = 0-nowtime.getTimezoneOffset()/60;
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie="timezone="+timezone+"; path=/; "+expires;
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.admin.value==\'\') {
|
||||
alert(\''.getconstStr('SetAdminPassword').'\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function checkrewrite()
|
||||
{
|
||||
url=location.protocol + "//" + location.host;
|
||||
//if (location.port!="") url += ":" + location.port;
|
||||
url += location.pathname;
|
||||
if (url.substr(-1)!="/") url += "/";
|
||||
url += "app.json";
|
||||
url += "?" + Date.now();
|
||||
var xhr4 = new XMLHttpRequest();
|
||||
xhr4.open("GET", url);
|
||||
xhr4.setRequestHeader("x-requested-with","XMLHttpRequest");
|
||||
xhr4.send(null);
|
||||
xhr4.onload = function(e){
|
||||
console.log(xhr4.responseText+","+xhr4.status);
|
||||
if (xhr4.status==201) {
|
||||
document.getElementById("checkrewritebtn").style.display = "none";
|
||||
document.getElementById("submitbtn").disabled = false;
|
||||
document.getElementById("formdiv").style.display = "";
|
||||
} else {
|
||||
alert("' . getconstStr('MakesuerRewriteOn') . '?\nfalse\n\nUrl: " + url + "\nExpect http code 201, but received " + xhr4.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$title = getconstStr('SetAdminPassword');
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
if ($_GET['install0']) {
|
||||
$html .= '
|
||||
<form action="?install1" method="post">
|
||||
language:<br>';
|
||||
foreach ($constStr['languages'] as $key1 => $value1) {
|
||||
$html .= '
|
||||
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
|
||||
}
|
||||
$html .= '
|
||||
<input type="submit" value="'.getconstStr('Submit').'">
|
||||
</form>
|
||||
<script>
|
||||
function changelanguage(str)
|
||||
{
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
</script>';
|
||||
$title = getconstStr('SelectLanguage');
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
function ConfigWriteable()
|
||||
{
|
||||
$t = md5( md5(time()).rand(1000,9999) );
|
||||
$r = setConfig([ 'tmp' => $t ]);
|
||||
$tmp = getConfig('tmp');
|
||||
setConfig([ 'tmp' => '' ]);
|
||||
if ($tmp == $t) return true;
|
||||
if ($r) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
{
|
||||
return isset($response['message']);
|
||||
}
|
||||
|
||||
function api_error_msg($response)
|
||||
{
|
||||
return $response['code'] . '<br>
|
||||
' . $response['message'] . '<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
}
|
||||
|
||||
function setConfigResponse($response)
|
||||
{
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
|
||||
{
|
||||
$slash = '/';
|
||||
if (strpos(__DIR__, ':')) $slash = '\\';
|
||||
// __DIR__ is xxx/platform
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
|
||||
// 从github下载对应tar.gz,并解压
|
||||
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
|
||||
$tarfile = $projectPath . $slash .'github.tar.gz';
|
||||
$githubfile = file_get_contents($url);
|
||||
if (!$githubfile) return 0;
|
||||
file_put_contents($tarfile, $githubfile);
|
||||
if (splitfirst(PHP_VERSION, '.')[0] > '5') {
|
||||
$phar = new PharData($tarfile); // need php5.3, 7, 8
|
||||
$phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
|
||||
} else {
|
||||
ob_start();
|
||||
passthru('tar -xzvf ' . $tarfile, $stat);
|
||||
ob_get_clean();
|
||||
}
|
||||
unlink($tarfile);
|
||||
|
||||
$outPath = '';
|
||||
$tmp = scandir($projectPath);
|
||||
$name = $auth . '-' . $project;
|
||||
foreach ($tmp as $f) {
|
||||
if ( substr($f, 0, strlen($name)) == $name) {
|
||||
$outPath = $projectPath . $slash . $f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//error_log1($outPath);
|
||||
if ($outPath=='') return 0;
|
||||
|
||||
//unlink($outPath.'/config.php');
|
||||
$response = rename($projectPath . $slash . '.data' . $slash . 'config.php', $outPath . $slash . '.data' . $slash . 'config.php');
|
||||
if (!$response) {
|
||||
$tmp1['code'] = "Move Failed";
|
||||
$tmp1['message'] = "Can not move " . $projectPath . $slash . '.data' . $slash . 'config.php' . " to " . $outPath . $slash . '.data' . $slash . 'config.php';
|
||||
return json_encode($tmp1);
|
||||
}
|
||||
return moveFolder($outPath, $projectPath, $slash);
|
||||
}
|
||||
|
||||
function moveFolder($from, $to, $slash)
|
||||
{
|
||||
if (substr($from, -1)==$slash) $from = substr($from, 0, -1);
|
||||
if (substr($to, -1)==$slash) $to = substr($to, 0, -1);
|
||||
if (!file_exists($to)) mkdir($to, 0777);
|
||||
$handler=opendir($from);
|
||||
while($filename=readdir($handler)) {
|
||||
if($filename != '.' && $filename != '..'){
|
||||
$fromfile = $from . $slash . $filename;
|
||||
$tofile = $to . $slash . $filename;
|
||||
if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
|
||||
$response = moveFolder($fromfile, $tofile, $slash);
|
||||
if (api_error(setConfigResponse($response))) return $response;
|
||||
}else{
|
||||
//if (file_exists($tofile)) unlink($tofile);
|
||||
$response = rename($fromfile, $tofile);
|
||||
if (!$response) {
|
||||
$tmp['code'] = "Move Failed";
|
||||
$tmp['message'] = "Can not move " . $fromfile . " to " . $tofile;
|
||||
return json_encode($tmp);
|
||||
}
|
||||
if (file_exists($fromfile)) unlink($fromfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handler);
|
||||
rmdir($from);
|
||||
return json_encode( [ 'response' => 'success' ] );
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
<?php
|
||||
|
||||
function getpath()
|
||||
{
|
||||
$_SERVER['firstacceptlanguage'] = strtolower(splitfirst(splitfirst($_SERVER['HTTP_ACCEPT_LANGUAGE'],';')[0],',')[0]);
|
||||
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||
if (isset($_SERVER['HTTP_FLY_CLIENT_IP'])) $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_FLY_CLIENT_IP'];
|
||||
if ($_SERVER['REQUEST_SCHEME']!='http'&&$_SERVER['REQUEST_SCHEME']!='https') {
|
||||
if ($_SERVER['HTTP_X_FORWARDED_PROTO']!='') {
|
||||
$tmp = explode(',', $_SERVER['HTTP_X_FORWARDED_PROTO'])[0];
|
||||
if ($tmp=='http'||$tmp=='https') $_SERVER['REQUEST_SCHEME'] = $tmp;
|
||||
}
|
||||
if ($_SERVER['HTTP_FLY_FORWARDED_PROTO']!='') $_SERVER['REQUEST_SCHEME'] = $_SERVER['HTTP_FLY_FORWARDED_PROTO'];
|
||||
}
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $_SERVER['HTTP_REFERER'])[2];
|
||||
if (isset($_SERVER['DOCUMENT_ROOT'])&&$_SERVER['DOCUMENT_ROOT']==='/app') $_SERVER['base_path'] = '/';
|
||||
else $_SERVER['base_path'] = path_format(substr($_SERVER['SCRIPT_NAME'], 0, -10) . '/');
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) $path = substr($_SERVER['REQUEST_URI'], 0, $p);
|
||||
else $path = $_SERVER['REQUEST_URI'];
|
||||
$path = path_format( substr($path, strlen($_SERVER['base_path'])) );
|
||||
return $path;
|
||||
//return substr($path, 1);
|
||||
//return spurlencode($path, '/');
|
||||
}
|
||||
|
||||
function getGET()
|
||||
{
|
||||
if (!$_POST) {
|
||||
if (!!$HTTP_RAW_POST_DATA) {
|
||||
$tmpdata = $HTTP_RAW_POST_DATA;
|
||||
} else {
|
||||
$tmpdata = file_get_contents('php://input');
|
||||
}
|
||||
if (!!$tmpdata) {
|
||||
$postbody = explode("&", $tmpdata);
|
||||
foreach ($postbody as $postvalues) {
|
||||
$pos = strpos($postvalues,"=");
|
||||
$_POST[urldecode(substr($postvalues,0,$pos))]=urldecode(substr($postvalues,$pos+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_SERVER['UNENCODED_URL'])) $_SERVER['REQUEST_URI'] = $_SERVER['UNENCODED_URL'];
|
||||
$p = strpos($_SERVER['REQUEST_URI'],'?');
|
||||
if ($p>0) {
|
||||
$getstr = substr($_SERVER['REQUEST_URI'], $p+1);
|
||||
$getstrarr = explode("&",$getstr);
|
||||
foreach ($getstrarr as $getvalues) {
|
||||
if ($getvalues != '') {
|
||||
$pos = strpos($getvalues, "=");
|
||||
//echo $pos;
|
||||
if ($pos > 0) {
|
||||
$getarry[urldecode(substr($getvalues, 0, $pos))] = urldecode(substr($getvalues, $pos + 1));
|
||||
} else {
|
||||
$getarry[urldecode($getvalues)] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($getarry)) {
|
||||
return $getarry;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
function getConfig($str, $disktag = '')
|
||||
{
|
||||
global $slash;
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') {
|
||||
$envs = json_decode($configs, true);
|
||||
if (isInnerEnv($str)) {
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
if (isset($envs[$disktag][$str])) {
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$disktag][$str]);
|
||||
else return $envs[$disktag][$str];
|
||||
}
|
||||
} else {
|
||||
if (isset($envs[$str])) {
|
||||
if (isBase64Env($str)) return base64y_decode($envs[$str]);
|
||||
else return $envs[$str];
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
function setConfig($arr, $disktag = '')
|
||||
{
|
||||
global $slash;
|
||||
if ($disktag=='') $disktag = $_SERVER['disktag'];
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
$configPath = $projectPath . $slash . '.data' . $slash . 'config.php';
|
||||
$s = file_get_contents($configPath);
|
||||
$configs = '{' . splitlast(splitfirst($s, '{')[1], '}')[0] . '}';
|
||||
if ($configs!='') $envs = json_decode($configs, true);
|
||||
$disktags = explode("|", getConfig('disktag'));
|
||||
$indisk = 0;
|
||||
$operatedisk = 0;
|
||||
foreach ($arr as $k => $v) {
|
||||
if (isCommonEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$k] = base64y_encode($v);
|
||||
else $envs[$k] = $v;
|
||||
} elseif (isInnerEnv($k)) {
|
||||
if (isBase64Env($k)) $envs[$disktag][$k] = base64y_encode($v);
|
||||
else $envs[$disktag][$k] = $v;
|
||||
$indisk = 1;
|
||||
} elseif ($k=='disktag_add') {
|
||||
array_push($disktags, $v);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_del') {
|
||||
$disktags = array_diff($disktags, [ $v ]);
|
||||
$envs[$v] = '';
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_copy') {
|
||||
$newtag = $v . '_' . date("Ymd_His");
|
||||
$envs[$newtag] = $envs[$v];
|
||||
array_push($disktags, $newtag);
|
||||
$operatedisk = 1;
|
||||
} elseif ($k=='disktag_rename' || $k=='disktag_newname') {
|
||||
if ($arr['disktag_rename']!=$arr['disktag_newname']) $operatedisk = 1;
|
||||
} else {
|
||||
//$tmpdisk = json_decode($v, true);
|
||||
//var_dump($tmpdisk);
|
||||
//error_log(json_encode($tmpdisk));
|
||||
//if ($tmpdisk===null)
|
||||
$envs[$k] = $v;
|
||||
//else $envs[$k] = $tmpdisk;
|
||||
}
|
||||
}
|
||||
if ($indisk) {
|
||||
$diskconfig = $envs[$disktag];
|
||||
$diskconfig = array_filter($diskconfig, 'array_value_isnot_null');
|
||||
ksort($diskconfig);
|
||||
$envs[$disktag] = $diskconfig;
|
||||
}
|
||||
if ($operatedisk) {
|
||||
if (isset($arr['disktag_newname']) && $arr['disktag_newname']!='') {
|
||||
$tags = [];
|
||||
foreach ($disktags as $tag) {
|
||||
if ($tag==$arr['disktag_rename']) array_push($tags, $arr['disktag_newname']);
|
||||
else array_push($tags, $tag);
|
||||
}
|
||||
$envs['disktag'] = implode('|', $tags);
|
||||
$envs[$arr['disktag_newname']] = $envs[$arr['disktag_rename']];
|
||||
unset($envs[$arr['disktag_rename']]);
|
||||
} else {
|
||||
$disktags = array_unique($disktags);
|
||||
foreach ($disktags as $disktag) if ($disktag!='') $disktag_s .= $disktag . '|';
|
||||
if ($disktag_s!='') $envs['disktag'] = substr($disktag_s, 0, -1);
|
||||
else $envs['disktag'] = '';
|
||||
}
|
||||
}
|
||||
$envs = array_filter($envs, 'array_value_isnot_null');
|
||||
//ksort($envs);
|
||||
sortConfig($envs);
|
||||
|
||||
//echo '<pre>'. json_encode($envs, JSON_PRETTY_PRINT).'</pre>';
|
||||
$prestr = '<?php $configs = \'' . PHP_EOL;
|
||||
$aftstr = PHP_EOL . '\';';
|
||||
$response = file_put_contents($configPath, $prestr . json_encode($envs, JSON_PRETTY_PRINT) . $aftstr);
|
||||
if ($response>0) return json_encode( [ 'response' => 'success' ] );
|
||||
return json_encode( [ 'message' => 'Failed to write config.', 'code' => 'failed' ] );
|
||||
}
|
||||
|
||||
function install()
|
||||
{
|
||||
global $constStr;
|
||||
if ($_GET['install2']) {
|
||||
if ($_POST['admin']!='') {
|
||||
$tmp['admin'] = $_POST['admin'];
|
||||
//$tmp['language'] = $_COOKIE['language'];
|
||||
$tmp['timezone'] = $_COOKIE['timezone'];
|
||||
$response = setConfigResponse( setConfig($tmp) );
|
||||
if (api_error($response)) {
|
||||
$html = api_error_msg($response);
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
} else {
|
||||
return output('Jump
|
||||
<script>
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=; path=/; \'+expires;
|
||||
</script>
|
||||
<meta http-equiv="refresh" content="3;URL=' . path_format($_SERVER['base_path'] . '/') . '">', 302);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($_GET['install1']) {
|
||||
if (!ConfigWriteable()) {
|
||||
$html .= getconstStr('MakesuerWriteable');
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
/*if (!RewriteEngineOn()) {
|
||||
$html .= getconstStr('MakesuerRewriteOn');
|
||||
$title = 'Error';
|
||||
return message($html, $title, 201);
|
||||
}*/
|
||||
$html .= '<button id="checkrewritebtn" onclick="checkrewrite();">'.getconstStr('MakesuerRewriteOn').'</button>
|
||||
<div id="formdiv" style="display: none">
|
||||
<form action="?install2" method="post" onsubmit="return notnull(this);">
|
||||
<input name="admin" type="password" placeholder="' . getconstStr('EnvironmentsDescription')['admin'] . '" size="' . strlen(getconstStr('EnvironmentsDescription')['admin']) . '"><br>
|
||||
<input id="submitbtn" type="submit" value="'.getconstStr('Submit').'" disabled>
|
||||
</form>
|
||||
</div>
|
||||
<script>
|
||||
var nowtime= new Date();
|
||||
var timezone = 0-nowtime.getTimezoneOffset()/60;
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie="timezone="+timezone+"; path=/; "+expires;
|
||||
function notnull(t)
|
||||
{
|
||||
if (t.admin.value==\'\') {
|
||||
alert(\''.getconstStr('SetAdminPassword').'\');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function checkrewrite()
|
||||
{
|
||||
url=location.protocol + "//" + location.host;
|
||||
//if (location.port!="") url += ":" + location.port;
|
||||
url += location.pathname;
|
||||
if (url.substr(-1)!="/") url += "/";
|
||||
url += "app.json";
|
||||
url += "?" + Date.now();
|
||||
var xhr4 = new XMLHttpRequest();
|
||||
xhr4.open("GET", url);
|
||||
xhr4.setRequestHeader("x-requested-with","XMLHttpRequest");
|
||||
xhr4.send(null);
|
||||
xhr4.onload = function(e){
|
||||
console.log(xhr4.responseText+","+xhr4.status);
|
||||
if (xhr4.status==201) {
|
||||
document.getElementById("checkrewritebtn").style.display = "none";
|
||||
document.getElementById("submitbtn").disabled = false;
|
||||
document.getElementById("formdiv").style.display = "";
|
||||
} else {
|
||||
alert("' . getconstStr('MakesuerRewriteOn') . '?\nfalse\n\nUrl: " + url + "\nExpect http code 201, but received " + xhr4.status);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>';
|
||||
$title = getconstStr('SetAdminPassword');
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
if ($_GET['install0']) {
|
||||
$html .= '
|
||||
<form action="?install1" method="post">
|
||||
language:<br>';
|
||||
foreach ($constStr['languages'] as $key1 => $value1) {
|
||||
$html .= '
|
||||
<label><input type="radio" name="language" value="'.$key1.'" '.($key1==$constStr['language']?'checked':'').' onclick="changelanguage(\''.$key1.'\')">'.$value1.'</label><br>';
|
||||
}
|
||||
$html .= '
|
||||
<input type="submit" value="'.getconstStr('Submit').'">
|
||||
</form>
|
||||
<script>
|
||||
function changelanguage(str)
|
||||
{
|
||||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+(2*60*60*1000));
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie=\'language=\'+str+\'; path=/; \'+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
</script>';
|
||||
$title = getconstStr('SelectLanguage');
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
$html .= '<a href="?install0">'.getconstStr('ClickInstall').'</a>, '.getconstStr('LogintoBind');
|
||||
$title = 'Install';
|
||||
return message($html, $title, 201);
|
||||
}
|
||||
|
||||
function ConfigWriteable()
|
||||
{
|
||||
$t = md5( md5(time()).rand(1000,9999) );
|
||||
$r = setConfig([ 'tmp' => $t ]);
|
||||
$tmp = getConfig('tmp');
|
||||
setConfig([ 'tmp' => '' ]);
|
||||
if ($tmp == $t) return true;
|
||||
if ($r) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function api_error($response)
|
||||
{
|
||||
return isset($response['message']);
|
||||
}
|
||||
|
||||
function api_error_msg($response)
|
||||
{
|
||||
return $response['code'] . '<br>
|
||||
' . $response['message'] . '<br>
|
||||
<button onclick="location.href = location.href;">'.getconstStr('Refresh').'</button>';
|
||||
}
|
||||
|
||||
function setConfigResponse($response)
|
||||
{
|
||||
return json_decode($response, true);
|
||||
}
|
||||
|
||||
function OnekeyUpate($auth = 'qkqpttgf', $project = 'OneManager-php', $branch = 'master')
|
||||
{
|
||||
$slash = '/';
|
||||
if (strpos(__DIR__, ':')) $slash = '\\';
|
||||
// __DIR__ is xxx/platform
|
||||
$projectPath = splitlast(__DIR__, $slash)[0];
|
||||
|
||||
// 从github下载对应tar.gz,并解压
|
||||
$url = 'https://github.com/' . $auth . '/' . $project . '/tarball/' . urlencode($branch) . '/';
|
||||
$tarfile = $projectPath . $slash .'github.tar.gz';
|
||||
$githubfile = file_get_contents($url);
|
||||
if (!$githubfile) return 0;
|
||||
file_put_contents($tarfile, $githubfile);
|
||||
if (splitfirst(PHP_VERSION, '.')[0] > '5') {
|
||||
$phar = new PharData($tarfile); // need php5.3, 7, 8
|
||||
$phar->extractTo($projectPath, null, true);//路径 要解压的文件 是否覆盖
|
||||
} else {
|
||||
ob_start();
|
||||
passthru('tar -xzvf ' . $tarfile, $stat);
|
||||
ob_get_clean();
|
||||
}
|
||||
unlink($tarfile);
|
||||
|
||||
$outPath = '';
|
||||
$tmp = scandir($projectPath);
|
||||
$name = $auth . '-' . $project;
|
||||
foreach ($tmp as $f) {
|
||||
if ( substr($f, 0, strlen($name)) == $name) {
|
||||
$outPath = $projectPath . $slash . $f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//error_log1($outPath);
|
||||
if ($outPath=='') return 0;
|
||||
|
||||
//unlink($outPath.'/config.php');
|
||||
$response = rename($projectPath . $slash . '.data' . $slash . 'config.php', $outPath . $slash . '.data' . $slash . 'config.php');
|
||||
if (!$response) {
|
||||
$tmp1['code'] = "Move Failed";
|
||||
$tmp1['message'] = "Can not move " . $projectPath . $slash . '.data' . $slash . 'config.php' . " to " . $outPath . $slash . '.data' . $slash . 'config.php';
|
||||
return json_encode($tmp1);
|
||||
}
|
||||
return moveFolder($outPath, $projectPath, $slash);
|
||||
}
|
||||
|
||||
function moveFolder($from, $to, $slash)
|
||||
{
|
||||
if (substr($from, -1)==$slash) $from = substr($from, 0, -1);
|
||||
if (substr($to, -1)==$slash) $to = substr($to, 0, -1);
|
||||
if (!file_exists($to)) mkdir($to, 0777);
|
||||
$handler=opendir($from);
|
||||
while($filename=readdir($handler)) {
|
||||
if($filename != '.' && $filename != '..'){
|
||||
$fromfile = $from . $slash . $filename;
|
||||
$tofile = $to . $slash . $filename;
|
||||
if(is_dir($fromfile)){// 如果读取的某个对象是文件夹,则递归
|
||||
$response = moveFolder($fromfile, $tofile, $slash);
|
||||
if (api_error(setConfigResponse($response))) return $response;
|
||||
}else{
|
||||
//if (file_exists($tofile)) unlink($tofile);
|
||||
$response = rename($fromfile, $tofile);
|
||||
if (!$response) {
|
||||
$tmp['code'] = "Move Failed";
|
||||
$tmp['message'] = "Can not move " . $fromfile . " to " . $tofile;
|
||||
return json_encode($tmp);
|
||||
}
|
||||
if (file_exists($fromfile)) unlink($fromfile);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handler);
|
||||
rmdir($from);
|
||||
return json_encode( [ 'response' => 'success' ] );
|
||||
}
|
||||
|
||||
function WaitFunction() {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -56,8 +56,7 @@ function GetPathSetting($event, $context)
|
|||
//$_SERVER['REQUEST_SCHEME'] = $event['headers']['x-forwarded-proto'];
|
||||
$_SERVER['host'] = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
|
||||
$_SERVER['referhost'] = explode('/', $event['headers']['referer'])[2];
|
||||
$_SERVER['HTTP_TRANSLATE'] = $event['headers']['translate'];//'f'
|
||||
$_SERVER['HTTP_IF_MODIFIED_SINCE'] = $event['headers']['if-modified-since'];
|
||||
$_SERVER['HTTP_TRANSLATE']==$event['headers']['translate'];//'f'
|
||||
$_SERVER['USER'] = 'qcloud';
|
||||
return $path;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
342
readme.md
342
readme.md
|
@ -1,206 +1,136 @@
|
|||
[中文readme](readme_cn.md)
|
||||
|
||||
# NOTICE:
|
||||
|
||||
The release is used as archive.
|
||||
|
||||
Please read the descriptions of settings before raising an issue.
|
||||
|
||||
---
|
||||
|
||||
# Deploy to Heroku
|
||||
|
||||
### Official
|
||||
|
||||
https://heroku.com
|
||||
|
||||
### Demo
|
||||
|
||||
https://herooneindex.herokuapp.com/
|
||||
|
||||
### How to Install
|
||||
|
||||
> ~~Click the button [](https://heroku.com/deploy) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)
|
||||
>
|
||||
> Star this project, then Fork, create a app in Heroku, then turn to the Deploy tab, "Deployment method" via "Connect GitHub", select your github fork.
|
||||
|
||||
---
|
||||
|
||||
# Deploy to Glitch
|
||||
|
||||
### Official
|
||||
|
||||
https://glitch.com/
|
||||
|
||||
### Demo
|
||||
|
||||
https://onemanager.glitch.me/
|
||||
|
||||
### How to Install
|
||||
|
||||
[New Project] -> [Import form Github] -> paste "https://github.com/qkqpttgf/OneManager-php" , after done, [Show] -> [In a New Window].
|
||||
|
||||
---
|
||||
|
||||
# Deploy to Vercel
|
||||
|
||||
### Official
|
||||
|
||||
https://vercel.com/
|
||||
|
||||
### Demo
|
||||
|
||||
https://onemanager-php.vercel.app/
|
||||
|
||||
### Notice
|
||||
|
||||
> 1. you must wait 30-50s to make sure deploy READY after change config;
|
||||
>
|
||||
> 2. Vercel limit 100 deploy every day.
|
||||
|
||||
### How to Install
|
||||
|
||||
https://scfonedrive.github.io/Vercel/Deploy.html .
|
||||
|
||||
---
|
||||
|
||||
# Deploy to Tencent Serverless Cloud Function (SCF)
|
||||
|
||||
### Official
|
||||
|
||||
https://cloud.tencent.com/product/scf
|
||||
|
||||
### DEMO
|
||||
|
||||
null
|
||||
|
||||
### How to Install
|
||||
|
||||
see CN readme.
|
||||
|
||||
----
|
||||
|
||||
|
||||
# Deploy to Huawei cloud Function Graph (FG)
|
||||
|
||||
### Official
|
||||
|
||||
https://console.huaweicloud.com/functiongraph/
|
||||
|
||||
### DEMO
|
||||
|
||||
null
|
||||
|
||||
### How to Install
|
||||
|
||||
see CN readme.
|
||||
|
||||
----
|
||||
|
||||
# Deploy to Aliyun Function Compute (FC)
|
||||
|
||||
### Official:
|
||||
|
||||
https://fc.console.aliyun.com/
|
||||
|
||||
### DEMO
|
||||
|
||||
null
|
||||
|
||||
### How to Install
|
||||
|
||||
see CN readme.
|
||||
|
||||
---
|
||||
|
||||
# Deploy to Baidu Cloud Function Compute (CFC)
|
||||
|
||||
### Official
|
||||
|
||||
https://console.bce.baidu.com/cfc/#/cfc/functions
|
||||
|
||||
### DEMO
|
||||
|
||||
null
|
||||
|
||||
### How to Install
|
||||
|
||||
see CN readme.
|
||||
|
||||
---
|
||||
|
||||
# Deploy to Virtual Private Server (VPS) or php host
|
||||
|
||||
### DEMO
|
||||
|
||||
null
|
||||
|
||||
### How to Install
|
||||
|
||||
1. Start web service on your server (httpd or other), make sure you can visit it.
|
||||
|
||||
2. Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
|
||||
|
||||
3. Upload code.
|
||||
|
||||
4. Change the file .data/config.php can be read&write (666 is suggested).
|
||||
|
||||
5. View the website in chrome or other.
|
||||
|
||||
----
|
||||
|
||||
# Features
|
||||
|
||||
When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
|
||||
|
||||
When uploading files, the program produce a direct url, visitor upload files to MS OFFICE via the direct url, the server expend a few bandwidth in produce.
|
||||
|
||||
The XXX_path in setting is the path in Onedrive, not in url, program will find the path in Onedrive.
|
||||
|
||||
LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited.
|
||||
|
||||
Program will show content of 'readme.md' & 'head.md'.
|
||||
|
||||
guest upload path, is a folder that the guest can upload files, but can not be list (exclude admin).
|
||||
|
||||
If there is 'index.html' file, program will only show the content of 'index.html', not list the files.
|
||||
|
||||
Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
|
||||
|
||||
----
|
||||
|
||||
# Functional files
|
||||
|
||||
### favicon.ico
|
||||
|
||||
put it in the showing home folder of FIRST disk (maybe not root of onedrive).
|
||||
|
||||
### index.html
|
||||
|
||||
show content of index.html as html.
|
||||
|
||||
### head.md
|
||||
|
||||
### readme.md
|
||||
|
||||
it will showed at top or bottom as markdown.
|
||||
|
||||
### head.omf
|
||||
|
||||
### foot.omf
|
||||
|
||||
it will showed at top or bottom as html (javascript works!).
|
||||
|
||||
----
|
||||
|
||||
# A cup of coffee
|
||||
|
||||
https://paypal.me/qkqpttgf
|
||||
|
||||
-----
|
||||
|
||||
# Chat
|
||||
|
||||
### Telegram Group
|
||||
|
||||
https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
|
||||
# NOTICE: the release is used as archive.
|
||||
# 注意:release只是用来存档的。
|
||||
Please read the descriptions of settings before raising an issue.
|
||||
请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
|
||||
|
||||
# Deploy to Heroku
|
||||
Official: https://heroku.com
|
||||
Demo: https://herooneindex.herokuapp.com/
|
||||
|
||||
How to Install:
|
||||
> ~~Click the button [](https://heroku.com/deploy) to Deploy a new app~~(`"We couldn't deploy your app because the source code violates the Salesforce Acceptable Use and External-Facing Services Policy."`)
|
||||
> Fork this project, create a heroku app, then turn to Deploy tab, deploy via connect to your github fork.
|
||||
|
||||
|
||||
# Deploy to Glitch
|
||||
Official: https://glitch.com/
|
||||
Demo: https://onemanager.glitch.me/
|
||||
|
||||
How to Install: New Project -> Import form Github -> paste "https://github.com/qkqpttgf/OneManager-php", after done, Show -> In a New Window.
|
||||
|
||||
|
||||
# Deploy to Vercel
|
||||
Official: https://vercel.com/
|
||||
Demo: null
|
||||
Notice:
|
||||
> 1, you must wait 30-50s to make sure deploy READY after change config;
|
||||
> 2, Vercel limit 100 deploy every day.
|
||||
|
||||
How to Install: https://scfonedrive.github.io/Vercel/Deploy.html .
|
||||
|
||||
|
||||
# Deploy to Tencent Serverless Cloud Function (SCF 腾讯无服务器云函数)
|
||||
Official: https://cloud.tencent.com/product/scf
|
||||
DEMO: 无
|
||||
注意:SCF新增限制,环境变量整体最大4KB,所以最多添加4个盘。
|
||||
|
||||
How to Install:
|
||||
1,进入函数服务,上方选择地区,然后点击新建。
|
||||
2,输入函数名称,选择模板函数,在模糊搜索中输入onedrive,大小写随意,选择那个【获取onedrive信息.....】,点下一步,在代码界面不用动,直接点完成。
|
||||
3,点击触发管理,创建触发器,触发方式改成API网关触发,底下勾选启用集成响应,提交。
|
||||
4,在触发管理中可以看到一个 访问路径,访问它,开始安装。
|
||||
|
||||
(重点:勾选集成响应)
|
||||
|
||||
添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。
|
||||
|
||||
|
||||
# Deploy to Huawei cloud Function Graph (FG 华为云函数工作流)
|
||||
Official: https://console.huaweicloud.com/functiongraph/
|
||||
DEMO: 无
|
||||
注意:FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive)。
|
||||
|
||||
How to Install:
|
||||
1,在函数列表,点右边创建函数
|
||||
2,输入名称,选择运行时语言为PHP7.3,点上传ZIP文件,选择文件,然后点右边的创建函数(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
|
||||
3,创建触发器:选API网关,安全认证选None,后端超时(毫秒)将5000改成30000,上面创建分组一下,其它的点点点
|
||||
4,访问触发器给的url,开始安装
|
||||
5,在触发器界面点触发器名称,跳到API网关管理,右边更多URL,可以添加自定义域名,自定义域名后发现还是要 xxxx.com/函数名 来访问,点上方的编辑,第1页不用改,点下一步,请求Path改成/,注意匹配模式是前缀匹配,Method为ANY,然后不用点下一步了,点立即完成,然后去发布生效
|
||||
|
||||
|
||||
# Deploy to Aliyun Function Compute (FC 阿里云函数计算)
|
||||
Official: https://fc.console.aliyun.com/
|
||||
DEMO: 无
|
||||
|
||||
How to Install:
|
||||
1,新建函数 -- HTTP函数
|
||||
2,运行环境选择php7.2
|
||||
3,触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个
|
||||
4,上传代码
|
||||
5,触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。
|
||||
6,访问你的域名,开始安装
|
||||
|
||||
|
||||
# Deploy to Baidu Cloud Function Compute (CFC 百度云函数计算)
|
||||
Official: https://console.bce.baidu.com/cfc/#/cfc/functions
|
||||
DEMO: 无
|
||||
自定义域名需要另外使用API网关,并备案。
|
||||
|
||||
How to Install:
|
||||
1,在函数列表,点创建函数
|
||||
2,创建方式改为空白函数,点下一步
|
||||
3,输入名称,选择运行时为PHP7.2,点下一步
|
||||
4,触发器:下拉选择HTTP触发器,URL路径填 /{filepath+} ,HTTP方法全选,身份验证:不验证,点提交
|
||||
5,进入代码编辑页,编辑类型改上传函数ZIP包,选择文件(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。),开始上传
|
||||
6,点击右边触发器,复制并访问提供的url,开始安装
|
||||
|
||||
|
||||
# Deploy to Virtual Private Server (VPS 或空间)
|
||||
DEMO: 无
|
||||
How to Install:
|
||||
1.Start web service on your server (httpd or other), make sure you can visit it.
|
||||
启动web服务器,确保你能访问到。
|
||||
2.Make the rewrite works, the rule is in .htaccess file, make sure any query redirect to index.php.
|
||||
开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
|
||||
3.Upload code.
|
||||
上传好代码。
|
||||
4.Change the file .data/config.php can be read&write (666 is suggested).
|
||||
使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
|
||||
5.View the website in chrome or other.
|
||||
在浏览器中访问。
|
||||
|
||||
|
||||
# Features 特性
|
||||
When downloading files, the program produce a direct url, visitor download files from MS OFFICE via the direct url, the server expend a few bandwidth in produce.
|
||||
下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
|
||||
When uploading files, the program produce a direct url, visitor upload files to MS OFFICE via the direct url, the server expend a few bandwidth in produce.
|
||||
上传时,由程序生成上传url,浏览器直接向微软Onedrive的这个url上传文件,服务器只消耗与微软通信的少量流量。
|
||||
The XXX_path in setting is the path in Onedrive, not in url, program will find the path in Onedrive.
|
||||
设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径。
|
||||
LOGO ICON: put your 'favicon.ico' in the path you showed, make sure xxxxx.com/favicon.ico can be visited.
|
||||
网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到。
|
||||
Program will show content of 'readme.md' & 'head.md'.
|
||||
可以在文件列表显示head.md跟readme.md文件的内容。
|
||||
guest up path, is a folder that the guest can upload files, but can not be list (exclude admin).
|
||||
游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。
|
||||
If there is 'index.html' file, program will only show the content of 'index.html', not list the files.
|
||||
如果目录中有index.html文件,只会输出显示html文件,不显示程序框架。
|
||||
Click 'EditTime' or 'Size', the list will sort by time or size, Click 'File' can resume sort.
|
||||
点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
|
||||
|
||||
# Functional files 功能性文件
|
||||
### favicon.ico
|
||||
put it in the showing home folder of FIRST disk (maybe not root of onedrive). 放在第一个盘的显示目录(不一定是onedrive根目录)。
|
||||
### index.html
|
||||
show content of index.html as html. 将index.html以静态网页显示出来。
|
||||
### head.md readme.md
|
||||
it will showed at top or bottom as markdown. 以MD语法显示在顶部或底部。
|
||||
### head.omf foot.omf
|
||||
it will showed at top or bottom as html (javascript works!). 以html显示在顶部或底部(可以跑js)。
|
||||
|
||||
# A cup of coffee
|
||||
https://paypal.me/qkqpttgf
|
||||
|
||||
# Chat
|
||||
QQ Group: 212088653 (请看完上面的中英双语再加群,谢谢!)
|
||||
Telegram Group: https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
|
||||
|
|
246
readme_cn.md
246
readme_cn.md
|
@ -1,246 +0,0 @@
|
|||
[Readme EN](readme.md)
|
||||
|
||||
# 注意:
|
||||
|
||||
release只是当存档用的。
|
||||
|
||||
请将设置中所有的设置项的说明都读一遍,有些问题就不用问了。
|
||||
|
||||
---
|
||||
|
||||
# 部署到 Heroku
|
||||
|
||||
### 官网
|
||||
|
||||
https://heroku.com
|
||||
|
||||
### Demo
|
||||
|
||||
https://herooneindex.herokuapp.com/
|
||||
|
||||
### 安装
|
||||
|
||||
> 给这个项目点star,然后fork,在Heroku创建一个app,然后点进Deploy页,在"Deployment method"处点"Connect GitHub",选择你的fork。
|
||||
|
||||
---
|
||||
|
||||
# 部署到 Glitch
|
||||
|
||||
### 官网
|
||||
|
||||
https://glitch.com/
|
||||
|
||||
### Demo
|
||||
|
||||
https://onemanager.glitch.me/
|
||||
|
||||
### 安装
|
||||
|
||||
点 [New Project] -> 点 [Import form Github] -> 粘贴 "https://github.com/qkqpttgf/OneManager-php" ,结束后,左上角点 [Show] -> [In a New Window]。
|
||||
|
||||
---
|
||||
|
||||
# 部署到 Vercel
|
||||
|
||||
### 官网
|
||||
|
||||
https://vercel.com/
|
||||
|
||||
### Demo
|
||||
|
||||
https://onemanager-php.vercel.app/
|
||||
|
||||
### 注意
|
||||
|
||||
> 1. 每次更改配置后都要等 30-50s 来确保部署成功;
|
||||
>
|
||||
> 2. Vercel 每天限制 100 次部署。
|
||||
|
||||
### 安装(英文)
|
||||
|
||||
https://scfonedrive.github.io/Vercel/Deploy.html
|
||||
|
||||
---
|
||||
|
||||
# 部署到腾讯无服务器云函数 Serverless Cloud Function (SCF)
|
||||
|
||||
### 官网
|
||||
|
||||
https://cloud.tencent.com/product/scf
|
||||
|
||||
### DEMO
|
||||
|
||||
暂无
|
||||
|
||||
### 注意事项
|
||||
|
||||
SCF新增限制,环境变量整体最大4KB,所以最多添加4个盘(可以在安装时选择将配置保存在文件来避开限制)。
|
||||
|
||||
### 安装
|
||||
|
||||
1. 进入函数服务,上方选择地区,然后点击新建。
|
||||
|
||||
2. 输入函数名称,选择模板函数,在模糊搜索中输入onedrive,大小写随意,选择那个【获取onedrive信息.....】,点下一步,在代码界面不用动,直接点完成。
|
||||
|
||||
3. 点击触发管理,创建触发器,触发方式改成API网关触发,底下勾选启用集成响应,提交。
|
||||
|
||||
4. 在触发管理中可以看到一个 访问路径,访问它,开始安装。
|
||||
|
||||
(重点:**勾选集成响应**)
|
||||
|
||||
> **添加网盘时,SCF可能会反应不过来,不跳转到微软,导致添加失败,请不要删除这个盘,再添加一次相同标签的盘就可以了。**
|
||||
|
||||
----
|
||||
|
||||
|
||||
# 部署到华为云函数工作流 Function Graph (FG)
|
||||
|
||||
### 官网
|
||||
|
||||
https://console.huaweicloud.com/functiongraph/
|
||||
|
||||
### DEMO
|
||||
|
||||
暂无
|
||||
|
||||
### 注意事项
|
||||
|
||||
FG中,环境变量整体大小为2KB,所以最多添加2个盘(一个onedrive一个aliyundrive)(可以在安装时选择将配置保存在文件来避开限制)。
|
||||
|
||||
### 安装
|
||||
|
||||
1. 在函数列表,点右边创建函数
|
||||
2. 输入名称,选择运行时语言为PHP7.3,点上传ZIP文件,选择文件,然后点右边的创建函数(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。)
|
||||
3. 创建触发器:选API网关,安全认证选None,后端超时(毫秒)将5000改成30000,上面创建分组一下,其它的点点点
|
||||
4. 访问触发器给的url,开始安装
|
||||
5. 在【触发器界面】点【触发器名称】,跳到API网关管理,右边【更多URL】,可以添加自定义域名,自定义域名后发现还是要 xxxx.com/函数名 来访问,点上方的【编辑】,第1页不用改,点【下一步】,**请求Path改成/**,注意匹配模式是前缀匹配,Method为ANY,然后不用点下一步了,点【立即完成】,然后去【发布】生效
|
||||
|
||||
----
|
||||
|
||||
# 部署到阿里云函数计算 Function Compute (FC)
|
||||
|
||||
### 官网
|
||||
|
||||
https://fc.console.aliyun.com/
|
||||
|
||||
### DEMO
|
||||
|
||||
无
|
||||
|
||||
### 安装
|
||||
|
||||
1. 新建函数 -- HTTP函数
|
||||
2. 运行环境选择php7.2
|
||||
3. 触发器认证方式选择anonymous,请求方式里面,点一下GET,再点一下POST,最终框框里面有这2个
|
||||
4. 上传代码
|
||||
5. 触发器中点进去,找到配置自定义域名,点击前往,创建,路径中填 /* ,其它下拉选择。
|
||||
6. 访问你的域名,开始安装
|
||||
|
||||
---
|
||||
|
||||
# 部署到百度云函数计算 Cloud Function Compute (CFC)
|
||||
|
||||
### 官网
|
||||
|
||||
https://console.bce.baidu.com/cfc/#/cfc/functions
|
||||
|
||||
### DEMO
|
||||
|
||||
暂无
|
||||
|
||||
### 注意事项
|
||||
|
||||
**自定义域名需要另外使用API网关,并备案。**
|
||||
|
||||
### 安装
|
||||
|
||||
1. 在函数列表,点创建函数
|
||||
2. 创建方式改为空白函数,点下一步
|
||||
3. 输入名称,选择运行时为PHP7.2,点下一步
|
||||
4. 触发器:下拉选择HTTP触发器,URL路径填 /{filepath+} ,HTTP方法全选,身份验证:不验证,点提交
|
||||
5. 进入代码编辑页,编辑类型改上传函数ZIP包,选择文件(这里的ZIP文件不能直接用从Github上下载的ZIP文件,要将它解压后,去掉外层文件夹后,再压缩为ZIP。),开始上传
|
||||
6. 点击右边触发器,复制并访问提供的url,开始安装
|
||||
|
||||
---
|
||||
|
||||
# 部署到VPS (Virtual Private Server) 或 空间
|
||||
|
||||
### DEMO
|
||||
|
||||
暂无
|
||||
|
||||
### 安装
|
||||
|
||||
1. 启动web服务器,确保你能访问到。
|
||||
|
||||
2. 开启伪静态(重写)功能,规则在.htaccess文件中,ngnix从里面复制,我们的目的是不管访问什么都让index.php来处理。
|
||||
|
||||
3. 上传好代码。
|
||||
|
||||
4. 使web身份可读写代码中的.data/config.php文件,推荐chmod 666 .data/config.php。
|
||||
|
||||
5. 在浏览器中访问。
|
||||
|
||||
----
|
||||
|
||||
# 特性
|
||||
|
||||
下载时,由程序解析出直链,浏览器直接从微软Onedrive服务器下载文件,服务器只消耗与微软通信的少量流量。
|
||||
|
||||
上传时,由程序生成上传url,浏览器直接向微软Onedrive的这个url上传文件,服务器只消耗与微软通信的少量流量。
|
||||
|
||||
设置中的 XXX_path 是Onedrive里面的路径,并不是你url里面的,程序会去你Onedrive里面找这个路径。
|
||||
|
||||
网站图标:将favicon.ico文件放在你要展示的目录中,确保 xxxxx.com/favicon.ico 可以访问到。
|
||||
|
||||
可以在文件列表显示head.md跟readme.md文件的内容。
|
||||
|
||||
游客上传目录(也叫图床目录),是指定一个目录,让游客可以上传文件,不限格式,不限大小。这个目录里面的内容不列清单(除非管理登录)。
|
||||
|
||||
如果目录中有index.html文件,只会输出显示html文件,不显示程序框架。
|
||||
|
||||
点击“时间”、“大小”,可以排序显示,点“文件”恢复原样。
|
||||
|
||||
----
|
||||
|
||||
# 功能性文件
|
||||
|
||||
### favicon.ico
|
||||
|
||||
放在第一个盘的显示目录(不一定是onedrive根目录)。
|
||||
|
||||
### index.html
|
||||
|
||||
将index.html以静态网页显示出来。
|
||||
|
||||
### head.md
|
||||
|
||||
### readme.md
|
||||
|
||||
以MD语法显示在顶部或底部。
|
||||
|
||||
### head.omf
|
||||
|
||||
### foot.omf
|
||||
|
||||
以html显示在顶部或底部(可以跑js)。
|
||||
|
||||
----
|
||||
|
||||
# 捐赠
|
||||
|
||||
https://paypal.me/qkqpttgf
|
||||
|
||||
-----
|
||||
|
||||
# 群聊
|
||||
|
||||
**请看完上面的中英双语再加群,谢谢!**
|
||||
|
||||
### QQ 群:
|
||||
|
||||
212088653
|
||||
|
||||
### Telegram Group
|
||||
|
||||
https://t.me/joinchat/I_RVc0bqxuxlT-d0cO7ozw
|
|
@ -94,12 +94,12 @@
|
|||
</ul></li>
|
||||
<!--AdminEnd-->
|
||||
|
||||
<!--<select class="changelanguage" name="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)">
|
||||
<select class="changelanguage" name="language" onchange="changelanguage(this.options[this.options.selectedIndex].value)">
|
||||
<option value="">Language</option>
|
||||
<!--SelectLanguageStart-->
|
||||
<option value="<!--SelectLanguageKey-->" <!--SelectLanguageSelected-->><!--SelectLanguageValue--></option>
|
||||
<!--SelectLanguageEnd-->
|
||||
</select>-->
|
||||
</select>
|
||||
</div>
|
||||
<!--NeedUpdateStart-->
|
||||
<div style='position:absolute;'><font color='red'><!--constStr@NeedUpdate--></font></div>
|
||||
|
@ -202,7 +202,6 @@
|
|||
<div id="txt">
|
||||
<!--AdminStart-->
|
||||
<form id="txt-form" action="" method="POST">
|
||||
<input name="_admin" type="hidden" value="">
|
||||
<a onclick="document.getElementById('txt-a').readOnly='';document.getElementById('txt-save').style.display='';document.getElementById('txt-editbutton').style.display='none';document.getElementById('txt-cancelbutton').style.display='';" id="txt-editbutton"><ion-icon name="create"></ion-icon><!--constStr@ClicktoEdit--></a>
|
||||
<a onclick="document.getElementById('txt-a').readOnly='readonly';document.getElementById('txt-save').style.display='none';document.getElementById('txt-editbutton').style.display='';document.getElementById('txt-cancelbutton').style.display='none';" id="txt-cancelbutton" style="display:none"><ion-icon name="close"></ion-icon><!--constStr@CancelEdit--></a>
|
||||
<a id="txt-save" style="display:none"><ion-icon name="save"></ion-icon><!--constStr@Save--></a>
|
||||
|
@ -210,12 +209,6 @@
|
|||
<textarea id="txt-a" name="editfile" readonly style="width: 100%; margin-top: 2px;" <!--AdminStart-->onchange="document.getElementById('txt-save').onclick=function(){document.getElementById('txt-form').submit();}"<!--AdminEnd--> ><!--TxtContent--></textarea>
|
||||
<!--AdminStart-->
|
||||
</form>
|
||||
<script>
|
||||
var inputAdminStorage = document.getElementsByName("_admin");
|
||||
for (i=0;i<inputAdminStorage.length;i++) {
|
||||
inputAdminStorage[i].value = localStorage.getItem("admin");
|
||||
}
|
||||
</script>
|
||||
<!--AdminEnd-->
|
||||
</div>
|
||||
<!--IstxtFileEnd-->
|
||||
|
@ -529,10 +522,7 @@
|
|||
<!--IsFileStart-->
|
||||
var $url = document.getElementById('url');
|
||||
if ($url) {
|
||||
//$url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
|
||||
let url = location.href;
|
||||
url = url.substr(0, url.length-8);
|
||||
$url.innerHTML = url.replace(/&/g, '&amp;');
|
||||
$url.innerHTML = location.protocol + '//' + location.host + $url.innerHTML;
|
||||
$url.style.height = $url.scrollHeight + 'px';
|
||||
}
|
||||
<!--IsofficeFileStart-->
|
||||
|
@ -998,7 +988,7 @@
|
|||
delete uploading[upbigfilename];
|
||||
}
|
||||
}
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5 + '&_admin=' + localStorage.getItem("admin"));
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified +'&filemd5='+ filemd5);
|
||||
<!--GuestStart-->
|
||||
}
|
||||
}
|
||||
|
@ -1249,7 +1239,7 @@
|
|||
getuplink(i);
|
||||
}*/
|
||||
}
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize + '&_admin=' + localStorage.getItem("admin"));
|
||||
xhr1.send('upbigfilename='+ upbigfilename +'&filesize='+ file.size +'&filelastModified='+ file.lastModified + '&filesha1=' + filesha1 + '&chunksize=' + chunksize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1335,7 +1325,7 @@
|
|||
}
|
||||
delete uploading[filename];
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']) + '&_admin=' + localStorage.getItem("admin"));
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
} else {
|
||||
var binary = this.result;
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
@ -1406,7 +1396,7 @@
|
|||
}
|
||||
delete uploading[filename];
|
||||
}
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']) + '&_admin=' + localStorage.getItem("admin"));
|
||||
xhr1.send('uploadid=' + uploadid + '&fileid=' + fileid + '&etag=' + JSON.stringify(res['ETag']));
|
||||
// uploadbuttonshow();
|
||||
} else {
|
||||
readblob(asize);
|
||||
|
@ -1449,7 +1439,7 @@
|
|||
var expd = new Date();
|
||||
expd.setTime(expd.getTime()+1000);
|
||||
var expires = "expires="+expd.toGMTString();
|
||||
document.cookie = "admin=; path=<!--base_path-->; "+expires;
|
||||
document.cookie = "admin=; path=/; "+expires;
|
||||
location.href = location.href;
|
||||
}
|
||||
/*for some mobile browser*/
|
||||
|
@ -1543,7 +1533,7 @@
|
|||
document.getElementById(str+'_div').style.display='none';
|
||||
document.getElementById('mask').style.display='none';
|
||||
}
|
||||
xhr.send(serializeForm(str+'_form') + '&_admin=' + localStorage.getItem("admin"));
|
||||
xhr.send(serializeForm(str+'_form'));
|
||||
return false;
|
||||
}
|
||||
function addelement(html) {
|
||||
|
|
|
@ -49,29 +49,14 @@
|
|||
.more-disk a{flex-grow: 1;text-align: center;font-size: 15px;padding:14px 20px;transition-duration: 0.4s;background-color: #f4f5f8; color: #353535;display: inline-block;}
|
||||
.more-disk a:hover, .more-disk a[now]{ background-color: rgb(79 116 220); color: white; }
|
||||
.list-table{width:100%;padding:0 20px 20px 20px;border-spacing:0}
|
||||
.list-table tr{height:2rem; line-height: 1.5rem;}
|
||||
.list-table tr{height:33px}
|
||||
.list-table tr[data-to]:hover{background: rgb(79 116 220);color:white;}
|
||||
.list-table tr[data-to]:hover a{color:white}
|
||||
.list-table tr:first-child{background:rgba(245,245,245,0)}
|
||||
.list-table tr[data-to]:hover .operate ul li a{color:black}
|
||||
.list-table tr ion-icon {vertical-align: middle; height: 2rem;}
|
||||
.list-table td,.list-table th{padding:0 10px;text-align:left}
|
||||
.list-table td.file a {vertical-align: middle;}
|
||||
.list-table .size,.list-table .updated_at{text-align:right}
|
||||
.updated_at{width:25%}
|
||||
.size{width:15%}
|
||||
.list-table tbody.grid-view {display: flex;flex-wrap: wrap;position: relative;width: 100%;grid-template: repeat(auto-fill, 100px) / repeat(auto-fill, minmax(100px, 50%));grid-auto-rows: 100px;}
|
||||
.list-table tbody.grid-view td, .list-table tbody.grid-view th {padding:0;}
|
||||
.list-table tbody.grid-view img {height: 150px;width: 100%;object-fit: cover;position:relative;}
|
||||
.list-table tbody.grid-view #tr0{width: 100%;height: 33px;background-color: unset !important;}
|
||||
.list-table tbody.grid-view tr {width: unset;height: 150px;background-color: #efefef;margin: 2px;position: relative;flex-grow: 1;min-width: 100px;}
|
||||
.list-table tbody.grid-view td.file {display: block;width: 100%;height: 100%;}
|
||||
.list-table tbody.grid-view td.file a {width: 100%;height: 100%;display: inline-block;position:relative}
|
||||
.list-table tbody.grid-view td.file a > span {position: absolute;left: 3px;}
|
||||
.list-table tbody.grid-view td.file .download {display: none;}
|
||||
.list-table tbody.grid-view td.file ion-icon{position: absolute;top: calc(50% - 25px);left: calc(50% - 25px);width: 50px;height: 50px;color: #0002}
|
||||
.list-table tbody.grid-view td.updated_at {position: absolute;bottom: 0px;height: 1.5em;overflow-y: hidden;width: 100%;background-image: linear-gradient(#ffffff00, #0000008f);color: #fffc;z-index: 3;}
|
||||
.list-table tbody.grid-view td.size {display: none;}
|
||||
.mask{position:absolute;left:0px;top:0px;width:100%;background-color:#000;filter:alpha(opacity=50);opacity:0.5;z-index:2;}
|
||||
<!--AdminStart-->
|
||||
#top-op {position: absolute;color: white;font-size: 12px;}
|
||||
|
@ -81,6 +66,7 @@
|
|||
body .active ul{position:absolute;display:inline-table;} /*for some mobile browser */
|
||||
.operate ul li{padding:7px;list-style:none;display:block;}
|
||||
.operate ul li:hover {background-color: #f4f5f8;}
|
||||
.list-table tr[data-to]:hover .operate ul li a{color:black}
|
||||
#tr0{height: 40px;}
|
||||
<!--AdminEnd-->
|
||||
.operatediv{position:absolute;border-radius: 8px;background-color:#ffffff;z-index:2;box-shadow: 5px 5px 10px 0 #00000033;padding: 15px 4px;}
|
||||
|
@ -691,39 +677,9 @@
|
|||
}
|
||||
<!--ReadmemdEnd-->
|
||||
<!--ShowThumbnailsStart-->
|
||||
var isGrid = false;
|
||||
var isthumbLoaded = false;
|
||||
function showthumbnails(obj) {
|
||||
|
||||
images = [<!--ImgExts-->];
|
||||
var files=document.getElementsByName('filelist');
|
||||
|
||||
if (document.getElementById('originalpic').checked==true){
|
||||
if(isGrid){
|
||||
var list_body = document.getElementById('list-table').firstElementChild
|
||||
list_body.classList.remove('grid-view')
|
||||
isGrid = false
|
||||
}
|
||||
}else {
|
||||
if(!isGrid){
|
||||
// turn to grid view
|
||||
var list_body = document.getElementById('list-table').firstElementChild
|
||||
list_body.classList.add('grid-view')
|
||||
isGrid = true
|
||||
if (isthumbLoaded) {
|
||||
return
|
||||
}else {
|
||||
isthumbLoaded = true
|
||||
}
|
||||
} else {
|
||||
var list_body = document.getElementById('list-table').firstElementChild
|
||||
list_body.classList.remove('grid-view')
|
||||
isGrid = false
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for ($i=0;$i<files.length;$i++) {
|
||||
str=files[$i].innerText;
|
||||
if (str.substr(-1)==' ') str=str.substr(0,str.length-1);
|
||||
|
@ -742,7 +698,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
// obj.disabled='disabled';
|
||||
obj.disabled='disabled';
|
||||
}
|
||||
function get_thumbnails_url(url, name, filea) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
|
@ -750,7 +706,7 @@
|
|||
xhr.send('');
|
||||
xhr.onload = function(e){
|
||||
if (xhr.status==200) {
|
||||
if (xhr.responseText!='') filea.innerHTML= '<span>' + filea.innerHTML + '</span>' + '<img src="'+xhr.responseText+'" alt="'+name+'">';
|
||||
if (xhr.responseText!='') filea.innerHTML='<img src="'+xhr.responseText+'" alt="'+name+'">';
|
||||
} else console.log(xhr.status+'\n'+xhr.responseText);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,12 @@
|
|||
<!--BackgroundMEnd-->
|
||||
<script type="text/javascript">if(window.console&&window.console.log){console.log("%c Onemoe Theme %c https://github.com/kizx/onemoe-theme ","color: #fff; margin: 1em 0; padding: 5px 0; background: #673ab7;","margin: 1em 0; padding: 5px 0; background: #efefef;")}</script>
|
||||
<!--customCss-->
|
||||
<style>
|
||||
|
||||
<style>.file button {display: none;}<style>
|
||||
<style>.changelanguage {display: none;}<style>
|
||||
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
1038
theme/renexmoe.html
1038
theme/renexmoe.html
File diff suppressed because it is too large
Load Diff
246
version
246
version
|
@ -1,123 +1,123 @@
|
|||
20210820-1810.40
|
||||
because Vercel must redeploy after change Environment Variables, and it must <4k, so decide that, save config in code file. <font color=red>in Vercel, after update, please install again. if you want continue use Environment, please add a ( name: "ONEMANAGER_CONFIG_SAVE", value: "env" ) in Environment Variables in Project Settings before update.</font>
|
||||
因为Vercel修改环境变量也必须重新部署才生效,而且环境变量只能小于4k,所以决定将配置保存在代码文件中。<font color=red>升级更新后,用Vercel的请重新安装。如果还想继续使用环境变量,请在更新前,在Project Settings的Environment Variables中,新增一个( name: "ONEMANAGER_CONFIG_SAVE", value: "env" )的环境变量。</font>
|
||||
|
||||
20210817-2030.39
|
||||
fix bugs in Vercel. add wait function in operating. change update method in SCF. add payme in readme.
|
||||
修复一些Vercel上的bug。在操作完后添加等待功能,确认平台已经准备好。SCF的更新方式改变。在readme中添加讨饭链接。
|
||||
20210804-1535.38
|
||||
try fix "&"/"&" in filename. try show an img too height. change upload chunk size when upload speed>10M/s. fix forceHttps when custom domain in Glitch. fix ionicons svg lost.try use file id when rename. background (or other) based on width/height not only width. fix some bugs. Pre-Add platform Vercel, just wait bugs fixed.
|
||||
尝试修复文件名含 "&"/"&"。尝试在一屏内显示过长的图片。上传时分割的块大小随着上传速度改变。修复Glitch中使用自定义域名时forceHttps问题。修复ionicons图标失踪。尝试在重命名时使用file id来操作。背景(或其它)基于长宽来看是竖屏还是横屏,不再只看宽度。修复其它bug。预加入Vercel平台,等修复bugs。
|
||||
20210512-1648.37
|
||||
add setting "forceHttps", can force 302 jump to https. fix preview office files. fix manage in safari.fix disktag can be "home". fix some bugs.
|
||||
新增一个设置,可以强制跳转https。修复office文档预览。修复safari上点不了管理。盘的标签可以是home了,随便命名了。修复一些其它问题。
|
||||
20210331-1530.36
|
||||
admin can only use classic theme after admin login, and guest can not change theme now. fix: Sharelink can not work in php8. show disk space. limit 5 files in uploading. do with activityLimitReached. fix some bugs.
|
||||
暂时解决昨天阿里云盘最新防盗链。管理登录后只能用classic主题,游客不能再切换主题了。修复Sharelink在php8下不能正常工作。显示盘空间。同时上传文件数限制5个。对activityLimitReached稍微处理。修复一些bug。
|
||||
20210313-1352.35
|
||||
use driveId, after update, <font color="red">Aliyundrive and Googledrive please click the Change link after Driver type</font>. try fix: php8 will run error 500. change layout in settup. fix: uploading non-englist file name. try fix: sha1 a big file.
|
||||
换用driveId,更新后<font color="red">Aliyundrive与Googledrive请点一下那个切换链接</font>。尝试修复php8的500 ERROR。改变设置页面的布局。修复上传中文名文件时最终文件以url代码命名。阿里云盘上传时可以sha1大文件了。
|
||||
20210311-2004.34
|
||||
try fix: can not login, sha1.js not loaded(changed a cdn), show error log.
|
||||
尝试修复登录不了的情况:可能sha1.js没有载入(换了源),在登录页显示出错信息。
|
||||
20210309-1718.33
|
||||
Googledrive can operate now, but the uploading can not done on explorer without token. Onedrive try deal with activeLimit. Can change admin password now. Admin password will sha1 when submitting. Fix some bugs.
|
||||
Googledrive可以管理操作了,但因为没法在浏览器端不带token上传,所以上传操作作罢。Onedrive尝试处理activeLimit。可以修改admin密码了。登录等提交admin密码时,会sha1加密再提交。修复一些bug。
|
||||
20210301-1745.32
|
||||
Onedrive client secret extend. export&import config. adding Googledrive. add reffer: only listing domains can refer. add diskDescription: tips of disk. Heroku change function_name to HerokuappId. try fix domainforproxy. fix create in Aliyundrive. fix other bugs.
|
||||
Onedrive 的client延期。可以导入导出配置了。初步添加Googledrive。添加reffer:只有指定域名能引用。添加diskDescription:可以对盘备注了。Heroku中将function_name改为使用HerokuappId。尝试修复domainforproxy在个人帐号时的问题。修复阿里云盘不能新建与加密。修复其它bug。
|
||||
20210118-1600.31
|
||||
can change Ondrive to Sharepoint, can copy a disk. fix a bug that 500 error in setup.
|
||||
Onedrive跟Sharepoint可以切换了,可以复制一个盘。修复bug。
|
||||
20210115-1111.30
|
||||
<font color=red>v3, after update, please AddDisk again, please set passfile again.</font> themes of php deleted, or you can use branch v2_last.
|
||||
<font color=red>v3,一键升级后请重新添加盘,passfile失效,重新设置。</font>php主题删掉了,要么就用v2_last分支。
|
||||
20201229.29
|
||||
Modify tags, change sequence of disk.
|
||||
可以修改标签,移动标签顺序。
|
||||
20201215-1400.28
|
||||
fix: hackers can upload files to ANY folder (or create a new folder) in your Onedrive. add language zh-tw. now, on heroku, xhr can post. fix: 2 or more space in file name cause bugs.
|
||||
修复:构造代码后可以上传文件到你Onedrive的任意目录(甚至创建新目录)。新增zh-tw语言。xhr的post在heroku会接收了,改回post。修复:文件名有多个空格相连时造成bug。
|
||||
20201106-1730.27
|
||||
Add theme. A code used in CloudFlare Workers. Admin not need password in folder. Add caddy2 rewrite rule. Add new platform Glitch. <font color=red>web hosting and VPS user should backup your config.php, after update, copy it to .data foloder.</font>
|
||||
添加主题。添加一段用于CF workers的代码。加密目录管理员不需要密码了。添加caddy2伪静态。新增Glitch平台。<font color=red>虚拟主机与VPS用户请备份config.php,升级后,手动将它覆盖到.data目录。</font>
|
||||
20200828-1420.26
|
||||
nginx rewrite rule exclude .well-known folder, as auto SSL. add web.config to rewrite in IIS. now in windwos can do with \ in path. in aliyun FC & huawei FG API, use my code. CN 21Vianet client_id&secret expire. update description now only show new.
|
||||
nginx的伪静态中排除.well-known目录,方便自动SSL。添加IIS的伪静态。与linux不同,处理windows下目录用\分隔。FC、FG中使用自己代码对接平台。<font color=red>世纪互联旧API即将过期失效,升级后世纪互联的盘需要删除重新添加。</font>更新说明只显示部分。
|
||||
20200817-1740.25
|
||||
when multy disks, now will default show disks as folders in root, if set autoJumpFirstDisk 1, it will auto jump to first disk.
|
||||
多盘时,在网站根目录,默认会将各盘当成文件夹显示,可以去设置中设置autoJumpFirstDisk为1,这样可以跟以前一样自动跳到第一个盘。
|
||||
20200816-1145.24
|
||||
add platform: Baidu CFC. add setting: mobile background.
|
||||
新增百度CFC平台。可以分别设置PC与手机的背景。
|
||||
20200808-1130.23
|
||||
FG: select save in env or file.
|
||||
在FG中安装时,选择配置保存在环境变量还是文件中。
|
||||
20200806-1130.23
|
||||
SCF: select save in env or file.
|
||||
在SCF中安装时,选择配置保存在环境变量还是文件中。
|
||||
20200804-1453.22
|
||||
fix: once error will stop the after files in uploading multy files. SCF can get region now, change install. SCF config save in code file now not in env, <font color=red>if use SCF, you must reinstall after update</font>.
|
||||
修复,当上传多个文件时,一个文件出错将导致后续文件不再上传。SCF可以获取到region了,安装过程修改。在SCF中,现在将配置保存到代码文件中,不受环境变量4K大小限制,<font color=red>升级后,用SCF的要重装</font>。
|
||||
20200723-1430.21
|
||||
fix content-type in "?json". can not custom microsoft API id & secret by a link now, so show the return uri.
|
||||
当使用"?json"时,现在content-type是json了。现在微软不能一键创建API应用了,提供回调URI。
|
||||
20200713-1800.20
|
||||
add platform: Huawei cloud Function Graph. now you can use "?json" to get a json of folder or file. fix some bug.
|
||||
新增白嫖平台:华为云函数工作流FG。可以用"?json"来获得目录或文件的json。修复bug。
|
||||
20200607-1856.19
|
||||
add platform: Aliyun Function Compute. add setting: replace sharepoint.com to a proxy server name. add setting: disableShowThumb,customTheme. add function: php hosting website can update by a click
|
||||
现在可以安装到阿里函数计算FC了。php空间可以一键更新了。可以设置某个盘替换sharpoint.com域名为你的反代域名。新增disableShowThumb,customTheme。
|
||||
20200503-1848.18
|
||||
Rebuild theme. Add custom Css & custom Script, add FunctionalityFile: head.omf & foot.omf.
|
||||
重建主题文件结构。增加自定义css与自定义script。增加2个功能文件:head.omf、foot.omf。
|
||||
20200402-1830.17
|
||||
Oneclick update can select which branch to update. Now use the accept language instead of the language config.
|
||||
一键更新可以选择哪个分支了。现在开始使用浏览器语言,抛弃language设置。
|
||||
20200326-0001.16
|
||||
You can add sharepoint site drive as a disk, <font color=red>you must reinstall after update</font>.
|
||||
可以将sharepoint网站添加成一个盘,<font color=red>由于结构改变,升级后只能重装</font>。
|
||||
20200321-1830.15
|
||||
本次更新后,'index.html'功能在其它主题会导致bug。
|
||||
文本类文件将缓存;添加hideFunctionalityFile开关;在添加网盘时会显示已经在用的标签。
|
||||
after this update, then 'index.html' function will bug in other theme.
|
||||
cache text file content;add hideFunctionalityFile;list exist disktags when AddDisk。
|
||||
20200311-2150.14
|
||||
Add a switch, can download a known file or not, while the folder is encrypted.
|
||||
Hide time and size in mobile.
|
||||
Now, you can get a random 'jpg' from a folder when you type '?random=jpg' after the folder.
|
||||
增加一个开关,在目录加密后能否下载其中的某个文件。
|
||||
在手机上浏览时,隐藏修改时间跟大小。
|
||||
加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。
|
||||
20200229-1300.13
|
||||
In SCF, some config can input Special symbols now, like ?&= 。
|
||||
在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。
|
||||
20200225-1310.12
|
||||
Can update by one click any time. fix bugs: special tag, reupload.
|
||||
可以不管版本直接一键更新(覆盖)了。修复可以使用特殊onedrive标签的bug,修复断网续传的问题。
|
||||
20200222-2130.11
|
||||
you can set background now. fix bug: 2nd disk upload.
|
||||
可以设置背景图片了。第2个盘上传后链接不对。
|
||||
20200222-1700.09
|
||||
Can copy file and folder now.
|
||||
可以复制文件跟目录了。
|
||||
20200220-1220.08
|
||||
Multy Mode! You can add more Onedrive in one project (bind Onedrive in setup). And now, heroku apps can update in setup!
|
||||
多盘来了,在设置中添加Onedrive,另,heroku 上也能一键更新了!
|
||||
20200215-1850.07
|
||||
fix: head.md not show if no readme.md.
|
||||
修复当没有readme的时候就不显示head的问题。
|
||||
20200215-1700.06
|
||||
classic theme can read the head.md file now.
|
||||
classic主题可以处理head.md文件了。
|
||||
20200202-2010.05
|
||||
refresh token expires in 90 day, save a new token per month. classic theme add some icon for admin.
|
||||
refresh token 90天过期,所以每月保存一个新的token。classic主题加了点管理图标。
|
||||
20200129-2050.04
|
||||
if there is 'index.html', then do not show file but show the index.html, except admin.
|
||||
如果有index.html,就不显示文件列表了,直接显示index.html内容,除非是管理员。
|
||||
20200120.02
|
||||
fix domain_path do not work. domain_path正常工作了。
|
||||
20200118.01
|
||||
Can be deploy to heroku/SCF/normal space. SCF、heroku、普通VPS,三种环境都可以用了。
|
||||
Change imgup_path to guestup_path, plz make sure it after update. 将imgup_path改成guestup_path更符合用途,更新后请注意更改。
|
||||
20210820-1810.40
|
||||
because Vercel must redeploy after change Environment Variables, and it must <4k, so decide that, save config in code file. <font color=red>in Vercel, after update, please install again. if you want continue use Environment, please add a ( name: "ONEMANAGER_CONFIG_SAVE", value: "env" ) in Environment Variables in Project Settings before update.</font>
|
||||
因为Vercel修改环境变量也必须重新部署才生效,而且环境变量只能小于4k,所以决定将配置保存在代码文件中。<font color=red>升级更新后,用Vercel的请重新安装。如果还想继续使用环境变量,请在更新前,在Project Settings的Environment Variables中,新增一个( name: "ONEMANAGER_CONFIG_SAVE", value: "env" )的环境变量。</font>
|
||||
|
||||
20210817-2030.39
|
||||
fix bugs in Vercel. add wait function in operating. change update method in SCF. add payme in readme.
|
||||
修复一些Vercel上的bug。在操作完后添加等待功能,确认平台已经准备好。SCF的更新方式改变。在readme中添加讨饭链接。
|
||||
20210804-1535.38
|
||||
try fix "&"/"&" in filename. try show an img too height. change upload chunk size when upload speed>10M/s. fix forceHttps when custom domain in Glitch. fix ionicons svg lost.try use file id when rename. background (or other) based on width/height not only width. fix some bugs. Pre-Add platform Vercel, just wait bugs fixed.
|
||||
尝试修复文件名含 "&"/"&"。尝试在一屏内显示过长的图片。上传时分割的块大小随着上传速度改变。修复Glitch中使用自定义域名时forceHttps问题。修复ionicons图标失踪。尝试在重命名时使用file id来操作。背景(或其它)基于长宽来看是竖屏还是横屏,不再只看宽度。修复其它bug。预加入Vercel平台,等修复bugs。
|
||||
20210512-1648.37
|
||||
add setting "forceHttps", can force 302 jump to https. fix preview office files. fix manage in safari.fix disktag can be "home". fix some bugs.
|
||||
新增一个设置,可以强制跳转https。修复office文档预览。修复safari上点不了管理。盘的标签可以是home了,随便命名了。修复一些其它问题。
|
||||
20210331-1530.36
|
||||
admin can only use classic theme after admin login, and guest can not change theme now. fix: Sharelink can not work in php8. show disk space. limit 5 files in uploading. do with activityLimitReached. fix some bugs.
|
||||
暂时解决昨天阿里云盘最新防盗链。管理登录后只能用classic主题,游客不能再切换主题了。修复Sharelink在php8下不能正常工作。显示盘空间。同时上传文件数限制5个。对activityLimitReached稍微处理。修复一些bug。
|
||||
20210313-1352.35
|
||||
use driveId, after update, <font color="red">Aliyundrive and Googledrive please click the Change link after Driver type</font>. try fix: php8 will run error 500. change layout in settup. fix: uploading non-englist file name. try fix: sha1 a big file.
|
||||
换用driveId,更新后<font color="red">Aliyundrive与Googledrive请点一下那个切换链接</font>。尝试修复php8的500 ERROR。改变设置页面的布局。修复上传中文名文件时最终文件以url代码命名。阿里云盘上传时可以sha1大文件了。
|
||||
20210311-2004.34
|
||||
try fix: can not login, sha1.js not loaded(changed a cdn), show error log.
|
||||
尝试修复登录不了的情况:可能sha1.js没有载入(换了源),在登录页显示出错信息。
|
||||
20210309-1718.33
|
||||
Googledrive can operate now, but the uploading can not done on explorer without token. Onedrive try deal with activeLimit. Can change admin password now. Admin password will sha1 when submitting. Fix some bugs.
|
||||
Googledrive可以管理操作了,但因为没法在浏览器端不带token上传,所以上传操作作罢。Onedrive尝试处理activeLimit。可以修改admin密码了。登录等提交admin密码时,会sha1加密再提交。修复一些bug。
|
||||
20210301-1745.32
|
||||
Onedrive client secret extend. export&import config. adding Googledrive. add reffer: only listing domains can refer. add diskDescription: tips of disk. Heroku change function_name to HerokuappId. try fix domainforproxy. fix create in Aliyundrive. fix other bugs.
|
||||
Onedrive 的client延期。可以导入导出配置了。初步添加Googledrive。添加reffer:只有指定域名能引用。添加diskDescription:可以对盘备注了。Heroku中将function_name改为使用HerokuappId。尝试修复domainforproxy在个人帐号时的问题。修复阿里云盘不能新建与加密。修复其它bug。
|
||||
20210118-1600.31
|
||||
can change Ondrive to Sharepoint, can copy a disk. fix a bug that 500 error in setup.
|
||||
Onedrive跟Sharepoint可以切换了,可以复制一个盘。修复bug。
|
||||
20210115-1111.30
|
||||
<font color=red>v3, after update, please AddDisk again, please set passfile again.</font> themes of php deleted, or you can use branch v2_last.
|
||||
<font color=red>v3,一键升级后请重新添加盘,passfile失效,重新设置。</font>php主题删掉了,要么就用v2_last分支。
|
||||
20201229.29
|
||||
Modify tags, change sequence of disk.
|
||||
可以修改标签,移动标签顺序。
|
||||
20201215-1400.28
|
||||
fix: hackers can upload files to ANY folder (or create a new folder) in your Onedrive. add language zh-tw. now, on heroku, xhr can post. fix: 2 or more space in file name cause bugs.
|
||||
修复:构造代码后可以上传文件到你Onedrive的任意目录(甚至创建新目录)。新增zh-tw语言。xhr的post在heroku会接收了,改回post。修复:文件名有多个空格相连时造成bug。
|
||||
20201106-1730.27
|
||||
Add theme. A code used in CloudFlare Workers. Admin not need password in folder. Add caddy2 rewrite rule. Add new platform Glitch. <font color=red>web hosting and VPS user should backup your config.php, after update, copy it to .data foloder.</font>
|
||||
添加主题。添加一段用于CF workers的代码。加密目录管理员不需要密码了。添加caddy2伪静态。新增Glitch平台。<font color=red>虚拟主机与VPS用户请备份config.php,升级后,手动将它覆盖到.data目录。</font>
|
||||
20200828-1420.26
|
||||
nginx rewrite rule exclude .well-known folder, as auto SSL. add web.config to rewrite in IIS. now in windwos can do with \ in path. in aliyun FC & huawei FG API, use my code. CN 21Vianet client_id&secret expire. update description now only show new.
|
||||
nginx的伪静态中排除.well-known目录,方便自动SSL。添加IIS的伪静态。与linux不同,处理windows下目录用\分隔。FC、FG中使用自己代码对接平台。<font color=red>世纪互联旧API即将过期失效,升级后世纪互联的盘需要删除重新添加。</font>更新说明只显示部分。
|
||||
20200817-1740.25
|
||||
when multy disks, now will default show disks as folders in root, if set autoJumpFirstDisk 1, it will auto jump to first disk.
|
||||
多盘时,在网站根目录,默认会将各盘当成文件夹显示,可以去设置中设置autoJumpFirstDisk为1,这样可以跟以前一样自动跳到第一个盘。
|
||||
20200816-1145.24
|
||||
add platform: Baidu CFC. add setting: mobile background.
|
||||
新增百度CFC平台。可以分别设置PC与手机的背景。
|
||||
20200808-1130.23
|
||||
FG: select save in env or file.
|
||||
在FG中安装时,选择配置保存在环境变量还是文件中。
|
||||
20200806-1130.23
|
||||
SCF: select save in env or file.
|
||||
在SCF中安装时,选择配置保存在环境变量还是文件中。
|
||||
20200804-1453.22
|
||||
fix: once error will stop the after files in uploading multy files. SCF can get region now, change install. SCF config save in code file now not in env, <font color=red>if use SCF, you must reinstall after update</font>.
|
||||
修复,当上传多个文件时,一个文件出错将导致后续文件不再上传。SCF可以获取到region了,安装过程修改。在SCF中,现在将配置保存到代码文件中,不受环境变量4K大小限制,<font color=red>升级后,用SCF的要重装</font>。
|
||||
20200723-1430.21
|
||||
fix content-type in "?json". can not custom microsoft API id & secret by a link now, so show the return uri.
|
||||
当使用"?json"时,现在content-type是json了。现在微软不能一键创建API应用了,提供回调URI。
|
||||
20200713-1800.20
|
||||
add platform: Huawei cloud Function Graph. now you can use "?json" to get a json of folder or file. fix some bug.
|
||||
新增白嫖平台:华为云函数工作流FG。可以用"?json"来获得目录或文件的json。修复bug。
|
||||
20200607-1856.19
|
||||
add platform: Aliyun Function Compute. add setting: replace sharepoint.com to a proxy server name. add setting: disableShowThumb,customTheme. add function: php hosting website can update by a click
|
||||
现在可以安装到阿里函数计算FC了。php空间可以一键更新了。可以设置某个盘替换sharpoint.com域名为你的反代域名。新增disableShowThumb,customTheme。
|
||||
20200503-1848.18
|
||||
Rebuild theme. Add custom Css & custom Script, add FunctionalityFile: head.omf & foot.omf.
|
||||
重建主题文件结构。增加自定义css与自定义script。增加2个功能文件:head.omf、foot.omf。
|
||||
20200402-1830.17
|
||||
Oneclick update can select which branch to update. Now use the accept language instead of the language config.
|
||||
一键更新可以选择哪个分支了。现在开始使用浏览器语言,抛弃language设置。
|
||||
20200326-0001.16
|
||||
You can add sharepoint site drive as a disk, <font color=red>you must reinstall after update</font>.
|
||||
可以将sharepoint网站添加成一个盘,<font color=red>由于结构改变,升级后只能重装</font>。
|
||||
20200321-1830.15
|
||||
本次更新后,'index.html'功能在其它主题会导致bug。
|
||||
文本类文件将缓存;添加hideFunctionalityFile开关;在添加网盘时会显示已经在用的标签。
|
||||
after this update, then 'index.html' function will bug in other theme.
|
||||
cache text file content;add hideFunctionalityFile;list exist disktags when AddDisk。
|
||||
20200311-2150.14
|
||||
Add a switch, can download a known file or not, while the folder is encrypted.
|
||||
Hide time and size in mobile.
|
||||
Now, you can get a random 'jpg' from a folder when you type '?random=jpg' after the folder.
|
||||
增加一个开关,在目录加密后能否下载其中的某个文件。
|
||||
在手机上浏览时,隐藏修改时间跟大小。
|
||||
加入一个功能,现在可以在某个目录后面加上'?random=jpg'来得到本目录里面的一张随机jpg。
|
||||
20200229-1300.13
|
||||
In SCF, some config can input Special symbols now, like ?&= 。
|
||||
在SCF中,某些配置可以输入特殊符号了,像background可以用?&=之类的了。
|
||||
20200225-1310.12
|
||||
Can update by one click any time. fix bugs: special tag, reupload.
|
||||
可以不管版本直接一键更新(覆盖)了。修复可以使用特殊onedrive标签的bug,修复断网续传的问题。
|
||||
20200222-2130.11
|
||||
you can set background now. fix bug: 2nd disk upload.
|
||||
可以设置背景图片了。第2个盘上传后链接不对。
|
||||
20200222-1700.09
|
||||
Can copy file and folder now.
|
||||
可以复制文件跟目录了。
|
||||
20200220-1220.08
|
||||
Multy Mode! You can add more Onedrive in one project (bind Onedrive in setup). And now, heroku apps can update in setup!
|
||||
多盘来了,在设置中添加Onedrive,另,heroku 上也能一键更新了!
|
||||
20200215-1850.07
|
||||
fix: head.md not show if no readme.md.
|
||||
修复当没有readme的时候就不显示head的问题。
|
||||
20200215-1700.06
|
||||
classic theme can read the head.md file now.
|
||||
classic主题可以处理head.md文件了。
|
||||
20200202-2010.05
|
||||
refresh token expires in 90 day, save a new token per month. classic theme add some icon for admin.
|
||||
refresh token 90天过期,所以每月保存一个新的token。classic主题加了点管理图标。
|
||||
20200129-2050.04
|
||||
if there is 'index.html', then do not show file but show the index.html, except admin.
|
||||
如果有index.html,就不显示文件列表了,直接显示index.html内容,除非是管理员。
|
||||
20200120.02
|
||||
fix domain_path do not work. domain_path正常工作了。
|
||||
20200118.01
|
||||
Can be deploy to heroku/SCF/normal space. SCF、heroku、普通VPS,三种环境都可以用了。
|
||||
Change imgup_path to guestup_path, plz make sure it after update. 将imgup_path改成guestup_path更符合用途,更新后请注意更改。
|
||||
|
|
Loading…
Reference in New Issue