Skip to content
Merged
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
c08fce8
Build and document GitHub Pages site
PythonSmall-Q Nov 7, 2026
92ceb22
fix: pass workflow token to Claude review
PythonSmall-Q Nov 7, 2026
d627d9f
docs: resolve review feedback on Pages and site content
Copilot Nov 7, 2026
82a301e
Fix links to project website and documentation
PythonSmall-Q Nov 7, 2026
d5ffcd8
docs: address follow-up website review comments
Copilot Nov 7, 2026
53dc4df
docs: point Cloudflare Pages at website content
Copilot Nov 7, 2026
750c9dd
Add isolated anonymous web client build
Copilot Nov 7, 2026
9785a27
Use a slim public-only browser shell
Copilot Nov 7, 2026
673db79
Add Cloudflare Pages project config
Copilot Nov 7, 2026
7f20b9f
Add secure web sessions and public browsing
Copilot Nov 7, 2026
d172854
Add authenticated web code submission
Copilot Nov 7, 2026
b0f4324
Use lightweight web code submission view
Copilot Nov 7, 2026
36d617f
Remove Wrangler temporary bundles
Copilot Nov 7, 2026
49b4b2f
Enable browser community and source tools
Copilot Nov 8, 2026
0a5076d
Update web verification and compatibility
Copilot Nov 8, 2026
72e616a
Restore web styling and identify login blocker
Copilot Nov 8, 2026
24055d6
Keep the web sidebar accessible
Copilot Nov 8, 2026
66d2704
Add safe upstream redirect handling and Web avatars
Copilot Nov 8, 2026
093b38e
Route Cloudflare requests through safe authenticated sessions
Copilot Nov 8, 2026
3815bb8
Require login for protected XMOJ data pages
Copilot Nov 8, 2026
8882d25
Preserve web routes and enable Turnstile CSP
Copilot Nov 8, 2026
042bcac
Add Cloudflare API rate limits and 429 handling
Copilot Nov 8, 2026
37a1002
Link the Web favicon to official XMOJ-Script icon
Copilot Nov 8, 2026
62280a7
Add the official XMOJ-Script Web icon asset
Copilot Nov 8, 2026
d668850
Enable shareable post and contest routes
Copilot Nov 8, 2026
1fcf403
Remove redundant detail-session preflights
Copilot Nov 8, 2026
074ad7f
Parallelize detail verification and display
Copilot Nov 8, 2026
3dbdbf9
Fix prefilled contest-aware submissions
Copilot Nov 8, 2026
4351672
Update AppSidebar.vue
zsTree0830 Nov 11, 2026
7a8cd6c
fix(webxmoj): 修复网页版回归与安全问题
zsTree0830 Nov 11, 2026
602d571
docs(website): 修正安装说明的代码标签与发布格式
zsTree0830 Nov 11, 2026
e41217c
refactor(app): 移除桌面入口中永不显示的网页版提示
zsTree0830 Nov 11, 2026
44e9179
Fix bugs
zsTree0830 Nov 12, 2026
a5da5d1
Fix review issues and harden contest ranking E2E
zsTree0830 Nov 12, 2026
3a0775c
Fix web review findings and harden Pages deployment
zsTree0830 Nov 12, 2026
40503aa
Merge branch 'dev' into docs/github-pages-site
zsTree0830 Nov 18, 2026
39f8003
fix(web): 缓存为空时回落到网络加载
zsTree0830 Nov 18, 2026
9112b7e
style: 修正 ProblemView 返回竞赛按钮缩进
zsTree0830 Nov 18, 2026
b3fe27d
fix(web): 返回竞赛按钮加 type=button,避免触发表单提交
zsTree0830 Nov 18, 2026
dc0a6a0
Bump version to 1.1.2
zsTree0830 Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/claude-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
timeout-minutes: 180
permissions:
contents: read
issues: write
pull-requests: write
id-token: write
steps:
Expand Down Expand Up @@ -41,6 +42,7 @@ jobs:
env:
ANTHROPIC_BASE_URL: https://api.deepseek.com/anthropic
with:
github_token: ${{ github.token }}
allowed_bots: '*'
anthropic_api_key: ${{ secrets.DEEPSEEK_API_KEY }}
track_progress: true
Expand Down
28 changes: 14 additions & 14 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ name: Deploy GitHub Pages
on:
push:
branches: [master]
paths: ['website/**', '.github/workflows/pages.yml']
paths:
- 'website/**'
- '.github/workflows/pages.yml'
workflow_dispatch:

