Download modules and packages for your Total.js applications.
totaljs / modules Goto Github PK
View Code? Open in Web Editor NEWModules for Total.js web applications
Home Page: http://www.totaljs.com
Modules for Total.js web applications
Home Page: http://www.totaljs.com
Download modules and packages for your Total.js applications.
Hallo Peter,
I was using angular.js with your module and I was wondering why I had allways "undefined" in the header of the outputfile. I think there is a little mistake in this line:
self.repository['$head'] += angularBeg + angularEnd;
If I am not using ngStyle the variable self.repository['$head'] is undefined and it return "undefined" + angularBeg + angularEnd.
Replacing the line with
self.repository['$head'] = (self.repository['$head'] || '') + angularBeg + angularEnd;
solved the problem.
Thanks for all your work.
the example provided in the twitter module returns an error:
{"errors": [ { "code": 215, "message": "Bad Authentication data." } ] }
(also created an app in apps.twitter.com for the keys)
thanks
does swig modules support minify??
in definition there is authorization
auth.onAuthorization = function(id, callback) {
// this is cached
// read user information from database
// into callback insert the user object (this object is saved to session/cache)
// this is an example
callback({id:id});
// if user not exist then
// callback(null);
};
how to get value beside id that saved to cookies
Hi,
I created empty total.js project and try to use helper webcounter methods to show counter value in homepage.html like this:
@{meta('title', 'description', 'keywords')}
@{visitors()}
<div>Hello world!</div>
Total.js is returning error:
default ---> SyntaxError: Unexpected token ) ([object Object]) SyntaxError: Unexpected token )
When I change @{visitors()}
to @{visitors('')}
then it is working.
I do not know whether this is the fault of wrong implementation or documentation.
Best regards.
I really do not understand definitions. Why and how should I use them? Do you have any good example?
Hello ,
I wrote a module for stylus.
Maybe you can it add in "totaljs/modules/css"
Stylus module is here : https://github.com/evmek/modules/tree/master/CSS/stylus
Thanks
hello,
i need help in this line of view
@{if flash('error') == null}
<div class="alert alert-dismissible alert-danger">
<button type="button" class="close" data-dismiss="alert">x</button>
<strong>@{flash('error')}</strong>
</div>
@{fi}
this is the controller
var passport = require('passport');
exports.install = function() {
F.route('/auth', local_get, ['#session', '#flash']);
F.route('/auth', local_login_post, ['post', '#session', '#passport.js', '#flash']);
// or
// F.route('/');
};
function local_get() {
var self = this;
self.view('index');
}
function local_login_post() {
var self = this;
passport.authenticate('local-login', {
successRedirect: '/',
failureRedirect: '/auth',
failureFlash: true
})(self.req, self.res);
}
message error:
500: Internal Server Error :: Error: View: index - ReferenceError: flash is not defined
at Object.Controller.view (E:\GitHub\total-faq\node_modules\total.js\index.js:12420:13)
at Object.local_get (E:\GitHub\total-faq\controllers\auth.js:16:7)
at Subscribe.doExecute (E:\GitHub\total-faq\node_modules\total.js\index.js:9089:23)
at E:\GitHub\total-faq\node_modules\total.js\index.js:9022:8
at Array._async_middleware (E:\GitHub\total-faq\node_modules\total.js\utils.js:4076:4)
at Immediate.res.$middleware as _onImmediate
at processImmediate as _immediateCallback
https://github.com/totaljs/modules/blob/master/Security/auth/auth.js#L61
// currently:
if (!user || !options.autoLogin) {
// shouldn't it be:
if (!user && !options.autoLogin) {
?
I got the following error :
Error: ENOENT, no such file or directory '/public/themes/frontend/default/views/index.html'
It only works if using full path :
/home/cevarief/node/cms/public/themes/frontend/default/views/index.html
in 1.0.0 dot features support partial include
how to use it??
in my test it's end up undefined but return no error..
I see in https://github.com/olado/doT/tree/master/examples/views
Getting that error:
======= 2016-11-21 13:30:11: TypeError: CONFIG(...).indexOf is not a function TypeError: CONFIG(...).indexOf is not a function
there:
https://github.com/totaljs/modules/blob/master/CSS/stylus/stylus.js#L10
Replacing with
F.accept('.styl','text/css');
Works fine.
Hi,
I am referring the below page and I use it.
https://github.com/totaljs/modules/blob/master/Security/auth/example/controllers/default.js
When I click the json_logoff function second time, then the page response is "401: Unauthorized". In the below code, I can I check whether the user already logoff, so I can re-route to some other page.
function json_logoff() {
var self = this;
var auth = MODULE('auth');
var user = self.user;
auth.logoff(self, user.id);
self.redirect('/');
}
While i trying to use (For example) @import "./public/css/common.styl",
i getting this error in console:
Error: stylus:1:9
1| @import "common.styl"
--------------^
2|
3| .errorName
4| position absolute
failed to locate @import file common.styl
...
at Renderer.render (/home/ubuntu/workspace/NGSpaceNG/node_modules/stylus/lib/renderer.js:86:26)
at /home/ubuntu/workspace/NGSpaceNG/modules/stylus.js:55:69
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:415:3)
Readme file example wrong in auth module.
auth.onAuthorization changed v2, auth.onAuthorize.
Peter my idea, more attention backward compatibility for security modules.
Hi Peter,
I try to use nosqlexplorer without success.
I set up my environnement as you said in the link above inside my adminmonitor project.
I tried this link : http://127.0.0.1:8000/$nosqlexplorer/?name=wt
Same result.. I cannot browse my nosqldatabase.
I really like this solution.
Can you tell me what to do ?
Cheers
Hi Peter,
Is it possible to access the session in websocket connections?
Currently I set a session variable username
for each user after login. The client also connects to total.js using websocket to get updates & notifications. I need to get the username
in websocket connections to route the notifications.
I access the session in normal total.js contollers via this.session; However It seems this.session
is null inside the websocket controller.
My code in controllers/default.js
:
exports.install = function(framework) {
framework.route('/*', view_app);
// other routes
framework.websocket('/', socket_homepage, ['json']);
};
function view_app() {
var self = this;
// self.session is OK here
}
function socket_homepage() {
var self = this;
// self.session is undefine!
}
Question: does websocket requests share the same session cookies with normal http requests? If yes,
is there any way to resolve the session variables based on the cookie sent by the browser?
Thanks in advance,
Hi,
I am referring the page https://github.com/totaljs/modules/tree/master/Security/oauth2,
In which everything works well except the Github. When I click the Github it take me to the Twitter API. I think, my code is correct.
Hi,
In the definitions/modules.js, I see the below code
INSTALL('module','http://modules.totaljs.com/session/v1.00/session.js');
I have downloaded the session.js and saved under
modules/session.js, ie., I want to load the session from my own hosting path. When I start the totaljs application using debug.js, I see the below error,
======= 2015-03-25 20:07:29: framework.install('module', 'undefined') ---> Refer
enceError: session is not defined ReferenceError: session is not defined
Please advise how to fix this.
Is it possible to use the global variables in Jade/Pug? (We have rewritten the Jade version to Pug)
exports.install = function(){
F.global.some_var = "some value";
F.route("/dashboard", dashboard, ['authorize']);
});
function some_view(){
model = {'title' : 'Title'};
self.view('someview', model);
}
Jade/Pug:
h1= title
div.somediv= global.some_var
Hello,
I see this solution: http://jxcore.com/jxp/
But how to integrate this protection code in Total.js or an alternative to protected the node code ?
Thx
I've just put the module and definition on my project, without really using it, and it is throwing this:
homepage_prod homepage TypeError: Cannot call method 'split' of undefined TypeError: Cannot call method 'split' of undefined
homepage_prod homepage at EventEmitter.eval (eval at (/home/ubuntu/homepage/node_modules/partial.js/index.js:22:10651), :4:60)
homepage_prod homepage at EventEmitter.emit (events.js:98:17)
homepage_prod homepage at Subscribe._execute (/home/ubuntu/homepage/node_modules/partial.js/index.js:24:11699)
homepage_prod homepage at EventEmitter.Async.refresh (/home/ubuntu/homepage/node_modules/partial.js/utils.js:23:423)
homepage_prod homepage at AsyncTask.complete (/home/ubuntu/homepage/node_modules/partial.js/utils.js:22:29597)
homepage_prod homepage at EventEmitter.Session._create (/home/ubuntu/homepage/modules/session.js:75:5)
homepage_prod homepage at EventEmitter.Session._read (/home/ubuntu/homepage/modules/session.js:38:14)
homepage_prod homepage at Object. (/home/ubuntu/homepage/modules/session.js:95:32)
homepage_prod homepage at AsyncTask.run (/home/ubuntu/homepage/node_modules/partial.js/utils.js:22:28705)
homepage_prod homepage at EventEmitter.Async.refresh (/home/ubuntu/homepage/node_modules/partial.js/utils.js:23:197)
homepage_prod homepage at EventEmitter.Async.run (/home/ubuntu/homepage/node_modules/partial.js/utils.js:22:31244)
homepage_prod homepage at Subscribe.execute (/home/ubuntu/homepage/node_modules/partial.js/index.js:24:11034)
homepage_prod homepage at Subscribe.prepare (/home/ubuntu/homepage/node_modules/partial.js/index.js:24:11523)
homepage_prod homepage at Subscribe._end (/home/ubuntu/homepage/node_modules/partial.js/index.js:24:13596)
homepage_prod homepage at IncomingMessage.EventEmitter.emit (events.js:92:17)
homepage_prod homepage at _stream_readable.js:920:16
homepage_prod homepage at process._tickCallback (node.js:415:13)
I'm going to update the auth
module readme.md to take account for roles now being done via the @
flags rather than !
flags. However, I just wanted to check - should the roles of a user be defined in the user object or somewhere else?
My guess is that it works like this:
F.onAuthorize = function( id, callback, flags ) {
// get user associated with id
var user = { id: result.id, name: result.name, roles: result.roles }
callback( true, user );
}
Where roles
would be a string array, eg. ['admin','moderator']
When routes require a role, use flags, eg:
F.route( '/some/path/', handlerFn, ['@admin'] );
Then the framework will handle the rest?
What if a route has multiple roles? eg. ['@admin','@moderator']
- if the user only has one role admin
, will they be allowed to use a route that lists multiple roles, or would used need to have all those roles to use that route?
Hi,
I am hosting my application using Google Compute Engine, and it allow me to send email via SendGrid. Please refer the page at https://cloud.google.com/compute/docs/tutorials/sending-mail#nodejssendgrid
I like to use total.js own mail option which is working well for me now using google smtp.gmail.com. Could you please advise how to configure total.js/mail to work with SendGrid. SendGrid offer it own package at https://sendgrid.com/docs/Integrate/Code_Examples/nodejs.html.
But, still I prefer to use total.js/mail. Please advise.
Hi.
How can I prevent the common user from visiting some pages like admin panel?
I did that with controller.cancel() and controller.throw403() in framework event "controller", but it always throw a framework error to console when a request without permission is passing.
Thx.
https://cnd.totaljs.com/oauth2.js
Getting 502 nginx error accessing CDN
I tested the dot example and got this error
TypeError: Cannot read property 'contentType' of undefined TypeError: Cannot read property 'contentType' of undefined
at Object.Controller.view (eval at (/Volumes/Data/Cloud/Project/github/partial.js-modules/dot/example/node_modules/partial.js/index.js:22:15139), :1:1204)
at Object.view_homepage (/Volumes/Data/Cloud/Project/github/partial.js-modules/dot/example/controllers/default.js:7:7)
at Subscribe._execute (/Volumes/Data/Cloud/Project/github/partial.js-modules/dot/example/node_modules/partial.js/index.js:24:18952)
at Subscribe.execute (/Volumes/Data/Cloud/Project/github/partial.js-modules/dot/example/node_modules/partial.js/index.js:24:17239)
at Subscribe.prepare (/Volumes/Data/Cloud/Project/github/partial.js-modules/dot/example/node_modules/partial.js/index.js:24:18410)
at Subscribe._end (/Volumes/Data/Cloud/Project/github/partial.js-modules/dot/example/node_modules/partial.js/index.js:24:20585)
at IncomingMessage.EventEmitter.emit (events.js:92:17)
at _stream_readable.js:920:16
at process._tickCallback (node.js:415:13)
on this page:
https://github.com/totaljs/modules/tree/master/Miscellaneous/online
The link to stats demo is broken:
https://www.totaljs.com/stats/
======= 2017-10-04 23:27:18: default ---> TypeError: Cannot read property 'success' of undefined (http://localhost:8000/) TypeError: Cannot read property 'success' of undefined
at Controller.view (eval at F.install (...\node_modules\total.js\index.js:3712:48), <anonymous>:65:19)
If I comment out this line in pug.js
:
self.subscribe.success();
The module works
Hello,
I found an alternative with https://auth0.com
This provider used multiples enterprises identity process.
Can you have a plan to integrate this solution in module ?
Thx
Hi, below line is my controller.
F.route('/addmyinterests',addmyinterests,['post','authorize']);
I call this page via AJAX, something like the below
type:"POST",data:'value='+tobeadded_val,url:"addmyinterests", success:function(data){ $('#ui').html(data.r); }
In case the page is not unauthorized, in my AJAX, I can read the status and prompt to the users appropriately. Something like the below
(XHR.status){case 401:window.location='passport'};
For some reason, if user directly hit my URL as http://localhost/addmyinterests, then the server page response as below. Please advise how to either set template for this message or how can I redirect to login page from the server side.
404: Not Found
Thanks in advance.
Session works well in debug while always fails in test. I got code 408 each time in test mode. Finally, I found the bug is at Line 78 in session.js ,requiring a req.headers['user-agent'] which was not included in the header of test request.
Title says it all, it seems strange to minify server-side javascript
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.