open source is social v-it.org
at main 22 lines 529 B view raw
1// SPDX-License-Identifier: MIT 2// Copyright (c) 2026 sol pbc 3 4export class CursorStore { 5 constructor(state, env) { 6 this.state = state; 7 } 8 9 async fetch(request) { 10 if (request.method === 'GET') { 11 return new Response((await this.state.storage.get('cursor')) || ''); 12 } 13 14 if (request.method === 'PUT') { 15 const text = await request.text(); 16 await this.state.storage.put('cursor', text); 17 return new Response('ok'); 18 } 19 20 return new Response('method not allowed', { status: 405 }); 21 } 22}