bio-free.openapps.xyz

Source

This app’s code and revision history are public. Download a copy or explore the files below.

Public
The app’s code and revision history are public.
Owned app · rev 3e98d5e10bac
Run it yourself
Take the whole tree and run it on your own machine. The download needs no account. Cloning needs a sign-in.
Download .zip
bounded clone 4ce232ee856d7de1ba5f2b6d
A copy you download is not bounded. The guarantees this app runs under - declared egress, proven invariants, writes that fail closed - live in the runtime serving this page, not in the files. What you get is auditable source you can read and run, with no runtime guarantees attached.
← All files
policy.json
{
  "constants": {
    "AGENT_ADDRESS": "CGYD8nh8Rg2mEcdsVFKi2Hi6PNX4Poaw9f38RwJy6vgB",
    "AGENT_ADDRESS_BOUND": true
  },
  "auth": {
    "anonymous": true
  },
  "defs": {
    "pageShape": "@StringUtils.length(@newData.name) >= 1 && @StringUtils.length(@newData.name) <= 60 && @StringUtils.length(@newData.bio) <= 160 && @StringUtils.length(@newData.avatar) <= 60000 && @StringUtils.length(@newData.theme) <= 20 && @StringUtils.length(@newData.buttonStyle) <= 20 && @StringUtils.length(@newData.links) <= 120000 && @StringUtils.length(@newData.socials) <= 8000",
    "sameContent": "@newData.name == @data.name && @newData.bio == @data.bio && @newData.avatar == @data.avatar && @newData.theme == @data.theme && @newData.buttonStyle == @data.buttonStyle && @newData.links == @data.links && @newData.socials == @data.socials && @newData.showCredit == @data.showCredit"
  },
  "pages/$handle": {
    "description": "A public link in bio page at /<handle>. Public by design, like any link in bio page: anyone can read it. links is a JSON list of {id, title, url}; socials is a JSON object of kind to address. Owners change everything but views; the public api function may only add one to views.",
    "fields": {
      "name": "String",
      "bio": "String",
      "avatar": "String",
      "theme": "String",
      "buttonStyle": "String",
      "links": "String",
      "socials": "String",
      "showCredit": "Bool",
      "views": "UInt",
      "createdBy": "String!",
      "createdAt": "UInt!"
    },
    "rules": {
      "read": "true",
      "create": "@user.id != null && get(/pages/$handle) == null && @newData.createdBy == @user.id && @newData.createdAt <= @time.now && @newData.views == 0 && @StringUtils.length($handle) >= 3 && @StringUtils.length($handle) <= 30 && @def.pageShape && getAfter(/pages/$handle/owners/@user.id) != null && getAfter(/pagekeys/$handle) != null",
      "update": "@user.id != null && ((get(/pages/$handle/owners/@user.id) != null && @newData.views == @data.views && @def.pageShape) || (@user.id == @const.BOUNDED_PUBLIC_PRINCIPAL_API && @newData.views == @data.views + 1 && @def.sameContent))",
      "delete": "false"
    }
  },
  "pages/$handle/owners/$userId": {
    "description": "Someone who may edit the page: its creator, or anyone who presented the page's owner key (the edit link).",
    "fields": {
      "at": "UInt!"
    },
    "rules": {
      "read": "@user.id != null && (@user.id == $userId || @user.id == @const.BOUNDED_PUBLIC_PRINCIPAL_API)",
      "create": "@user.id != null && @user.id == $userId && @newData.at <= @time.now && ((get(/pages/$handle) == null && getAfter(/pages/$handle).createdBy == @user.id) || (get(/pages/$handle) != null && getAfter(/pageclaims/$handle/c/@user.id).key == get(/pagekeys/$handle).key))",
      "update": "false",
      "delete": "false"
    }
  },
  "pages/$handle/clicks/$linkId": {
    "description": "How often one link on the page was opened. Only owners can read it; only the public api function can count, one at a time.",
    "fields": {
      "count": "UInt"
    },
    "rules": {
      "read": "@user.id != null && (@user.id == @const.BOUNDED_PUBLIC_PRINCIPAL_API || get(/pages/$handle/owners/@user.id) != null)",
      "create": "@user.id != null && @user.id == @const.BOUNDED_PUBLIC_PRINCIPAL_API && get(/pages/$handle) != null && @newData.count == 1 && @StringUtils.length($linkId) <= 16",
      "update": "@user.id != null && @user.id == @const.BOUNDED_PUBLIC_PRINCIPAL_API && @newData.count == @data.count + 1",
      "delete": "false"
    }
  },
  "pagekeys/$handle": {
    "description": "The page's owner key. Only the api function can read it, to check keys; owners carry it in their edit link.",
    "fields": {
      "key": "String!"
    },
    "rules": {
      "read": "@user.id == @const.BOUNDED_PUBLIC_PRINCIPAL_API",
      "create": "@user.id != null && get(/pages/$handle) == null && getAfter(/pages/$handle).createdBy == @user.id && @StringUtils.length(@newData.key) >= 20",
      "update": "false",
      "delete": "false"
    }
  },
  "pageclaims/$handle/c/$userId": {
    "description": "A key someone presents to become an owner. Never readable.",
    "fields": {
      "key": "String"
    },
    "rules": {
      "read": "false",
      "create": "@user.id != null && @user.id == $userId",
      "update": "@user.id != null && @user.id == $userId",
      "delete": "false"
    }
  },
  "ogRoutes": [
    {
      "path": "/:handle",
      "collection": "pages/:handle",
      "title": "$.name",
      "description": "$.bio",
      "defaultTitle": "Bio",
      "defaultDescription": "A free link in bio page, made with Bio by OpenApps.",
      "defaultImage": "https://free-apps.openapps.xyz/og/bio.png"
    }
  ],
  "functions": {
    "api": {
      "auth": "true",
      "entry": "functions/api.ts",
      "public": true,
      "methods": [
        "GET",
        "POST",
        "PATCH"
      ],
      "cors": "passthrough"
    }
  }
}

Change history

Quality pass: reorder, hide links, headers, QR share, 15 social icons, API docs
3e98d5e10b · 4 hours ago
Bounded source sync
c1194348e3 · 1 day ago
Bounded source sync
5b1f3fab35 · 1 day ago
Bounded source sync
21e45889ea · 1 day ago
Bounded source sync
8e21b0e5b7 · 1 day ago
Bounded source sync
0598bcc9b2 · 1 day ago
Bounded source sync
0ea5668865 · 1 day ago