Compare commits

...
8 Commits
Author SHA1 Message Date
owendswang 1a24160b8b Release v0.9 2026-07-19 00:20:15 +08:00
owendswang 3696468611 Fixed display for available spacee of interal M.2 2026-07-18 09:58:05 +08:00
owendswang 777bb4abd4 Release v0.8 2026-07-14 18:49:24 +08:00
owendswang 76f8fe21d2 Release v0.7 2026-07-09 20:09:02 +08:00
owendswang 5a91067c2e Release v0.6 2026-06-24 01:19:18 +08:00
owendswang ba0704d48c Release v0.5 2026-06-22 02:33:23 +08:00
owendswang 4e10dee5fb Update README.md 2026-06-20 23:45:21 +08:00
owendswang 259d0a6434 Release v0.4 2026-06-20 23:23:25 +08:00
15 changed files with 2405 additions and 530 deletions

No files matched your search

+2
View File
@@ -3,3 +3,5 @@ gen/
web-file-mgr-linux
*.o
*.d
tools/
test/
+1 -1
View File
@@ -13,7 +13,7 @@ ifeq ($(MAKECMDGOALS),)
endif
endif
VERSION_TAG := v0.3
VERSION_TAG := v0.9
TITLE_ID := FMGR88888
PYTHON ?= python3
STRIP ?= $(PS5_PAYLOAD_SDK)/bin/prospero-strip
+7
View File
@@ -15,6 +15,7 @@ PS5 web file manager payload. It runs an HTTP UI starting at port `8888`, instal
<a href="docs/screenshots/20260617_232348.855.jpg" target="_blank"><img src="docs/screenshots/20260617_232348.855.jpg" width="31%" alt="PS5 Web File Manager screenshot 3"></a>
<a href="docs/screenshots/20260619_131811.644.jpg" target="_blank"><img src="docs/screenshots/20260619_131811.644.jpg" width="31%" alt="PS5 Web File Manager screenshot 4"></a>
<a href="docs/screenshots/20260619_131535.239.jpg" target="_blank"><img src="docs/screenshots/20260619_131535.239.jpg" width="31%" alt="PS5 Web File Manager screenshot 5"></a>
<a href="docs/screenshots/20260620_232728.533.jpg" target="_blank"><img src="docs/screenshots/20260620_232728.533.jpg" width="31%" alt="PS5 Web File Manager screenshot 6"></a>
</p>
## Features
@@ -30,6 +31,7 @@ PS5 web file manager payload. It runs an HTTP UI starting at port `8888`, instal
- Chinese and English UI. The browser language is read from `navigator.languages` / `navigator.language`; Chinese uses `zh`, everything else uses English.
- Startup notification showing the app name, version, and listen port.
- Create/edit text files ending with `.txt`, `.json`, `.xml`, `.ini`, `.cfg`, `.conf`, `.md`, `.log`, `.lua`, `.js`, `.css`, `.html`, `.htm`, `.c`, `.h`, `.cpp`, `.hpp`, `.sh`, `.csv`, `.yaml`, `.yml`.
- Preview image files ending with `.png,`, `.jpg`, `.jpeg`, `.gif`, `.bmp`, `.webp`.
## Build
@@ -91,6 +93,11 @@ On first startup the payload installs a `PS5 Web File Manager` web shortcut in t
- The UI can recover the active task display if the browser is closed and reopened while the payload process is still running.
- Text editing is limited to common text-file extensions. Non-UTF-8 and oversized files are rejected.
## FAQ
- This is a homebrew app which does not affect system process or memory. It should crash itself instead of kernel panic theoretically. If kernel panic happens, make sure you'r using the latest jailbreak methods which includes latest elfldr. Or switch back to the stable method you have been using.
- If you're using P2JB, I suggest not to use this if kernel panic happened. It is suffering to wait another 50 min because of kernel panic. Stability first for P2JB.
- The preparing stage is calculating the folder size. It would be pretty slow if there are too many files in this folder. It make sure if there is enough available space for this folder you were trying to copy/move.
## Credits
This project was built with reference to these projects:
Binary file not shown.

