aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/+layout.svelte
blob: e1c3ff1e95b425f6107b336f004d22d92cd005d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<script>
	import '../app.css';
	import { page } from '$app/stores';

	let { host, pathname } = $page.url;
</script>

<svelte:head>
	<title>coinos</title>
	<meta property="og:title" content="coinos" />
	<meta name="twitter:title" content="coinos" />

	<meta property="og:image" content={`${host}/icons/logo.svg`} />

	<meta property="og:type" content="website" />
	<meta property="og:description" content="An easy to use bitcoin web wallet" />
	<meta name="description" content="An easy to use bitcoin web wallet" />

	<meta name="keywords" content="coinos easy bitcoin web wallet" />

	<meta name="twitter:image" content={`${host}/icons/logo.svg`} />
	<meta name="twitter:card" content="summary_large_image" />

	<meta property="og:url" content={host + pathname} />
	<meta name="twitter:site" content="@coinoswallet" />
	<meta name="twitter:creator" content="@coinoswallet" />
</svelte:head>

<slot />

<style global>
	:root {
		--toastContainerTop: auto;
		--toastContainerRight: auto;
		--toastContainerBottom: 8rem;
		--toastContainerLeft: calc(50vw - 8rem);
		--toastBackground: #292929;
	}
</style>
ht .kd { color: #080; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #080; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #080 } /* Keyword.Pseudo */ .highlight .kr { color: #080; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #00D; font-weight: bold } /* Literal.Number */ .highlight .s { color: #D20; background-color: #FFF0F0 } /* Literal.String */ .highlight .na { color: #369 } /* Name.Attribute */ .highlight .nb { color: #038 } /* Name.Builtin */ .highlight .nc { color: #B06; font-weight: bold } /* Name.Class */ .highlight .no { color: #036; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555 } /* Name.Decorator */ .highlight .ne { color: #B06; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #06B; font-weight: bold } /* Name.Function */ .highlight .nl { color: #369; font-style: italic } /* Name.Label */ .highlight .nn { color: #B06; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #369; font-weight: bold } /* Name.Property */ .highlight .nt { color: #B06; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #369 } /* Name.Variable */ .highlight .ow { color: #080 } /* Operator.Word */ .highlight .w { color: #BBB } /* Text.Whitespace */ .highlight .mb { color: #00D; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #00D; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #00D; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #00D; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #00D; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #D20; background-color: #FFF0F0 } /* Literal.String.Affix */ .highlight .sb { color: #D20; background-color: #FFF0F0 } /* Literal.String.Backtick */ .highlight .sc { color: #D20; background-color: #FFF0F0 } /* Literal.String.Char */ .highlight .dl { color: #D20; background-color: #FFF0F0 } /* Literal.String.Delimiter */ .highlight .sd { color: #D20; background-color: #FFF0F0 } /* Literal.String.Doc */ .highlight .s2 { color: #D20; background-color: #FFF0F0 } /* Literal.String.Double */ .highlight .se { color: #04D; background-color: #FFF0F0 } /* Literal.String.Escape */ .highlight .sh { color: #D20; background-color: #FFF0F0 } /* Literal.String.Heredoc */ .highlight .si { color: #33B; background-color: #FFF0F0 } /* Literal.String.Interpol */ .highlight .sx { color: #2B2; background-color: #F0FFF0 } /* Literal.String.Other */ .highlight .sr { color: #080; background-color: #FFF0FF } /* Literal.String.Regex */ .highlight .s1 { color: #D20; background-color: #FFF0F0 } /* Literal.String.Single */ .highlight .ss { color: #A60; background-color: #FFF0F0 } /* Literal.String.Symbol */ .highlight .bp { color: #038 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #06B; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #369 } /* Name.Variable.Class */ .highlight .vg { color: #D70 } /* Name.Variable.Global */ .highlight .vi { color: #33B } /* Name.Variable.Instance */ .highlight .vm { color: #369 } /* Name.Variable.Magic */ .highlight .il { color: #00D; font-weight: bold } /* Literal.Number.Integer.Long */
const { DataTypes } = require('sequelize');

const attributes = {
  id: {
    type: DataTypes.INTEGER(11),
    primaryKey: true,
    autoIncrement: true,
    allowNull: false
  },
  uuid: {
    type: DataTypes.STRING(255),
    allowNull: false,
    comment: "unique UUID as more secure reference"
  },
  password: {
    type: DataTypes.STRING(255),  // Encrypted Password type ?? 
    allowNull: false,
    validate: {
      len: [8, 255]
    }
  },
  email: {
    type: DataTypes.STRING(255),
    validate: {
      isEmail: true
    }
  },
  sms: {
    type: DataTypes.STRING(255),
    validate: {
      is: /^[0-9]+$/ // replace spaces, brackets, dashes dynamically prior to create
    }
  },
  email_verified: {
    type: DataTypes.BOOLEAN,
    allowNull: false,
    defaultValue: false,
  },
  sms_verified: {
    type: DataTypes.BOOLEAN,
    allowNull: false,
    defaultValue: false,
  },
  access: {
    type: DataTypes.ENUM,
    values: ['Member', 'Tester', 'Admin'],
    defaultValue: 'Member'
  }
}

const options = {
  tableName: "users",
  comment: "",
  timestamps: true,
  createdAt: 'created_at',
  updatedAt: 'updated_at',
  indexes: [
    {fields: ['uuid', 'email']}
  ]
};

db["User"] = db.define("users_model", attributes, options);


  // *** Move to user_preferences *** 
//   unit: {
//     type: DataTypes.STRING(255),
//     allowNull: true,
//     defaultValue: 'SAT',
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "unit"
//   },
//   currency: {
//     type: DataTypes.STRING(255),
//     allowNull: true,
//     defaultValue: "CAD",
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "currency"
//   },
//   currencies: {
//     type: DataTypes.JSON,
//     allowNull: false,
//     defaultValue: ["USD"],
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "currencies"
//   },

//   fiat: { ??? 
//     type: DataTypes.BOOLEAN,
//     allowNull: true,
//     defaultValue: null,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "fiat"
//   },

// ** Remove - redundant / unnecessary **
//   account_id: {
//     type: DataTypes.INTEGER(11),
//     allowNull: true,
//     defaultValue: null,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "account_id"
//   },
//   twofa: { = otp_secret NOT NULL
//     type: DataTypes.INTEGER(1),
//     allowNull: true,
//     defaultValue: null,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "twofa"
//   },

// *** Move to user_keys ***

//   otpsecret: {
//     type: DataTypes.STRING(255),
//     allowNull: true,
//     defaultValue: "CAD",
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "otpsecret"
//   },
//   pin: {
//     type: DataTypes.STRING(255),
//     allowNull: true,
//     defaultValue: null,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "pin"
//   },
//   seed: {
//     type: DataTypes.STRING(255),
//     allowNull: true,
//     defaultValue: null,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "seed"
//   },

// ** What are these exactly ... ? **
//   ip: { ?? 
//     type: DataTypes.INTEGER.UNSIGNED,
//     allowNull: true,
//     defaultValue: null,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "ip"
//   },

//   index: {
//     type: DataTypes.INTEGER,
//     allowNull: true,
//     defaultValue: 0,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "index"
//   },

// };

// *** Add breakout table
//   subscriptions: {
//     type: DataTypes.TEXT,
//     get: function() {
//       return JSON.parse(this.getDataValue("subscriptions"));
//     },
//     set: function(value) {
//       return this.setDataValue("subscriptions", JSON.stringify(value));
//     },
//     allowNull: true,
//     defaultValue: null,
//     primaryKey: false,
//     autoIncrement: false,
//     comment: null,
//     field: "subscriptions"
//   },

  // *** replaced with other field(s) ***
  // locked: { - embed logic with user status (?)
  //   type: DataTypes.BOOLEAN,
  //   allowNull: true,
  //   defaultValue: false,
  //   primaryKey: false,
  //   autoIncrement: false,
  //   comment: null,
  //   field: "locked"
  // },