permissions:
contents: read
contents: write
Comment thread
PythonSmall-Q marked this conversation as resolved.
Resolved

concurrency:
group: pages
Expand All @@ -16,18 +18,16 @@ concurrency:
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
- name: Build website
run: |
mkdir dist
cp -a website/. dist/
Comment thread
PythonSmall-Q marked this conversation as resolved.
Resolved
- name: Publish to github-pages branch
uses: peaceiris/actions-gh-pages@v4
with:
path: website
- name: Deploy
id: deployment
uses: actions/deploy-pages@v4
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: github-pages
publish_dir: ./dist
force_orphan: true
Comment thread
PythonSmall-Q marked this conversation as resolved.
Resolved
14 changes: 14 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,21 @@ jobs:
- name: Build
run: npx vite build

- name: Build Web
run: npm run build:web

- name: Install Electron binary
shell: pwsh
run: |
if (-not (Test-Path 'node_modules/electron/dist')) {
npx install-electron
if ($LASTEXITCODE -ne 0) { throw 'install-electron failed' }
}

- name: Run suites
shell: pwsh
run: |
Remove-Item Env:\ELECTRON_RUN_AS_NODE -ErrorAction SilentlyContinue
$ErrorActionPreference = 'Continue'
$suites = @(
'test',
Expand All @@ -51,6 +63,8 @@ jobs:
'test:cache',
'test:async-resource',
'test:e2e-readiness',
'test:web-functions',
Comment thread
zsTree0830 marked this conversation as resolved.
Resolved
'test:pages',
'test:native-views',
'test:cloud-settings',
'test:markdown',
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ lerna-debug.log*

node_modules
dist
web-dist
dist-ssr
.wrangler
Comment thread
zsTree0830 marked this conversation as resolved.
Resolved
_worker.bundle
# vite-plugin-electron emits the main/preload bundle here.
dist-electron
*.local
Expand Down
38 changes: 33 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ src/

## 已实现功能

项目介绍页和面向使用者的完整指南位于 [项目网站](https://elxmoj.xmoj-script.uk/) 与 [使用文档](https://elxmoj.xmoj-script.uk/docs/);无需安装的公开浏览版位于 [XMOJ Electron 网页版](https://webxmoj.xmoj-script.uk/)。

- **登录**:应用内表单,支持"记住密码"与启动时静默重新登录
- **头像**:登录后由邮箱经 Cravatar 取头像(MD5 在主进程计算)
- **用户标识**:凡是出现用户名的地方都渲染为「圆形头像 + 用户名 + 标签」,
Expand All @@ -40,23 +42,23 @@ src/
- **题目**:题面按 `.cnt-row` 逐块渲染成**卡片**(信息头 + 每块一张卡片)、
样例输入输出独立卡片、每个复制按钮按下后变「已复制」并在 2 秒后复原、
可读取标程,实体(`<` 等)会解码回原字符。从**题库列表点一行**即可进入题面
- **状态**:评测记录(12 种评测结果按类型着色:AC 绿、WA 红、RE 紫、CE 黄、
- **状态**:评测记录(按评测结论类型着色:AC 绿、WA 红、RE 紫、CE 黄、
TLE/MLE 黑、未知灰)、多条件筛选、游标翻页;搜索框右侧可进入**代码对比**。
只有真正的「等待/评测中」才轮询,**「未知」不轮询**
- **提交**:Monaco 编辑器、语言选择、O2 开关、提交前检查、按题保存草稿。
入口在题面页的「提交代码」按钮(侧栏不单列)
- **竞赛&作业**:比赛列表(共 104 场,可翻页、区分进行中/未开始/已结束)、
比赛题目(题号按状态着色:已通过浅绿、未通过淡红、评测中淡黄)、
**OI 排名 / 订正排名**(原生表格,从比赛详情进入,以浮层展示)
- **比赛回放**:原站已开放回放的比赛可在「返回列表」与「OI 排名」之间进入;使用当前账号获取点播授权,内容区全屏播放,支持进度、音量、倍速和关闭(Esc),退出时停止播放
- **月赛**:首页式双栏公告、服务器时钟,右栏「我的月赛」与倒计时;不显示推荐、服务公告、QQ群和复制按钮
- **比赛回放**:原站已开放回放的比赛可在「返回列表」与「OI 排名」之间进入;使用当前账号获取点播授权,回放界面铺满应用内容区,支持进度、音量、倍速和关闭(Esc),退出时停止播放
- **月赛**:首页式双栏公告,右栏「我的月赛」与倒计时;服务器时间显示在首页。月赛页不显示推荐、服务公告、QQ群和复制按钮
- **下载**:软件列表卡片;站内文件先确认保存位置再下载,进度卡片可终止下载;站外链接交给默认浏览器
- **讨论**:板块与分页、引用回复、Markdown 左右实时预览、表单内嵌 Cloudflare 验证(成功后保持显示,失败或过期自动重试);按脚本管理员/作者/锁定权限显示编辑与删除控件
- **短消息**:会话列表、消息气泡、发送;**新建会话前先校验用户是否存在**
- **个人主页**:已解决题目列表(判题站用 `p(id,count)` 脚本发射,主进程解析)、
按题号筛选、点击直接跳到题面
- **代码对比**:两次提交逐行对比(+/- 行号与差异统计)
- **导出 AC 代码**:从个人主页完整 AC 列表选择题目,按语言寻找可读的通过代码,显示进度并打包成 zip
- **导出 AC 代码**:在侧栏底部的「导出 AC 代码」页面中,从当前账号的已解决题目里选择题目,按语言寻找可读的通过代码,显示进度并打包成 zip
- **关于 / 检查更新**:侧栏底部抽屉内的 dialog;版本取自 `package.json`,
更新信息取自 `https://www.xmoj-script.uk/Update.json`(与用户脚本同一数据源)
- **通知提醒**:错误/警告以**底部 toast** 呈现;社区未读提及同样以 toast 提示
Expand All @@ -78,6 +80,30 @@ src/

保留 GFM 表格、任务列表及 KaTeX 公式支持;代码中的公式和容器标记不参与渲染,最终 HTML 仍经过 DOMPurify 消毒。

## 项目网站与文档发布

网站源码和使用文档维护在 `website/`。`.github/workflows/pages.yml` 会在 `master` 分支的 `website/` 内容变更时,将完整静态站点发布到 `github-pages` 分支根目录;合入 `dev` 不会触发发布,需等变更进入 `master`,或在 Actions 页面手动运行工作流并选择包含网站内容的分支。

首次启用时,先在 Actions 页面手动运行一次该工作流以创建 `github-pages` 分支,再到仓库 **Settings → Pages** 将部署来源设为 `github-pages` 分支的根目录。`website/CNAME` 将自定义域名 `elxmoj.xmoj-script.uk` 一并发布;还需在 GitHub Pages 设置中配置该域名,并在 DNS 提供商中按 GitHub 指引配置记录。还需在 **Settings → Actions → General → Workflow permissions** 中允许 **Read and write permissions**;否则 `GITHUB_TOKEN` 即使在工作流中申请了 `contents: write`,仍可能因仓库权限设置而无法推送分支。

公开浏览版由 Cloudflare Pages 项目从本仓库的 `dev` 分支构建。仓库根目录的 `wrangler.toml` 将 Pages 项目名设为 `webxmoj`、产物目录设为 `web-dist`,并固定 Workers compatibility date。首次创建 Cloudflare Pages 项目时,项目名须为 `webxmoj`;在项目 **Settings → Builds & deployments** 中将生产分支设为 `dev`、Root directory 留空、Build command 设为 `npm ci && npm run build:web`。再将 `webxmoj.xmoj-script.uk` 绑定为 Pages 自定义域名,并按 Cloudflare 指引完成 DNS。以上生产分支、构建命令和自定义域名仍由 Cloudflare 控制台管理,仓库配置文件不能修改账户中的现有项目或 DNS 记录。部署前需在 Pages 项目的 **Settings → Variables and Secrets** 添加加密密钥 `XMOJ_SESSION_KEY`;可本地生成 `openssl rand -base64 32`,并用 `npx wrangler pages secret put XMOJ_SESSION_KEY --project-name=webxmoj` 上传,勿将密钥写入仓库。网页登录凭证只发给同源 Pages Function;函数将 XMOJ 的 `PHPSESSID` 封装在 `Secure; HttpOnly; SameSite=Lax` 加密 Cookie 中,前端不接触或持久化它。社区 API Token 只在服务端单次请求期间使用,不写入浏览器存储。网页构建使用独立的 `web/index.html`,不使用仓库根目录供 Electron 打包的 `index.html`。网页版支持匿名浏览首页、月赛、软件下载和公开用户主页;题库、题面、状态、竞赛列表/详情/排名等需先登录,Pages Function 会验证加密会话并仅在服务端转发 XMOJ 会话。登录后还可提交代码、查看源码与测试点、对比代码、使用讨论区(含 Turnstile 验证)、私信、通知和云同步设置。浏览器偏好保存在本机;本机文件导出、竞赛视频回放、应用更新检查和原生退出确认仍仅由桌面版提供。部署时还需确认 Turnstile 站点密钥允许 `webxmoj.xmoj-script.uk`,并在 Cloudflare 配置 `/api/session` 与 `/api/community` 的速率限制;Pages 项目和 DNS 仍需账户所有者在控制台配置。GitHub Pages 的 `github-pages` 分支只用于介绍页及文档。

网页版支持可分享的直接访问路径:帖子为 `/discussion/{帖子编号}`(分页可追加 `?page={页码}`),独立题目为 `/problem/{题目编号}`,竞赛为 `/contests/{竞赛编号}`,竞赛内题目为 `/contests/{竞赛编号}/problems/{题目编号}`。其他已支持的视图也有稳定路径(如 `/problemset`、`/status`、`/monthly`、`/settings`);浏览器刷新、前进和后退会恢复对应视图及已支持的实体编号。

### Cloudflare Pages API 速率限制

在 `webxmoj` 区域的 **Security → WAF → Rate limiting rules** 中创建以下规则,Characteristic 选 **IP**,Action 选 **Block**。表达式均只匹配 `/api/` 动态接口,不会限制静态页面、脚本或图片;规则顺序建议先具体接口、后兜底。Cloudflare 各计划可用的窗口、规则数量及自定义响应能力可能不同,若控制台不提供相应选项,应优先保留登录和提交规则并按计划能力调整。

| 匹配表达式 | 次数 / 周期 | Block 持续时间 |
| --- | ---: | ---: |
| `http.request.uri.path eq "/api/session" and http.request.method eq "POST"` | 10 / 600 秒 | 600 秒 |
| `http.request.uri.path eq "/api/submit" and http.request.method eq "POST"` | 10 / 60 秒 | 60 秒 |
| `http.request.uri.path eq "/api/community" and http.request.method eq "POST"` | 60 / 60 秒 | 60 秒 |
| `http.request.uri.path starts_with "/api/" and http.request.method eq "GET"` | 60 / 60 秒 | 60 秒 |
| `http.request.uri.path starts_with "/api/"` | 120 / 60 秒 | 60 秒 |

规则以 Cloudflare 识别的来源 IP 计数;不要把 Cookie、会话 ID、密码或请求正文配置为计数特征。`/api/community` 目前将读写操作统一 POST 到同一路径,按路径无法为发帖、回复、私信分别限额。Cloudflare 区域规则之外的 Pages 项目若不由该区域代理,需在实际承载该域名的区域配置这些规则。初期应监控误拦截、请求量和上游负载,再依据真实流量调整;共享校园/NAT 出口会让多位用户共用 IP 额度。Cloudflare Block 响应是否包含 `Retry-After` 取决于可用的响应配置;网页版会在响应提供该头时显示等待时长,并在当前页面会话中暂缓对同一路径的后续请求,但不会自动重试登录、提交或社区写操作。[Cloudflare Rate limiting rules 文档](https://developers.cloudflare.com/waf/rate-limiting-rules/)。

## 开发

```bash
Expand Down Expand Up @@ -110,21 +136,23 @@ GitHub,CI 里不需要这两个变量。

### 测试

`tests/` 下是 14 套 Node 侧校验 + 1 套 Electron 端到端:
`tests/` 下是 15 套 Node 侧校验 + 1 套 Electron 端到端:

```bash
npm test # 解析器校验:对真实页面快照 + 构造的 HUSTOJ 标记
npm run test:poller # 轮询器行为(启动/自停/不重叠/异常不中断)
npm run test:diff # 逐行 diff(插入/删除/行号单调/空侧/大输入)
npm run test:cache # 页面缓存(命中标记、maxAge 失效、按键清除、版本失效)
npm run test:async-resource # 缓存读取/后台刷新期间的加载状态与请求竞争
npm run test:web-functions # 网页版 API 代理:固定上游、错误限制、会话与代码提交
npm run test:native-views # 题面卡片/样例包装清理/`/upload` 绝对化、排名表格、
# 个人主页 `p(id,count)` 解析(离线,合成 fixture)
npm run test:cloud-settings # 云同步的**线格式**:`Settings` 必须是 JSON 字符串,
# 且读取时会解析回对象(用本地 stub 后端,不碰真实账号)
npm run test:codecheck # 提交前代码检查(文件 IO / 拼写 / 括号 / 头文件)
npm run test:markdown # 公告 Markdown + KaTeX 渲染(含公式/货币等边界情形)
npm run test:markdown-dom # Electron 中验证扩展语法的交互、布局及真实 HTML 消毒
npm run test:pages # 官网静态页:标题、锚点、样式表、无登录表单与桌面/移动端布局
npm run test:smoke # 主进程层联调:真实请求 xmoj.tech,覆盖 cookie 作用域、
# 会话持久化、解析,以及一次故意失败的登录
npm run test:live # 真实登录(需要 tests/account.txt),校验登录后的题库、
Expand Down
69 changes: 69 additions & 0 deletions electron/judge-details.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { parse } from 'node-html-parser';
import type { JudgeDetails, JudgeTest } from '../src/shared/types.ts';

export function parseJudgeDetails(html: string): JudgeDetails {
const tests: JudgeTest[] = [];
const status: Record<number, string> = {
0: 'Pending',
1: 'Pending',
2: 'Compiling',
3: 'Running',
4: 'AC',
5: 'PE',
6: 'WA',
7: 'TLE',
8: 'MLE',
9: 'OLE',
10: 'RE',
11: 'CE',
12: 'Compile OK',
13: 'Testing',
14: 'Skipped',
15: 'Ignored',
};
const start = /\bvar\s+json\s*=\s*/.exec(html);
if (start) {
const offset = start.index + start[0].length;
let depth = 0, quoted = false, escaped = false;
for (let i = offset; i < html.length; i++) {
const c = html[i];
if (quoted) {
if (escaped) escaped = false;
else if (c === '\\') escaped = true;
else if (c === '"') quoted = false;
} else if (c === '"') quoted = true;
else if (c === '{') depth++;
else if (c === '}' && --depth === 0) {
try {
const data = JSON.parse(html.slice(offset, i + 1));
const add = (task: Record<string, unknown>, group: string | null) => {
if (!task || typeof task !== 'object') return;
tests.push({
name: String(task.i ?? tests.length + 1),
group,
status: status[Number(task.s)] ?? String(task.s ?? 'Unknown'),
timeMs: Number(task.t) || 0,
memoryKb: Number(task.m) || 0,
score: typeof task.sc === 'number' ? task.sc : null,
});
};
for (const task of Array.isArray(data.tasks) ? data.tasks : []) {
if (data.st === 0) add(task, null);
else for (const test of Array.isArray(task.t) ? task.t : []) add(test, `子任务 ${task.i} · ${task.s} 分`);
}
} catch {
}
break;
}
}
}
tests.sort((a, b) => (a.group ?? '').localeCompare(b.group ?? '', undefined, { numeric: true }) ||
a.name.localeCompare(b.name, undefined, { numeric: true }));
const root = parse(html);
const diagnostic = root.querySelectorAll('pre')
.filter(node => !node.closest('#tpl'))
.map(node => node.textContent.trim())
.filter(Boolean)
.join('\n\n');
return { tests, diagnostic };
}
42 changes: 3 additions & 39 deletions electron/sources.ts
Original file line number Diff line number Diff line change
@@ -1,45 +1,9 @@
import { zipSync, strToU8 } from 'fflate';
import { XMOJ_ORIGIN, type AcCodeEntry, type ExportResult, } from '../src/shared/types.ts';
import { XMOJ_ORIGIN, type AcCodeEntry, type ExportResult, type JudgeDetails } from '../src/shared/types.ts';
import type { HttpClient } from './http.ts';
import { isLoginGate, parseStatusPage } from './parsers.ts';
import { parse } from 'node-html-parser';
import type { JudgeDetails, JudgeTest } from '../src/shared/types.ts';
export function parseJudgeDetails(html: string): JudgeDetails {
const tests: JudgeTest[] = [];
const status: Record<number, string> = { 0: 'Pending', 1: 'Pending', 2: 'Compiling', 3: 'Running', 4: 'AC', 5: 'PE', 6: 'WA', 7: 'TLE', 8: 'MLE', 9: 'OLE', 10: 'RE', 11: 'CE', 12: 'Compile OK', 13: 'Testing', 14: 'Skipped', 15: 'Ignored' };
const start = /\bvar\s+json\s*=\s*/.exec(html);
if (start) {
const offset = start.index + start[0].length;
let depth = 0, quoted = false, escaped = false;
for (let i = offset; i < html.length; i++) {
const c = html[i];
if (quoted) {
if (escaped) escaped = false;
else if (c === '\\') escaped = true;
else if (c === '"') quoted = false;
} else if (c === '"') quoted = true;
else if (c === '{') depth++;
else if (c === '}' && --depth === 0) {
try {
const data = JSON.parse(html.slice(offset, i + 1));
const add = (task: Record<string, unknown>, group: string | null) => {
if (!task || typeof task !== 'object') return;
tests.push({ name: String(task.i ?? tests.length + 1), group, status: status[Number(task.s)] ?? String(task.s ?? 'Unknown'), timeMs: Number(task.t) || 0, memoryKb: Number(task.m) || 0, score: typeof task.sc === 'number' ? task.sc : null });
};
for (const task of Array.isArray(data.tasks) ? data.tasks : []) {
if (data.st === 0) add(task, null);
else for (const test of Array.isArray(task.t) ? task.t : []) add(test, `子任务 ${task.i} · ${task.s} 分`);
}
} catch {}
break;
}
}
}
tests.sort((a, b) => (a.group ?? '').localeCompare(b.group ?? '', undefined, { numeric: true }) || a.name.localeCompare(b.name, undefined, { numeric: true }));
const root = parse(html);
const diagnostic = root.querySelectorAll('pre').filter(node => !node.closest('#tpl')).map(node => node.textContent.trim()).filter(Boolean).join('\n\n');
return { tests, diagnostic };
}
import { parseJudgeDetails } from './judge-details.ts';
export { parseJudgeDetails } from './judge-details.ts';
export async function fetchJudgeDetails(http: HttpClient, solutionId: number): Promise<JudgeDetails> {
const response = await http.get(`${XMOJ_ORIGIN}/reinfo.php?sid=${solutionId}`);
return parseJudgeDetails(response.body);
Expand Down
Loading
Loading