yuki minoh
https://gyazo.com/f7ce56c9572ec18abc4f9c26844db082
this is yuki_minoh’s page
ここを作った人です
code:script.js
//import "/api/code/public-minaph/日記を自動作成するUserScript/update.js";
target project nameのみ変更
code:script.js
//async function m(t){return(await y(t)).flatMap(e=>/\d{4}\/\d{2}\/\d{2}/.test(e.title)?{pageId:e.id,title:e.title,commitId:e.commitId,pin:e.pin}:[])}async function y(t){let s=await fetch(https://scrapbox.io/api/pages/${t}?limit=1),{count:e}=await s.json(),a=Math.min(e,1e3),n=Math.floor(e/1e3)+1;return(await Promise.all(...Array(n).keys().map(async r=>{let o=await fetch(/api/pages/${t}/?limit=${a}&skip=${r*1e3}),{pages:c}=await o.json();return c}))).flat()}function l(t,s){return new Promise((e,a)=>{let n=new WebSocket(t,s),i=(r,o)=>{let c=x=>{o(x),n.removeEventListener(r,c)};n.addEventListener(r,c)};i("error",a),i("open",()=>e({close:()=>new Promise(r=>{n.close(),i("close",o=>r(o))}),send:r=>{n.send(r)},receive:async function*(){for(;;)yield await new Promise(o=>i("message",c=>o(c)))}}))})}var b=({pin:t,commitId:s,pageId:e,userId:a,projectId:n})=>422${JSON.stringify(["socket.io-request",{method:"commit",data:{kind:"page",parentId:s,changes:[{pin:t>0?0:Number.MAX_SAFE_INTEGER-Math.floor(Date.now()/1e3)}],cursor:null,pageId:e,userId:a,projectId:n,freeze:!0}}])};async function p(t){let{send:s,receive:e,close:a}=await l("wss://scrapbox.io/socket.io/?EIO=4&transport=websocket"),n=e();await n.next(),await s("40"),await n.next(),await s(b(t)),await n.next(),await a()}var g="js-fetch-proxy",d=()=>scrapbox.Project.name===g?h():f();d();scrapbox.addListener("project:changed",d);var u;async function h(){f();let t=await fetch("https://scrapbox.io/api/users/me"),{id:s}=await t.json(),e=await fetch(https://scrapbox.io/api/projects/${g}),{id:a}=await e.json();w(s,a),u=setInterval(()=>w(s,a),24*3600*1e3)}function f(){clearInterval(u)}async function w(t,s){let e=await m(g),a=e.filter(({pin:i})=>i>0);for(let i of a)i.title!==v(new Date)&&await p({userId:t,projectId:s,...i});let n=e.find(({title:i})=>i===v(new Date));!n||n.pin>0||await p({userId:t,projectId:s,...n})}function v(t){return${t.getFullYear()}/${P(t.getMonth()+1)}/${P(t.getDate())}}function P(t){return String(t).padStart(2,"0")}