-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8aed2e
commit da65d2d
Showing
8 changed files
with
208 additions
and
244 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,104 +1,9 @@ | ||
import "dotenv/config"; | ||
import { log } from "./log.js"; | ||
import { Sequelize, DataTypes, Op } from "sequelize"; | ||
import { Database } from "bun:sqlite"; | ||
|
||
const accs_sequelize = new Sequelize({ | ||
logging: msg => console.log(log.info(msg)), | ||
dialect: "sqlite", | ||
storage: `${process.env.DATA_PATH}/accounts.sqlite`, | ||
}); | ||
const accs = new Database(`${process.env.DATA_PATH}/accounts.sqlite`); | ||
const infdb = new Database(`${process.env.DATA_PATH}/infinitecraft.sqlite`); | ||
|
||
const account_db = accs_sequelize.define("accounts", { | ||
id: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
unique: true, | ||
primaryKey: true, | ||
}, | ||
username: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
unique: true, | ||
}, | ||
name: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
hashed_pass: { | ||
type: DataTypes.INTEGER, | ||
allowNull: false, | ||
}, | ||
secret_key: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
about: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
badges: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
last_login: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
playedgames: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
type: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
pfp_url: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
custom_css: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
banned: { | ||
type: DataTypes.TEXT, | ||
allowNull: true, | ||
}, | ||
}); | ||
infdb.exec("PRAGMA journal_mode = WAL;"); | ||
accs.exec("PRAGMA journal_mode = WAL;"); | ||
|
||
const infi_sequelize = new Sequelize({ | ||
logging: msg => console.log(log.info(msg)), | ||
dialect: "sqlite", | ||
storage: `${process.env.DATA_PATH}/infinitecraft.sqlite`, | ||
}); | ||
|
||
const infiniteCache = infi_sequelize.define("caches", { | ||
1: { | ||
type: DataTypes.TEXT, | ||
}, | ||
2: { | ||
type: DataTypes.TEXT, | ||
}, | ||
result_item: { | ||
type: DataTypes.TEXT, | ||
}, | ||
result_emoji: { | ||
type: DataTypes.TEXT, | ||
}, | ||
}); | ||
|
||
infi_sequelize.sync().then(() => { | ||
console.log(log.success("Infinite Craft cache is online.")); | ||
}).catch((error) => { | ||
console.error(log.error("Failed to synchronize Infinite Craft database:")); | ||
console.error(log.error(error)); | ||
}); | ||
|
||
accs_sequelize.sync().then(() => { | ||
console.log(log.success("Accounts Database is online.")); | ||
}).catch((error) => { | ||
console.error(log.error("Failed to synchronize accs database:")); | ||
console.error(log.error(error)); | ||
}); | ||
|
||
export { accs_sequelize, infi_sequelize, account_db, infiniteCache }; | ||
export { accs, infdb }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module.exports = { | ||
name: "Selenite", // Name of your application | ||
script: "index.js", // Entry point of your application | ||
interpreter: "~/.bun/bin/bun", // Path to the Bun interpreter | ||
}; |