进入Github环境模板https://github.com/codespaces/templates
克隆前后端项目:
使用npm安装pnpmnpm install -g pnpm
验证安装npm list -g
简单美化
ipa按钮代码位置:alist-web\src\pages\home\previews\ipa.tsx
修改代码如下:
// import { Button } from "@hope-ui/solid"
import { Button, HStack } from "@hope-ui/solid"
import { createSignal } from "solid-js"
// import { useT } from "~/hooks"
import { ObjStore, objStore } from "~/store"
import { api, baseName, safeBtoa } from "~/utils"
import { FileInfo } from "./info"
import { useCopyLink, useLink, useT } from "~/hooks"
const Ipa = () => {
const t = useT()
const [installing, setInstalling] = createSignal(false)
const [trInstalling, setTrInstalling] = createSignal(false)
const { copyCurrentRawLink } = useCopyLink()
const { currentObjLink } = useLink()
return (
<FileInfo>
<HStack spacing="$2">
{/* 原生IPA安装 */}
<Button
as="a"
href={
"itms-services://?action=download-manifest&url=" +
`${api}/i/${safeBtoa(
encodeURIComponent(objStore.raw_url) +
"/" +
baseName(encodeURIComponent(objStore.obj.name))
)}.plist`
}
onClick={() => {
setInstalling(true)
}}
>
{t(`home.preview.${installing() ? "installing" : "install"}`)}
</Button>
{/* 巨魔测试 | use install TrollStore IPA*/}
<Button
as="a"
colorScheme="primary"
href={
"apple-magnifier://install?url=" +
encodeURIComponent(currentObjLink(true))
}
onClick={() => {
setTrInstalling(true)
}}
>
{t(`home.preview.${trInstalling() ? "tr-installing" : "tr-install"}`)}
</Button>
{/* 从这里到
下载按钮文件拷贝的位置
alist-web\src\pages\home\previews\download.tsx
primary 青绿色
accent 紫色
neutral 灰色
success 绿色
info 无?
warning 橙色
danger 红色
*/}
<Button colorScheme="danger" as="a" href={objStore.raw_url} target="_blank">
{t("home.preview.download")}
</Button>
<Button colorScheme="accent" onClick={() => copyCurrentRawLink(true)}>
{t("home.toolbar.copy_link")}
</Button>
</HStack>
{/* 到这里 还有开头的 <HStack spacing="$2"> 都是自己加的 */}
</FileInfo>
)
}
export default Ipa
效果如下图:
![图片[1]-使用GitHub编译Linux版本的AList网盘-坤哥资源](https://guankan.tk/wp-content/uploads/2024/01/juedn.png)
打包编译前端和移动
进入前端:cd alist-web
安装依赖:pnpm install
编译前端文件命令:pnpm run build
然后左侧alist-web目录下,可以看到多了一个dist
文件夹
生成Linux可执行的二进制文件
使用命令将编译好的前端dist文件夹,移动到后端public文件夹:cp -r /workspaces/codespaces-blank/alist-web/dist /workspaces/codespaces-blank/alist/public/
进入后端:cd ../alist
编译生成Linux可执行的二进制文件,命令如下:
appName="alist"
builtAt="$(date +'%F %T %z')"
goVersion=$(go version | sed 's/go version //')
gitAuthor=$(git show -s --format='format:%aN <%ae>' HEAD)
gitCommit=$(git log --pretty=format:"%h" -1)
version=$(git describe --long --tags --dirty --always)
webVersion=$(wget -qO- -t1 -T2 "https://api.github.com/repos/alist-org/alist-web/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
ldflags="\
-w -s \
-X 'github.com/alist-org/alist/v3/internal/conf.BuiltAt=$builtAt' \
-X 'github.com/alist-org/alist/v3/internal/conf.GoVersion=$goVersion' \
-X 'github.com/alist-org/alist/v3/internal/conf.GitAuthor=$gitAuthor' \
-X 'github.com/alist-org/alist/v3/internal/conf.GitCommit=$gitCommit' \
-X 'github.com/alist-org/alist/v3/internal/conf.Version=$version' \
-X 'github.com/alist-org/alist/v3/internal/conf.WebVersion=$webVersion' \
"
go build -ldflags="$ldflags" .
编译完成后,左侧会看到编译好的二进制文件 “alist”
测试二进制文件
右键新建test文件夹,将编译好的二进制文件拖动进去,
进入文件夹:cd ../test
授权文件:chmod +x alist
随机生成用户名密码./alist admin random
临时启动,./alist server
然后在浏览器打开,可以查看编译后的效果
下载本地安装
下载编译好的二进制文件,上传至本地服务器安装
暂无评论内容