0.0.46 • Published 3 years ago

conize v0.0.46

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

Conize

Conize is a framework for using and building social applications without worrying about your pricavy. It runs in your browser and all your data is stored on your device. Data you send to your friends will be encrypted. By the way, this is a great possibility to backup your data.

In order to synchronize your data there is a default server. You can set up your own sync server by uploading two files to your or a friend's webserver. The server code fits on two DIN A4 pages, so it can easily be understood. You can also synchronize by copy-and-pasting without leaving any meta data. For example you can send the synchronization string via bluetooth. The set of transmission ways is extensible by plugins.

How to run Conize

git clone https://github.com/sbkaf/conize
cd conize     # step into the Conize repo folder
npm install   # install dependencies
npm run build # build conize with webpack in watch mode
  • and open index.html with your browser

How to use the social database (sdb)

// insert data and get its ID
const entryId = sdb.add({
  table: 'list_entry', // 'table' is a reserved keyword
  title: 'some important entry',
  added: '2020-02-20',
})

// share a row
sdb.share({
  rowId: entryId,
  contactId: someContactId,
})

// get a row by ID
const entry = sdb.get({ id: entryId })

// get the content of a table
const list = sdb.get({ table: 'list_entry' })

// update a row
sdb.update({
  id: entryId, // 'id' is a reserved keyword
  table: 'list_entry',
  title: 'some more important entry',
  // 'added' will keep the old value if you don't set it here
})

// delete a row
sdb.delete({ id: entryId })

How to enable/disable plugins?

  • open app.js with the editor of your choice
  • add or remove a plugin with require to or from the PLUGIN_LIST array

What are the building blocks an app page can be build (at the moment)?

Go to https://conize.org/index.html and open the 'page elements' tab in the playground.

How to write a Conize app

Generally, A Conize plugin consists of pages and events. Each page consists of a list of elements like labeld inputs, buttons or simple text. Each plugin has access to a local social database that synchronizes automatically and encrypted with your contacts.

const ReadmeExample = {

  // title in the app list
  name: 'ReadmeExample',

  // unique app specific id with 32 letters
  uuid: 'a824217252c74272b25712ff550b8d7c',

  // this page id is the startpage of this app
  firstPageId: 'readmeExample',

  // used tables
  tables: {
    readmeExample_entry: {
      text: 'text',
    },
  },

  // app events
  event: {
    // each event gets the following objects (among others)
    //   sdb: the social database
    //   form: the input data
    readmeExample_addEntry: ({sdb, form}) => {
      // add the new entry into the readmeExample_entry table
      const entryId = sdb.add({
        table: 'readmeExample_entry',
        text: form.newEntryText,
      })
      // share the entry with the given contact
      sdb.share({
        rowId: entryId,
        contactId: form.shareWith,
      })
      // set the next page to open
      return {
        id: 'readmeExample',
      }
    },
  },

  // app pages
  page: {
    // each page gets the following objects (among others)
    // sdb: the social database
    // _: translation function
    // page: object with the following functions
    // - append: function to add elements to the page
    readmeExample: ({sdb, _, page}) => {
      // get all entries
      const entryList = sdb.get({
        table: 'readmeExample_entry',
      })
      // add a title to the page
      page.append([{
        type: 'title',
        text: 'Readme Example',
      }])
      // add all entries to the page
      entryList.forEach(({text}) => {
        page.append([{
          type: 'entry',
          text: text,
        }])
      })
      // add the input for the new entry
      page.append([{
        type: 'input',
        id: 'newEntryText',
        label: _('New entry'),
      }, {
      // add a dropdown with the users contacts
        type: 'dropdown',
        id: 'shareWith',
        label: _('Share with'),
        optionMap:
          sdb.getContactList()
            .reduce((out, con) => {
              out[con.id] = con.name
              return out
            }, {}),
      }, {
      // add an add button
        type: 'button',
        eventId: 'readmeExample_addEntry',
        text: _('add'),
      }])
    },
  },
}

module.exports = ReadmeExample
0.0.46

3 years ago

0.0.44

4 years ago

0.0.43

4 years ago

0.0.42

4 years ago

0.0.41

4 years ago

0.0.40

4 years ago

0.0.39

4 years ago

0.0.38

4 years ago

0.0.37

4 years ago

0.0.36

4 years ago

0.0.35

4 years ago

0.0.33

4 years ago

0.0.31

4 years ago

0.0.30

4 years ago

0.0.29

4 years ago

0.0.28

4 years ago

0.0.27

4 years ago

0.0.25

4 years ago

0.0.26

4 years ago

0.0.23

4 years ago

0.0.24

4 years ago

0.0.22

4 years ago

0.0.21

4 years ago

0.0.1

4 years ago