After

Width:  |  Height:  |  Size: 139 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

+38 -10
View File
@@ -4,13 +4,34 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PS5 Web File Manager</title>
<style>
html, body { margin: 0; min-height: 100%; background: #111316; color: #edf0f2; }
.init-loading {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 20000;
display: flex;
align-items: center;
justify-content: center;
background: #111316;
color: #aab4be;
font: 18px system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
</style>
<link rel="stylesheet" href="/main.css">
</head>
<body>
<main class="shell">
<header class="topbar">
<div id="path" class="path">/</div>
<div id="spaceInfo" class="space-info"></div>
<div class="top-left">
<div id="path" class="path">/</div>
</div>
<div class="top-right">
<div id="spaceInfo" class="space-info"></div>
</div>
<button id="exitBtn" class="icon-button power-button" type="button" aria-label="Exit"></button>
</header>
@@ -22,7 +43,7 @@
<button id="deleteBtn" class="danger" data-i18n="delete"></button>
<button id="pasteBtn" class="paste-action" hidden>
<span id="pasteVerb" data-i18n="paste"></span>
<span id="pasteName" class="paste-name"></span>
<span id="pasteName" class="paste-name"></span><span id="pasteCount" class="paste-count"></span>
<span id="pasteTargetText" data-i18n="pasteToCurrent"></span>
</button>
<button id="clearClipboardBtn" data-i18n="cancel" hidden></button>
@@ -49,6 +70,9 @@
<tbody id="files"></tbody>
</table>
<div id="empty" class="empty" data-i18n="empty" hidden></div>
<div id="contentLoading" class="content-loading" hidden>
<div class="content-loading-text" data-i18n="readDir"></div>
</div>
</section>
<footer class="status">
@@ -70,19 +94,23 @@
</section>
</div>
<div id="imagePreviewOverlay" class="text-editor-overlay" hidden>
<section class="text-editor-panel image-preview-panel">
<div id="imagePreviewName" class="text-editor-path"></div>
<div class="image-preview-stage">
<img id="imagePreview" class="image-preview" alt="">
</div>
<button id="imagePreviewCloseBtn" class="secondary" data-i18n="close"></button>
</section>
</div>
<div id="taskOverlay" class="task-overlay" hidden>
<div class="task-panel">
<div id="tasks" class="tasks"></div>
</div>
</div>
<div id="initLoading" class="init-loading" aria-hidden="true">
<div class="loading-dots">
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id="initLoading" class="init-loading" aria-hidden="true">Loading...</div>
<script src="/main.js"></script>
</body>
+16 -2
View File
@@ -3,6 +3,9 @@ window.WFM_LANG = {
copy: "Copy",
move: "Move",
delete: "Delete",
copying: "Copying",
moving: "Moving",
deleting: "Deleting",
rename: "Rename",
paste: "Paste",
cancel: "Cancel",
@@ -36,12 +39,17 @@ window.WFM_LANG = {
speedLabel: "Speed",
progressLabel: "Progress",
etaLabel: "ETA",
elapsedLabel: "Elapsed",
durationHours: "{hours}h {minutes}m",
durationMinutes: "{minutes}m {seconds}s",
durationSeconds: "{seconds}s",
preparingTask: "Preparing task",
canceling: "Canceling...",
selectedItems: "{name} and {count} items",
countItems: "{count} items",
totalItems: "{count} items",
readDir: "Reading folder...",
processing: "Processing...",
actionBusy: "{label}...",
taskCreated: "{label} task created",
actionDone: "{label} done",
@@ -55,12 +63,14 @@ window.WFM_LANG = {
overwriteFiles: "Files with the same name will be overwritten: {names}",
mergeDirs: "Folders with the same name will be merged. Internal files with the same name will be overwritten: {names}",
continueConfirm: "Continue?",
preparingPaste: "{label} preparing: calculating size and checking target space...",
preparingPaste: "Preparing: calculating size and checking target space...",
preparingStatus: "{label} preparing...",
cancelPrepare: "Preparation canceled",
cancelTaskConfirm: "Cancel current {label} task?",
cancelFailed: "Cancel failed: {error}",
tasksPollFailed: "Failed to read task status: {error}",
transferComplete: "{label} completed: {name}\n\nTotal time: {duration}\nTransferred: {size}",
transferCompleteFiles: "{label} completed: {name}\n\nTotal time: {duration}\nTransferred: {size}\nFiles: {count}",
renamePrompt: "New name",
mkdirPrompt: "Folder name",
newTextPrompt: "Text file name",
@@ -82,11 +92,14 @@ window.WFM_LANG = {
storageUsb: "USB",
storageM2: "M.2",
storageExtended: "Extended",
storageRoot: "Root",
storageCurrent: "Current",
err_target_dir_not_writable: "Target folder is not writable: {path}",
err_target_file_not_writable: "Target file is not writable: {path}",
err_target_parent_not_writable: "Target parent folder is not writable: {path}",
err_target_parent_not_writable: "Current folder is not writable: {path}",
err_target_check_failed: "Cannot check target path: {path}",
err_target_path_too_long: "Target path is too long",
err_path_too_long: "Path is too long",
err_space_check_failed: "Cannot read target free space: {path}",
err_no_space: "Not enough target space. Required {required}, available {available}",
err_active_task: "A task is running",
@@ -102,6 +115,7 @@ window.WFM_LANG = {
err_text_invalid_utf8: "The file is not valid UTF-8 text",
err_text_file_changed: "The file changed after it was opened. Close and reopen it",
err_text_file_not_writable: "The text file is not writable",
err_request_body_too_large: "Too many selected items. Select fewer items and try again",
err_unknown_api: "Unknown API",
err_out_of_memory: "Out of memory",
err_no_source_paths: "No source paths",
+17 -3
View File
@@ -3,6 +3,9 @@ window.WFM_LANG = {
copy: "复制",
move: "移动",
delete: "删除",
copying: "复制",
moving: "移动",
deleting: "删除",
rename: "重命名",
paste: "粘贴",
cancel: "取消",
@@ -36,12 +39,17 @@ window.WFM_LANG = {
speedLabel: "速度",
progressLabel: "进度",
etaLabel: "剩余",
elapsedLabel: "耗时",
durationHours: "{hours}小时 {minutes}分",
durationMinutes: "{minutes}分 {seconds}秒",
durationSeconds: "{seconds}秒",
preparingTask: "正在准备任务",
canceling: "正在取消...",
selectedItems: "{name} 等 {count} 项",
countItems: "{count} 项",
totalItems: "共 {count} 项",
readDir: "读取目录...",
readDir: "读取目录中...",
processing: "处理中...",
actionBusy: "{label}...",
taskCreated: "{label}任务已创建",
actionDone: "{label}完成",
@@ -55,12 +63,14 @@ window.WFM_LANG = {
overwriteFiles: "同名文件将被覆盖: {names}",
mergeDirs: "同名目录将被合并,内部同名文件会被覆盖: {names}",
continueConfirm: "继续?",
preparingPaste: "{label}准备中:正在计算大小并检查目标空间...",
preparingPaste: "准备中:正在计算大小并检查目标空间...",
preparingStatus: "{label}准备中...",
cancelPrepare: "已取消准备操作",
cancelTaskConfirm: "取消当前{label}任务?",
cancelFailed: "取消失败: {error}",
tasksPollFailed: "任务状态读取失败: {error}",
transferComplete: "{label}完成:{name}\n\n总耗时:{duration}\n传输大小:{size}",
transferCompleteFiles: "{label}完成:{name}\n\n总耗时:{duration}\n传输大小:{size}\n文件数量:{count}",
renamePrompt: "新名称",
mkdirPrompt: "目录名",
newTextPrompt: "文本文件名",
@@ -82,11 +92,14 @@ window.WFM_LANG = {
storageUsb: "USB存储",
storageM2: "M2扩充存储",
storageExtended: "扩展存储",
storageRoot: "根分区",
storageCurrent: "当前目录",
err_target_dir_not_writable: "目标目录不可写: {path}",
err_target_file_not_writable: "目标文件不可写: {path}",
err_target_parent_not_writable: "目标父目录不可写: {path}",
err_target_parent_not_writable: "当前目录不可写: {path}",
err_target_check_failed: "无法检查目标路径: {path}",
err_target_path_too_long: "目标路径过长",
err_path_too_long: "路径过长",
err_space_check_failed: "无法读取目标剩余空间: {path}",
err_no_space: "目标空间不足,需要 {required},可用 {available}",
err_active_task: "有任务正在执行",
@@ -102,6 +115,7 @@ window.WFM_LANG = {
err_text_invalid_utf8: "文件不是有效的 UTF-8 文本",
err_text_file_changed: "文件在打开后已发生变化,请关闭后重新打开",
err_text_file_not_writable: "文本文件不可写",
err_request_body_too_large: "选择的项目过多,请减少选择后重试",
err_unknown_api: "未知接口",
err_out_of_memory: "内存不足",
err_no_source_paths: "没有源路径",
+365 -72
View File
@@ -23,41 +23,8 @@
align-items: center;
justify-content: center;
background: #111316;
}
.loading-dots {
display: flex;
}
.loading-dots span {
width: 14px;
height: 14px;
margin: 0 6px;
border-radius: 50%;
background: #8fa1b3;
animation: loading-pulse 1s ease-in-out infinite;
}
.loading-dots span:nth-child(2) {
animation-delay: .12s;
}
.loading-dots span:nth-child(3) {
animation-delay: .24s;
}
@keyframes loading-pulse {
0%,
80%,
100% {
opacity: .35;
transform: scale(.75);
}
40% {
opacity: 1;
transform: scale(1);
}
color: #aab4be;
font-size: 18px;
}
body {
@@ -76,18 +43,48 @@ body {
}
.topbar {
position: relative;
flex: 0 0 auto;
height: auto;
min-height: 54px;
display: flex;
align-items: center;
padding: 12px 30px;
align-items: start;
flex-wrap: wrap;
justify-content: space-between;
padding: 0 18px;
background: #1b2026;
border-bottom: 1px solid #2d343d;
overflow: visible;
}
.top-left,
.top-right {
height: auto;
display: flex;
align-items: center;
}
.top-left {
flex: 1 1 420px;
min-width: 0;
margin-top: 15px;
}
.top-right {
flex: 1 1 360px;
min-width: 0;
margin-left: auto;
justify-content: flex-end;
flex-wrap: wrap;
padding: 12px 40px 12px 0;
text-align: right;
}
.path {
color: #aab4be;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
font-size: 22px;
line-height: 1.35;
line-height: 24px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@@ -96,19 +93,25 @@ body {
}
.space-info {
height: auto;
min-height: 0;
display: flex;
align-items: center;
flex-wrap: wrap;
justify-content: flex-end;
flex: 0 1 auto;
max-width: 58vw;
flex: 1 1 auto;
max-width: none;
color: #c9d3dc;
font-size: 18px;
line-height: 1.35;
line-height: 30px;
white-space: nowrap;
overflow: hidden;
overflow: visible;
text-align: right;
}
.space-item {
margin-left: 14px;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
}
@@ -129,8 +132,6 @@ body {
width: 24px;
height: 24px;
padding: 0;
flex: 0 0 24px;
margin-left: 16px;
}
.power-button {
@@ -160,6 +161,13 @@ body {
transform: translateX(-50%);
}
#exitBtn {
position: absolute;
top: 15px;
right: 18px;
margin-left: 0;
}
.toolbar,
.tool-left,
.tool-right {
@@ -169,10 +177,14 @@ body {
}
.toolbar {
flex: 0 0 auto;
height: auto;
min-height: 84px;
justify-content: space-between;
padding: 14px 30px;
padding: 15px 18px 0;
background: #15191e;
border-bottom: 1px solid #2d343d;
overflow: visible;
}
.tool-left {
@@ -180,9 +192,15 @@ body {
flex: 1 1 auto;
}
.toolbar .tool-left,
.toolbar .tool-right {
min-height: 54px;
flex-wrap: wrap;
}
.tool-left > *,
.tool-right > * {
margin: 0 12px 0 0;
margin: 0 12px 15px 0;
}
.tool-right > * {
@@ -192,11 +210,12 @@ body {
.tool-right {
justify-content: flex-end;
flex: 0 0 auto;
flex: 1 1 auto;
}
button,
.button {
height: 54px;
min-height: 54px;
min-width: 96px;
padding: 0 20px;
@@ -256,26 +275,57 @@ button.primary:hover {
}
.paste-action > * {
flex: 0 0 auto;
margin-right: 8px;
}
.paste-name {
display: inline-block;
flex: 1 1 auto;
min-width: 0;
max-width: 180px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.paste-count {
white-space: nowrap;
}
.content {
position: relative;
flex: 1 1 auto;
min-height: 0;
overflow: auto;
}
.content.loading {
pointer-events: none;
}
.content-loading {
position: absolute;
right: 0;
left: 0;
height: 100%;
z-index: 2;
display: flex;
align-items: center;
justify-content: center;
background: rgba(4, 6, 8, .72);
}
.content-loading-text {
color: #aab4be;
font-size: 18px;
}
table {
width: 100%;
border-collapse: collapse;
min-width: 1034px;
border-collapse: separate;
border-spacing: 0;
table-layout: fixed;
}
@@ -288,6 +338,7 @@ td {
overflow: hidden;
text-overflow: ellipsis;
font-size: 20px;
line-height: 24px;
}
th {
@@ -305,7 +356,7 @@ th {
}
.name-col {
min-width: 360px;
min-width: 600px;
}
td.name-col {
@@ -342,6 +393,7 @@ tr {
}
thead tr {
height: 78px;
cursor: default;
}
@@ -354,7 +406,12 @@ tr.selected {
background: #1d2d35;
}
tr[data-type="parent"] {
cursor: pointer;
}
.select-hit {
height: 78px;
min-height: 78px;
width: 100%;
display: flex;
@@ -373,19 +430,12 @@ input[type="checkbox"] {
width: 32px;
height: 32px;
flex: 0 0 32px;
display: inline-flex;
align-items: center;
justify-content: center;
}
.icon img {
width: 32px;
height: 32px;
display: block;
}
.row-action {
width: 100%;
height: 78px;
min-height: 78px;
padding: 16px 18px;
border: 0;
@@ -416,10 +466,11 @@ input[type="checkbox"] {
.status {
color: #aab4be;
padding: 10px 25px;
}
.status {
flex: 0 0 auto;
height: 46px;
min-height: 46px;
padding: 0 25px;
line-height: 46px;
border-top: 1px solid #2d343d;
background: #15191e;
font-size: 18px;
@@ -450,6 +501,7 @@ input[type="checkbox"] {
.text-editor-panel {
width: 1200px;
height: calc(100vh - 96px);
min-width: 0;
max-width: calc(100vw - 96px);
display: flex;
flex-direction: column;
@@ -461,6 +513,7 @@ input[type="checkbox"] {
}
.text-editor-path {
flex: 0 0 auto;
margin-bottom: 14px;
overflow: hidden;
color: #c9d3dc;
@@ -509,6 +562,34 @@ input[type="checkbox"] {
margin-left: 14px;
}
.image-preview-stage {
width: 100%;
min-width: 0;
min-height: 0;
flex: 1 1 auto;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.image-preview {
display: block;
width: auto;
height: auto;
max-width: 100%;
max-height: 100%;
object-fit: contain;
pointer-events: none;
-webkit-user-drag: none;
user-select: none;
}
.image-preview-panel > button {
width: 100%;
margin-top: 14px;
}
.task-overlay {
position: fixed;
top: 0;
@@ -557,6 +638,8 @@ input[type="checkbox"] {
display: flex;
align-items: flex-start;
font-size: 24px;
justify-content: space-between;
position: relative;
}
.task-head.has-amount {
@@ -573,13 +656,18 @@ input[type="checkbox"] {
.task-current {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.task-current-plain {
text-overflow: ellipsis;
}
.task-name {
display: flex;
min-width: 0;
text-overflow: ellipsis;
flex: 1 1 auto;
}
.task-name > * {
@@ -599,6 +687,14 @@ input[type="checkbox"] {
white-space: nowrap;
}
.task-elapsed {
flex: 0 0 auto;
white-space: nowrap;
text-align: right;
margin-left: 16px;
color: #aab4be;
}
.task-meta {
display: flex;
color: #c9d3dc;
@@ -667,18 +763,215 @@ input[type="checkbox"] {
background: #8a929b;
}
@media (max-width: 900px) {
.topbar {
align-items: stretch;
flex-direction: column;
@media (max-width: 815px) {
.top-left {
padding: 0 40px 0 0;
}
th:nth-child(4),
td:nth-child(4),
th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6) {
.top-right {
padding: 10px 0;
}
}
@media (max-width: 640px) {
body {
font-size: 16px;
}
.topbar {
min-height: 42px;
padding: 0 10px;
align-items: center;
flex-wrap: nowrap;
}
.top-left {
flex: 1 1 auto;
margin-top: 0;
padding-right: 34px;
}
.top-right {
display: none;
}
.path {
font-size: 16px;
line-height: 42px;
}
#exitBtn {
top: 9px;
right: 10px;
}
.toolbar {
min-height: 0;
padding: 8px 8px 0;
}
.toolbar .tool-left,
.toolbar .tool-right {
min-height: 0;
}
.tool-left,
.tool-right {
flex: 1 1 100%;
}
.tool-right {
justify-content: flex-start;
}
.tool-left > *,
.tool-right > * {
margin: 0 8px 8px 0;
}
.tool-right > * {
margin-left: 0;
}
button,
.button {
height: 40px;
min-height: 40px;
min-width: 76px;
padding: 0 12px;
border-radius: 6px;
font-size: 16px;
}
.paste-action {
max-width: 100%;
}
.paste-name {
max-width: 120px;
}
table {
min-width: 960px;
}
.name-col {
width: 600px;
}
th,
td {
padding: 10px 12px;
font-size: 16px;
line-height: 20px;
}
tr,
thead tr,
.select-hit,
.row-action {
height: 56px;
min-height: 56px;
}
.row-action {
padding: 10px 12px;
}
input[type="checkbox"] {
width: 28px;
height: 28px;
}
.icon {
width: 26px;
height: 26px;
flex-basis: 26px;
}
.status {
height: 34px;
min-height: 34px;
padding: 0 12px;
line-height: 34px;
font-size: 14px;
}
.task-overlay {
padding: 18px;
align-items: center;
}
.task-panel {
width: 100%;
max-width: none;
padding: 18px;
border-radius: 8px;
}
.task > * + * {
margin-top: 12px;
}
.task-head {
display: block;
font-size: 20px;
}
.task-name {
display: flex;
max-width: none;
white-space: nowrap;
}
.task-name > * {
margin: 0 8px 0 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.task-name-subject {
flex: 1 1 auto;
max-width: none;
min-width: 0;
}
.task-elapsed {
margin: 8px 0 0;
text-align: left;
font-size: 18px;
}
.task-current {
font-size: 18px;
white-space: normal;
word-break: break-all;
}
.task-meta {
display: block;
font-size: 18px;
}
.task-meta div,
.task-meta div:nth-child(2),
.task-meta div:nth-child(3) {
display: block;
margin: 0 0 8px;
text-align: left;
white-space: normal;
}
.task-meta div:last-child {
margin-bottom: 0;
}
.progress {
height: 32px;
}
.task .danger {
width: 100%;
}
}
+484 -126
View File
File diff suppressed because it is too large. Load diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

+12 -27
View File
@@ -4,8 +4,6 @@
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <ps5/kernel.h>
@@ -33,9 +31,16 @@ int sceAppInstUtilAppInstallAll(void *);
static int
install_file(const char *path, const uint8_t *data, size_t size) {
struct stat st;
FILE *f;
if(!(f = fopen(path, "w"))) {
if(!stat(path, &st)) {
return 0;
}
if(errno != ENOENT) {
return -1;
}
if(!(f = fopen(path, "wb"))) {
return -1;
}
if(fwrite(data, size, 1, f) != 1) {
@@ -65,32 +70,13 @@ install_app(const char *title_id, const char *dir) {
}
static int
needs_update(const char *path, const uint8_t *expected, size_t expected_size) {
needs_install_file(const char *path) {
struct stat st;
uint8_t *buf;
FILE *f;
int mismatch;
if(stat(path, &st) || st.st_size != (off_t)expected_size) {
if(stat(path, &st)) {
return 1;
}
if(!(f = fopen(path, "r"))) {
return 1;
}
if(!(buf = malloc(expected_size))) {
fclose(f);
return 1;
}
if(fread(buf, 1, expected_size, f) != expected_size) {
free(buf);
fclose(f);
return 1;
}
fclose(f);
mismatch = memcmp(buf, expected, expected_size);
free(buf);
return mismatch != 0;
return 0;
}
int
@@ -111,8 +97,7 @@ app_install_if_needed(void) {
if(stat(base_dir, &st)) {
update_needed = 1;
} else if(needs_update(param_path, param_json, param_json_size) ||
needs_update(icon_path, icon0_png, icon0_png_size)) {
} else if(needs_install_file(param_path) || needs_install_file(icon_path)) {
update_needed = 1;
}
+1458 -287
View File
File diff suppressed because it is too large. Load diff
+3
View File
@@ -8,8 +8,10 @@ typedef struct mime_entry {
} mime_entry_t;
static const mime_entry_t g_mimes[] = {
{"bmp", "image/bmp"},
{"css", "text/css"},
{"elf", "application/octet-stream"},
{"gif", "image/gif"},
{"html", "text/html"},
{"jpeg", "image/jpeg"},
{"jpg", "image/jpeg"},
@@ -20,6 +22,7 @@ static const mime_entry_t g_mimes[] = {
{"png", "image/png"},
{"txt", "text/plain"},
{"xml", "text/xml"},
{"webp", "image/webp"},
{"zip", "application/zip"},
};
+2 -2
View File
@@ -13,7 +13,7 @@
#include "filemgr.h"
#include "websrv.h"
#define REQUEST_BODY_MAX (1024 * 1024)
#define REQUEST_BODY_MAX (4 * 1024 * 1024)
typedef struct request_context {
char *body;
@@ -25,7 +25,7 @@ static enum MHD_Result
websrv_body_too_large(struct MHD_Connection *conn) {
static const char json[] =
"{\"ok\":false,\"error\":\"request body is too large\","
"\"error_code\":\"text_file_too_large\",\"error_arg\":\"\"}";
"\"error_code\":\"request_body_too_large\",\"error_arg\":\"\"}";
struct MHD_Response *resp =
MHD_create_response_from_buffer(sizeof(json) - 1, (void *)json,
MHD_RESPMEM_PERSISTENT);