stephenou / fruitionsite

Build your website with Notion for free
https://fruitionsite.com
MIT License
1.59k stars 218 forks source link

Anyone can assign public page to your site #65

Open osbre opened 3 years ago

osbre commented 3 years ago

For example, check this: https://fruitionsite.com//Test-page-ad1f8ecc8f59404fa0a894f6af222a31 https://amyrogers.design/Test-page-ad1f8ecc8f59404fa0a894f6af222a31 https://hunterheston.com/Test-page-ad1f8ecc8f59404fa0a894f6af222a31

These pages are not created by authors, but anyone can use it.

I found that notion2site.com and super.so already solved this problem. I think there must be some solution, we'll need to figure out how to do that

osbre commented 3 years ago

Maybe some dynamically-generated URLs whitelist

emindeniz99 commented 3 years ago

/api/publicpagedata return owner username, you can match owner username and filter it. But it will cost some time , I have tested it few days ago. It works, I will try to share in a few days. https://emindeniz99.com/Test-page-ad1f8ecc8f59404fa0a894f6af222a31 If a page is not belong to me, worker redirect to home page. ( It can show 404 page if you want ) https://github.com/emindeniz99/fruitionsite/tree/my-websites

The solution has a good alternative that fetches all possible pages and stores them in key-value store ( it is free now )

osbre commented 3 years ago

@emindeniz99 that's really cool solution! Thanks

simple10 commented 2 years ago

This is easily fixed by setting the hostname to [YOUR NOTION DOAMIN] instead of www.notion.so in the fetchAndApply function. I haven't tested it extensively to see if it breaks anything, but it solves the problem of serving pages from other Notion sites.

async function fetchAndApply(request) {
    if (request.method === 'OPTIONS') {
      return handleOptions(request);
    }
    let url = new URL(request.url);

    // CHANGE THIS...
    // url.hostname = 'www.notion.so';
    // To YOUR notion public domain...
    url.hostname = 'simple10.notion.site';
    ...
}