Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(filter) 支持使用 js 代码自定义筛选 oier/school/contest #130

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from

Conversation

yaoxi-std
Copy link

@yaoxi-std yaoxi-std commented Jan 24, 2025

Demo 可以见 https://oier.yaoxi-std.dev/

(可能有些网络环境的 bug 导致随机 404,不过这个 demo 等到合并以后就不开了所以懒得修)

Copy link

netlify bot commented Jan 24, 2025

Deploy Preview for oierdb ready!

Name Link
🔨 Latest commit d947408
🔍 Latest deploy log https://app.netlify.com/sites/oierdb/deploys/679390313d0a8e0008b48499
😎 Deploy Preview https://deploy-preview-130--oierdb.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@yhx-12243
Copy link
Member

yhx-12243 commented Jan 24, 2025

总体不错(其实我之前也实现过类似的,anyway very good),几个建议:
首先把 CI/CD 过了(跑下 linter)
其次 API 的话可以传整个 OIerDb 对象
最后的话(可选)可以将 API 改成 esm 的形式(export)或 return(new Function 隔离性应该还可以吧,不是很清楚)


哦对了,一个比较关键的一点是最好支持下异步,我当时写的时候默认当 AsyncFunction 处理的(两个地方,一个是 new AsyncFunction,一个是返回的 filter 也可以是异步的)

@renbaoshuo
Copy link
Member

这个能保证安全性吗?我也是一直在考虑安全性才没有做这个功能来着

@yhx-12243
Copy link
Member

这个能保证安全性吗?我也是一直在考虑安全性才没有做这个功能来着

其实我觉得还好吧,反正就是一个前端的,代码都是自己输入的,就和 F12 控制台的功能一样,只是加了个展示而已

@yaoxi-std
Copy link
Author

这个能保证安全性吗?我也是一直在考虑安全性才没有做这个功能来着

代码是在用户浏览器端运行的,不会对服务端造成影响(毕竟部署是静态的),用户代码产生的奇怪后果应该交给用户自己承担

yaoxi-std and others added 2 commits January 24, 2025 18:48
Co-authored-by: yhx-12243 <yhx12243@gmail.com>
@renbaoshuo
Copy link
Member

Monaco 的深色模式模式适配做一下吧。

标题栏可以改一下名,其他几个板块的名称都是名词,感觉一个动词放到这里不是很合适……

Copy link
Member

@renbaoshuo renbaoshuo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此外,我看还从 cdn.jsdelivr.net 上加载了一些资源,可否移动到 cdnjs 上加载?目前 OIerDb 在使用我自建的 cdnjs.baoshuo.ren 的镜像。

</Table.Cell>
<Table.Cell textAlign="center">{school.rank + 1}</Table.Cell>
<Table.Cell>
<Link to={'/school/' + school.id}>{school.name}</Link>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Link to={'/school/' + school.id}>{school.name}</Link>
<Link to={`/school/${school.id}`}>{school.name}</Link>

<Table.Row key={contest.id}>
<Table.Cell>{contest.id + 1}</Table.Cell>
<Table.Cell>
<Link to={'/contest/' + contest.id}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<Link to={'/contest/' + contest.id}>
<Link to={`/contest/${contest.id}`}>

src/pages/filter/index.tsx Outdated Show resolved Hide resolved
@yaoxi-std yaoxi-std marked this pull request as draft January 24, 2025 13:09
@yaoxi-std
Copy link
Author

yaoxi-std commented Jan 25, 2025

Monaco 的深色模式模式适配做一下吧。

标题栏可以改一下名,其他几个板块的名称都是名词,感觉一个动词放到这里不是很合适……

@renbaoshuo 这个可以换成啥呀,感觉不太想得到合适的两字名词

@renbaoshuo
Copy link
Member

Monaco 的深色模式模式适配做一下吧。
标题栏可以改一下名,其他几个板块的名称都是名词,感觉一个动词放到这里不是很合适……

@renbaoshuo 这个可以换成啥呀,感觉不太想得到合适的两字名词

我感觉放到顶栏其实不太合适,可以考虑把入口放到搜索框的附近,然后叫「自定义搜索」?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants