Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release/0.3.1 #104

Merged
merged 12 commits into from
Oct 13, 2023
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.3.1] - 2023-10-12
### Changed
- Allow upload social media data to Clowder [#99](https://github.com/ncsa/standalone-smm-smile/issues/99)

### Added
- More environment variable to control such as Twitter/Reddit Auth, Expiration date [#101](https://github.com/ncsa/standalone-smm-smile/issues/)

## [0.3.0] - 2023-09-14
### Fixed
- Github action to auto generate docker container [#93](https://github.com/ncsa/standalone-smm-smile/issues/93)
Expand Down
24 changes: 11 additions & 13 deletions www/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,14 @@ var app = express();
*/
smileHomePath = path.join(process.env.HOME, 'smile');
s3FolderName = process.env.USER || 'local';
SINGLE_USER = 'true';
CLOWDER_ON = process.env.CLOWDER_ON || 'false';
SINGLE_USER = process.env.SINGLE_USER ? process.env.SINGLE_USER === 'true': true;
CLOWDER_ON = process.env.CLOWDER_ON ? process.env.CLOWDER_ON ==='true': false;
TWITTER_ON = process.env.TWITTER_ON ? process.env.TWITTER_ON ==='true': true;
REDDIT_ON = process.env.REDDIT_ON ? process.env.REDDIT_ON === 'true': true;
SHARE_EXPIRE_IN = process.env.SHARE_EXPIRE_IN ? process.env.SHARE_EXPIRE_IN : 1;
CLOWDER_BASE_URL= process.env.CLOWDER_BASE_URL || "http://clowder.localhost/";
BUCKET_NAME = process.env.BUCKET_NAME ? process.env.BUCKET_NAME: 'macroscope-smile';
SMILE_GRAPHQL_URL = process.env.SMILE_GRAPHQL_URL ? process.env.SMILE_GRAPHQL_URL: "http://localhost:5050/graphql";
email = true;

/**
Expand All @@ -38,7 +43,6 @@ if (process.env.DOCKERIZED === 'true') {
// determine credentials either from file or from environment variable
REDIS_URL = process.env.REDIS_URL;
RABBITMQ_URL = process.env.RABBITMQ_URL;
SMILE_GRAPHQL_URL = process.env.SMILE_GRAPHQL_URL;
AWS_ACCESSKEY = process.env.AWS_ACCESSKEY;
AWS_ACCESSKEYSECRET = process.env.AWS_ACCESSKEYSECRET;
TWITTER_CONSUMER_KEY = process.env.TWITTER_CONSUMER_KEY;
Expand All @@ -57,9 +61,6 @@ if (process.env.DOCKERIZED === 'true') {
DROPBOX_CLIENT_SECRET = process.env.DROPBOX_CLIENT_SECRET;
GOOGLE_CLIENT_ID = process.env.GOOGLE_CLIENT_ID;
GOOGLE_CLIENT_SECRET = process.env.GOOGLE_CLIENT_SECRET;
BUCKET_NAME = process.env.BUCKET_NAME;
SINGLE_USER = process.env.SINGLE_USER;
CLOWDER_ON = process.env.CLOWDER_ON;

if (process.env.EMAIL_HOST === "" || process.env.EMAIL_HOST === undefined || process.env.EMAIL_HOST === null ||
process.env.EMAIL_FROM_ADDRESS === "" || process.env.EMAIL_FROM_ADDRESS === undefined || process.env.EMAIL_FROM_ADDRESS === null) {
Expand All @@ -71,7 +72,7 @@ if (process.env.DOCKERIZED === 'true') {
batchHandler = new RabbitmqSender();
s3 = new S3Helper(true, AWS_ACCESSKEY, AWS_ACCESSKEYSECRET);

if (SINGLE_USER === 'true') {
if (SINGLE_USER) {
global.checkIfLoggedIn = function (req, res, next) {
req.user = {email: s3FolderName};
return next();
Expand Down Expand Up @@ -169,10 +170,6 @@ if (process.env.DOCKERIZED === 'true') {
DROPBOX_CLIENT_SECRET = config.dropbox.client_secret;
GOOGLE_CLIENT_ID = config.google.client_id;
GOOGLE_CLIENT_SECRET = config.google.client_secret;
SMILE_GRAPHQL_URL = "http://localhost:5050/graphql";
BUCKET_NAME = 'macroscope-smile';
SINGLE_USER = 'true';
CLOWDER_ON = 'false';

lambdaHandler = new LambdaHelper(AWS_ACCESSKEY, AWS_ACCESSKEYSECRET);
batchHandler = new BatchHelper(AWS_ACCESSKEY, AWS_ACCESSKEYSECRET);
Expand Down Expand Up @@ -240,8 +237,9 @@ analysesRoutesFiles.forEach(function (route, i) {
introduction: formParam.introduction.join(" "),
wiki: formParam.wiki,
param: formParam,
SINGLE_USER: SINGLE_USER==='true',
CLOWDER_ON: CLOWDER_ON==='true',
SINGLE_USER: SINGLE_USER,
CLOWDER_ON: CLOWDER_ON,
SHARE_EXPIRE_IN: SHARE_EXPIRE_IN,
user: req.user,
enableEmail: email
});
Expand Down
9 changes: 4 additions & 5 deletions www/public/bootstrap/js/customized/view_helperFunc.js
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,10 @@ function submitHistory(currItem, folderURL){

// ADD TO CLOWDER MODAL
$("#clowder-files-list").empty();
if (data.title != 'Social Media'){
clowderFileGen(data.download);
clowderFileMeta();
$('.fileTags').tagsinput({ freeInput: true });
}
clowderFileGen(data.download);
clowderFileMeta();
$('.fileTags').tagsinput({ freeInput: true });


if ('title' in data || 'ID' in data){
appendTitle(data.title, data.ID);
Expand Down
2 changes: 1 addition & 1 deletion www/routes/businessLogic/cite.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ router.get('/citation', function (req, res) {
res.render('citation', {
user: req.user,
parent: '/',
SINGLE_USER:SINGLE_USER==='true'
SINGLE_USER:SINGLE_USER
});
});

Expand Down
5 changes: 3 additions & 2 deletions www/routes/businessLogic/history.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ router.get('/history', checkIfLoggedIn, function (req, res, next) {
res.render('history', {
user: req.user,
parent: '/',
SINGLE_USER: SINGLE_USER==='true',
CLOWDER_ON: CLOWDER_ON==='true',
SINGLE_USER: SINGLE_USER,
CLOWDER_ON: CLOWDER_ON,
SHARE_EXPIRE_IN: SHARE_EXPIRE_IN,
enableEmail: email
});
});
Expand Down
2 changes: 1 addition & 1 deletion www/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ router.get('/', function (req, res, next) {
res.render('index', {
user: req.user,
pages: pages,
SINGLE_USER:SINGLE_USER==='true',
SINGLE_USER:SINGLE_USER,
});
});

Expand Down
4 changes: 3 additions & 1 deletion www/routes/search/query.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ router.get('/query', checkIfLoggedIn, function (req, res) {
user: req.user,
parent: '/',
error: req.query.error,
SINGLE_USER: SINGLE_USER === 'true',
SINGLE_USER: SINGLE_USER,
CLOWDER_ON: CLOWDER_ON,
REDDIT_ON: REDDIT_ON,
status: status,
});
})
Expand Down
2 changes: 1 addition & 1 deletion www/views/components/share.pug
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ div(id="share-modal" class="modal fade" role="dialog" data-backdrop="static" dat
div(class="modal-body form")
div(class="modal-message")
div(class="form-group")
p Copy and share the link below. Please note that the link will expire in 7 days.
p Copy and share the link below. Please note that the link will expire in #{SHARE_EXPIRE_IN} day(s).
div(class="form-group")
div(class="col-md-10 col-md-10 col-xs-12")
input(class="form-control" id="share-link", placeholder="Nothing to be shared yet")
Expand Down
28 changes: 20 additions & 8 deletions www/views/search/auth.pug
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,25 @@ div(id="auth-panel")
//img(src='bootstrap/img/logo/twitter-sm-logo.png', width="30px", height="30px")
//| Twitter integration temporarily disabled
div(class="twitterV2-auth", id="twitterV2-auth")
a(class="btn btn-primary btn-block auth-button", href="login/twitterV2")
img(src='bootstrap/img/logo/x-sm-logo.png', width="30px", height="30px")
| Authorize with your Twitter/X account
img(src="bootstrap/img/logo/checkbox.png", class="export-success", width="30px", style="display:none;")
if TWITTER_ON
a(class="btn btn-primary btn-block auth-button", href="login/twitterV2")
img(src='bootstrap/img/logo/x-sm-logo.png', width="30px", height="30px")
| Authorize with your Twitter/X account
img(src="bootstrap/img/logo/checkbox.png", class="export-success", width="30px", style="display:none;")
else
a(class="btn btn-primary btn-block auth-button", href="login/twitterV2" disabled)
img(src='bootstrap/img/logo/x-sm-logo.png', width="30px", height="30px")
| Twitter/X Temporarily Not Accessible
img(src="bootstrap/img/logo/checkbox.png", class="export-success", width="30px", style="display:none;")
div(class="reddit-auth", id="reddit-auth")
a(class="btn btn-primary btn-block auth-button", href="login/reddit")
img(src='bootstrap/img/logo/reddit-sm-logo.png', width="30px",height="30px")
| Authorize with your Reddit account
img(src="bootstrap/img/logo/checkbox.png", class="export-success", width="30px", style="display:none;")
if REDDIT_ON
a(class="btn btn-primary btn-block auth-button", href="login/reddit")
img(src='bootstrap/img/logo/reddit-sm-logo.png', width="30px",height="30px")
| Authorize with your Reddit account
img(src="bootstrap/img/logo/checkbox.png", class="export-success", width="30px", style="display:none;")
else
a(class="btn btn-primary btn-block auth-button", href="login/reddit" disabled)
img(src='bootstrap/img/logo/reddit-sm-logo.png', width="30px",height="30px")
| Reddit Temporarily Not Accessible
img(src="bootstrap/img/logo/checkbox.png", class="export-success", width="30px", style="display:none;")
button(id="auth-next", style="", class="pull-right") next
15 changes: 9 additions & 6 deletions www/views/search/query.pug
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,15 @@ html
//div(class="twitter-auth",style="display:inline-block;")
// a(target="_blank", href="login/twitter")
// img(src='bootstrap/img/logo/twitter-sm-logo.png', width="30px",height="30px", style="margin-right:10px")
div(class="twitterV2-auth",style="display:inline-block;")
a(href="login/twitterV2")
img(src='bootstrap/img/logo/x-sm-logo.png', width="30px",height="30px", style="margin-right:10px")
div(class="reddit-auth",style="display:inline-block;")
a(href="login/reddit")
img(src='bootstrap/img/logo/reddit-sm-logo.png', width="30px",height="30px", style="margin-right:10px")
if TWITTER_ON
div(class="twitterV2-auth",style="display:inline-block;")
a(href="login/twitterV2")
img(src='bootstrap/img/logo/x-sm-logo.png', width="30px",height="30px", style="margin-right:10px")
if REDDIT_ON
div(class="reddit-auth",style="display:inline-block;")
a(href="login/reddit")
img(src='bootstrap/img/logo/reddit-sm-logo.png', width="30px",height="30px", style="margin-right:10px")

div(id="authorized",style="display:inline-block;")
p(style="display:inline-block;margin:10px 10px;") You have already authorized:
//img(id="twitter-authorized", src='bootstrap/img/logo/twitter-sm-logo.png', width="30px",height="30px", style="margin-right:10px;display:none;")
Expand Down